-
January 21st, 2010, 01:54 PM
#1
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?
-
January 21st, 2010, 03:25 PM
#2
Re: SendMessage to another Application
-
January 24th, 2010, 10:53 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|