Thread: Special characters and sending them to programs...

  1. #1
    Slime Dragoon_42's Avatar
    Join Date
    Feb 2003
    Location
    Vancouver
    Posts
    90

    Special characters and sending them to programs...

    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;
    }

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Quote 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!!

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #4
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Hey, how do you do that?? the whole link with the name?

  5. #5
    Cat Lover
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    109
    [ url=address ]text[/ url ] without spaces

  6. #6
    Slime Dragoon_42's Avatar
    Join Date
    Feb 2003
    Location
    Vancouver
    Posts
    90
    You people rock. Thanks so much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sending n no of char data uning send() function,
    By thebrighter in forum Windows Programming
    Replies: 1
    Last Post: 08-22-2007, 12:26 PM
  2. Sigmaze! -- Second Attempt.
    By quzah in forum Contests Board
    Replies: 42
    Last Post: 11-09-2004, 06:45 PM
  3. Trailing characters after strncpy
    By senegene in forum C Programming
    Replies: 2
    Last Post: 01-02-2003, 05:44 PM