SendMessage to another Application
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: SendMessage to another Application

  1. #1
    Join Date
    Jan 2010

    SendMessage to another Application

                string lpszParentClass = "SciCalc";
                string lpszParentWindow = "Rekenmachine"; //Dutch translation Calculator
                string lpszClass = "Button";
                IntPtr hwnd = FindWindow(lpszParentClass, lpszParentWindow);
                IntPtr childhwnd = FindWindowEx(hwnd, IntPtr.Zero, lpszClass, "5");
                SendMessage(childhwnd, (int)VKeys.VK_2, 0, 0); //VKeys.VK_2 = 0x32
                SendMessage(childhwnd, (int)VKeys.VK_2, 0, 0);
    Supposed to press the button five on MS Calculator.
    It doesn't give any errors but it just doesnt work.
    What did I do wrong?

  2. #2
    Join Date
    Jan 2010

    Re: SendMessage to another Application


  3. #3
    Join Date
    Mar 2004
    3311'18.10"N 9645'20.28"W

    Re: SendMessage to another Application

    if you do get the correct hwnd from find window, try using post message instead of send message
    Last edited by MadHatter; January 24th, 2010 at 11:00 PM.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center