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

    SendMessage to another Application

    Code:
                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
    Posts
    3

    Re: SendMessage to another Application

    dump

  3. #3
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    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
  •  





Click Here to Expand Forum to Full Width

Featured