PostMessage in C# with ALT + C key and CTL + S key

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hiten

    PostMessage in C# with ALT + C key and CTL + S key

    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("user 32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern bool PostMessage(Int Ptr hWnd, uint Msg, uint
    wParam, uint lParam);

    public void SendCutomMessag e(IntPtr hwnd)
    {
    PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'C',0); // For ALT+C
    wparam and lparam are correct?
    PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'S',0); // For CLT+S
    wparam and lparam are correct?
    }

    Thanks in advance.....
    Hitendra Patel
  • =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?=

    #2
    Re: PostMessage in C# with ALT + C key and CTL + S key

    Hi Hitendra,

    first of all: What OS are you using: XP and Lower or
    Vista based, since there is a big difference and a big
    security border you have to pass on Vista. On Vista
    you cant just send Keystrokes and Messages to other
    Windows and processes as you did in the past,...

    See here:

    [User Interface Privilege Isolation]


    This must be done, since it was a big security whole
    if you knew how to "leverage" it,...

    Regards

    Kerem

    --
    -----------------------
    Beste Grüsse / Best regards / Votre bien devoue
    Kerem Gümrükcü
    Latest Project: http://www.codeplex.com/restarts
    Latest Open-Source Projects: http://entwicklung.junetz.de
    -----------------------
    "This reply is provided as is, without warranty express or implied."
    "Hiten" <hitendra15@gma il.comschrieb im Newsbeitrag
    news:16b90dad-f2a2-4084-90db-0c3654534008@a2 9g2000pra.googl egroups.com...
    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("user 32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern bool PostMessage(Int Ptr hWnd, uint Msg, uint
    wParam, uint lParam);
    >
    public void SendCutomMessag e(IntPtr hwnd)
    {
    PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'C',0); // For ALT+C
    wparam and lparam are correct?
    PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'S',0); // For CLT+S
    wparam and lparam are correct?
    }
    >
    Thanks in advance.....
    Hitendra Patel

    Comment

    • Hiten

      #3
      Re: PostMessage in C# with ALT + C key and CTL + S key

      Hi Kerem,


      Thanks for your reply, OS is WindowsXP and Vista but not ran it on
      Vista till now,
      I want to send Alt + C and Ctl+S keys to an application without
      bringing
      it front (say they are minimized).
      Please guide on this,

      Thanks
      Hitendra


      On Sep 20, 8:31 pm, Kerem Gümrükcü <kareem...@hotm ail.comwrote:
      Hi Hitendra,
      >
      first of all: What OS are you using: XP and Lower or
      Vista based, since there is a big difference and a big
      security border you have to pass on Vista. On Vista
      you cant just send Keystrokes and Messages to other
      Windows and processes as you did in the past,...
      >
      See here:
      >
      [User Interface Privilege Isolation]http://en.wikipedia.or g/wiki/User_Interface_ Privilege_Isola tion
      >
      This must be done, since it was a big security whole
      if you knew how to "leverage" it,...
      >
      Regards
      >
      Kerem
      >
      --
      -----------------------
      Beste Grüsse / Best regards / Votre bien devoue
      Kerem Gümrükcü
      Latest Project:http://www.codeplex.com/restarts
      Latest Open-Source Projects:http://entwicklung.junetz.de
      -----------------------
      "This reply is provided as is, without warranty express or implied."
      "Hiten" <hitendr...@gma il.comschrieb im Newsbeitragnews :16b90dad-f2a2-4084-90db-0c3654534008@a2 9g2000pra.googl egroups.com...
      >
      >
      >
      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("user 32.dll", CharSet = CharSet.Auto, SetLastError = true)]
      public static extern bool PostMessage(Int Ptr hWnd, uint Msg, uint
      wParam, uint lParam);
      >
      public void SendCutomMessag e(IntPtr hwnd)
      {
            PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'C',0); // For ALT+C
      wparam and lparam are correct?
            PostMessage(hwn d,WM_SYSKEYDOWN ,(unit)'S',0); // For CLT+S
      wparam and lparam are correct?
      }
      >
      Thanks in advance.....
      Hitendra Patel- Hide quoted text -
      >
      - Show quoted text -

      Comment

      Working...