Originally Posted by
Dragoon_42
I'm writing a little app that opens the default mail program and sends a message that links to an attachment on a network. My question is where can I find a full list of all characters that need to be preceded by a \ to be considered characters, i.e: \" =" .
Also is there anyway to send keystrokes to another program? I want to send the keystroke control+enter (pressing both keys at the same time). This would allow me to automatically send the e-mail. Thanks for any help!
Code:
//Syntax: mail address subject filename
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char trial[]="start mailto:\"";
char subj[]="?subject=";
char body[]="&body=<a href=file:///z:";
char ending[]="</a>\"";
strcat(trial,argv[1]);
strcat(trial,subj);
strcat(trial,argv[2]);
strcat(trial,body);
strcat(trial,argv[3]);
strcat(trial,ending);
system(trial);
//wait for app to open and send keystrokes
return 0;
}
I think I can help you with the control enter thing:
Code:
keybd_event(VK_CONTROL, 0, 0, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
This simulates a virtual keyboard, more accurately it simulates two ones, a control press down, a return press down, a return up ppress, and a control up press. this will work for input into differenc programs, but it's a bit akward to use cause it's exactly like a keyboard. for "d", you say:
Code:
keybd_event('D', 0, 0, 0);
keybd_event('D', 0, KEYEVENTF_KEYUP, 0);
but for a capital D you have to put in a shift command with that.
one of these headers are used:
Code:
# include<fstream>
# include<iostream>
# include<string>
# include<conio.h>
# include<time.h>
# include<windows.h>
# include<tchar.h>
don't know which one tho.
as for the '\' question, I think the compiler should give you a warning/error about illegal escape sequences if you've encountered one, I think, well that has been my experience.
hope that helps!!