CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    57

    Controlling/sending messages/getting info from other programs

    I am seeking out information on controlling, or sending messages and receiving information, to/from other programs. I've been searching the forums and google on this, and I've had some progress. I'll explain what exactly I want to do and what I've done so far.

    I want to figure out how to find the ID of different items/functions(Not sure if I'm saying this correclty) of a program. Is Spy++ the best way to do this? Here's a very simple example of what I mean. Say I open up the windows calculator and want to add 1+1. I figured out that the ID of the 1 button is 125. Is there a way to just send a msg to the calculator that I want the button with the id of 125 to be pushed? Or do I HAVE to send a message that I am clicking at the coordinates of the button? I tried this, and it just doesn't do anything(bear with me, I'm a newbie at this)...

    Code:
    public const int WM_SYSCOMMAND  = 0x0112; 
    public const int ONE = 0x7D; 
    ...
    Process calc = new Process();
    calc.StartInfo.FileName = "calc.exe";
    calc.Start();
    SendMessage(calc.MainWindowHandle.ToInt32(), WM_SYSCOMMAND, ONE, 0);
    Also, are there ways to be monitoring a program and be alerted or react to a change. For example, say I'm monitoring AOL Instant Messenger, and I see one of my friends logs on. The program would notice that this particular friend logged on and it would react to that.

    If there are any resources that yall can point me towards that has anything about this subject, please let me know. Even letting me know what specific key words to search for on this forum or on google would be very helpful. Thanks in advance.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: Controlling/sending messages/getting info from other programs

    public const int WM_COMMAND = 0x0111;

    Process calc = new Process();
    calc.StartInfo.FileName = "calc.exe";
    calc.Start();
    calc.WaitForInputIdle();
    SendMessage(calc.MainWindowHandle.ToInt32(), WM_COMMAND, ONE, 0);

  3. #3
    Join Date
    Sep 2004
    Posts
    57

    Re: Controlling/sending messages/getting info from other programs

    Thank you very much for your response. It definitely helps broaden my understanding. I tried playing around some more with Spy++. This time, I was using it on AIM. I filtered out some of the messages to display in the log, so it would only display my mouse clicks. I tried clicking on different buddies in the buddy list, and it doesn't seem like it's giving me a specific ID or handle or anything. Maybe I'm not looking for the write thing or maybe I filtered out a useful message type. It does give coordinates, but surely each buddy in the list would have some type of ID or something that would store the name string or position or something. Is there an easier way to test this type of stuff out to get specific ID's or handles? Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured