Are you getting the correct hwnd value for the application? I presume that
you are attempting to send it to an application other than the one that you
are executing this code from. Use FindWindow to get the hwnd for the
running application. Be aware that if the external application's window
title changes, your application will not work anymore.
...Glenn
On Sat, Sep 20, 2008 at 8:31 AM, Hitendra <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Please can any one help on how to send ALT+C and CLT+ S key press key
> press event to the running application, i tried all possible what I
> was able to search on net but not got the result.
>
> Below if the code
>
> public const UInt32 WM_CHAR = 0x0102;
> public const UInt32 WM_SYSKEYDOWN = 0x0104;
> public const UInt32 WM_KEYDOWN = 0x0100;
>
> [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
> public static extern bool PostMessage(IntPtr hWnd, uint Msg, uint
> wParam, uint lParam);
>
> public void SendCutomMessage(IntPtr hwnd)
> {
> PostMessage(hwnd,WM_SYSKEYDOWN ,(unit)'C',0); // For ALT+C
> wparam and lparam are correct?
> PostMessage(hwnd,WM_SYSKEYDOWN ,(unit)'S',0); // For CLT+S
> wparam and lparam are correct?
> }
>
> Thanks in advance.....
> Hitendra Patel
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---