Sending Key messages to a Windows App
Reply
![]() |
|
From:
![]() Mahendrakumar8
|
yeah, we can do that, send messages to other/third party windows application. For this, we need to have the handle to the control where you want to send the message. In windows, all the child controls have handles with them and we need to know them. once we know the handle, then we need to import the win32 api call by using DllImport attribute and import SendMessage api call. And in our program, we should passon the handle to the control, along with the message.
Sample Code :
using Microsoft.Win32;
[DllImport("user32")] public static extern int SendMessageA(int handle, int command, int instruction, StringBuilder str)
My_Method() { //get the handle to the destination window/control SendMessageA(handle, WM_NOTIFY, CMD, null); }
Handle -> Destination window Handle CMD -> It's enum. KeyDown, KeyUp
Thanks & Regards, A. Mahendra kumar |
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|