| Author |
Message |
Hooch
Joined: 29 May 2011 Posts: 1
|
Posted: Sun May 29, 2011 10:42 am Post subject: Send key presses to background application window |
|
|
Hello.
Can you help me to transfer that code to C#?
| Code: |
HWND Notepad = FindWindowEx( GetDesktopWindow( ), 0, "Notepad", 0 );
SendMessage( GetDlgItem( Notepad, MB_TYPEMASK ), WM_SETTEXT, 0, (LPARAM)"Hello Notepad, what's up?" ); |
Thank you in advance
I want to send key presses to background window.
I don't want to use SendKeys.Send because I want that window to be in background.
SendKeys requires that window is active. |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Tue May 31, 2011 9:46 am Post subject: |
|
|
You can find the signatures for both functions on http://www.pinvoke.net. Once you insert the signature suggested by PInvoke, you can use both native functions from C#, for example:
| Code: |
[DllImport("User32.DLL")]
public static extern int SendMessage(IntPtr hWnd, UInt32 Msg, Int32 wParam, Int32 lParam); |
You'll also want to read the notes carefully on the PInvoke page for that function. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
twain
Joined: 14 Nov 2011 Posts: 2
|
Posted: Fri Nov 25, 2011 6:05 am Post subject: |
|
|
| Well, I too had been recently working on this one. First of all, you need to search for the signatures for the two functions. The link for that has been given here by Brian. After you insert the signature, you can effectively use both of the native functions in C#. Has anyone used Port 25? Are they good in email delivery solutions? |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group