Postmessage not work with Ctrl + Key ; Shift + Key; Alt + Key; Window + Key and Shift

This is a discussion on Postmessage not work with Ctrl + Key ; Shift + Key; Alt + Key; Window + Key and Shift within the Development board part of the Software/Hardware and Mobile Phones category; Hi I have used Postmessage to send key for a window, but that is not work. 1. Shift // Not ...

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    akampro is offline Newbie
    Array
    Join Date
    May 2012
    Posts
    9
    Rep Power
    2
    Reputation
    0

    Postmessage not work with Ctrl + Key ; Shift + Key; Alt + Key; Window + Key and Shift

    Hi
    I have used Postmessage to send key for a window, but that is not work.



    1. Shift // Not work
    PostMessage (lHandle, WM_KEYDOWN, VK_LSHIFT, 0);
    2. Shift + F5 //Not work
    PostMessage (lHandle, WM_KEYDOWN, VK_LSHIFT, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_F5, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_LSHIFT, 0);

    3. Ctrl + F5 // not work
    PostMessage (lHandle, WM_KEYDOWN, VK_LCTRL, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_F5, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_LCTRL, 0);

    4. Alt + F5 // not work
    PostMessage (lHandle, WM_KEYDOWN, VK_LALT, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_F5, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_LALT, 0);
    5. Window // not work
    PostMessage (lHandle, WM_KEYDOWN, VK_Window, 0);
    6. WINDOW + D // not work
    PostMessage (lHandle, WM_KEYDOWN, VK_LWINDOW, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_D, 0);
    PostMessage (lHandle, WM_KEYDOWN, VK_LWINDOW, 0);

    Please help me!
    Thanks

  2. #2
    Darchrow's Avatar
    Darchrow is offline Life's good.



    Array
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    1,671
    Rep Power
    8
    Reputation
    1141
    You could try to use SendKeys.

    Questions? Need help? Mail me: darchrow(at)d3scene(dot)com

  3. #3
    akampro is offline Newbie
    Array
    Join Date
    May 2012
    Posts
    9
    Rep Power
    2
    Reputation
    0
    Quote Originally Posted by Darchrow View Post
    You could try to use SendKeys.
    Thanks Darchrow:
    If window not active then Sendkeys is not work. I want send key for window not active.

    Thanks

  4. #4
    Darchrow's Avatar
    Darchrow is offline Life's good.



    Array
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    1,671
    Rep Power
    8
    Reputation
    1141
    You can activate it via code.

    Questions? Need help? Mail me: darchrow(at)d3scene(dot)com

  5. #5
    akampro is offline Newbie
    Array
    Join Date
    May 2012
    Posts
    9
    Rep Power
    2
    Reputation
    0
    Quote Originally Posted by Darchrow View Post
    You can activate it via code.
    Thanks Darchrow

    I searched on google but not good.
    Example:
    1. Active window if it not active.
    2. Use SendKeys, keybd_event or SendInput.
    But not good, because it is discomfort to user. I want use hook mouse & keyboard.

    I use Sendmessage, Postmessage, SendNotifyMessage,PostThreadMessage,PeekMessage,Se ndMessageCallback but not work

    I heard there are 3 functions sendkey better, but I not found.

    @ Qazzy : ALT + KEY but he is offline


    Thanks
    Last edited by akampro; 05-13-2012 at 03:13 AM.

  6. #6
    Darchrow's Avatar
    Darchrow is offline Life's good.



    Array
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    1,671
    Rep Power
    8
    Reputation
    1141
    If you use SendKeys you have to activate the window and put it into the foreground otherwise it won't work.

    Questions? Need help? Mail me: darchrow(at)d3scene(dot)com

  7. #7
    LordLoras's Avatar
    LordLoras is offline Mentor
    Array
    Join Date
    Feb 2010
    Location
    Bulgaria
    Posts
    117
    Rep Power
    4
    Reputation
    38
    If you are trying to make a bot for online game gameguard and some other protections block sendmessage and postmessage and you have to use external dll google it PostMessageX. Overall your code is correct but are you sure your handle is correct ? give it shot with PostMessage(handle,WM_SYSCOMMAND,SC_CLOSE,0) it should close the running application.
    Try also that example:$5A = hex of Z
    var
    key:dword;
    h:hwdn;

    A:=MapVirtualKey($5A,0);
    A:=A shl 16;
    handle:= FindWindow('MapleStoryClass', nil);
    if handle<>0 then begin
    PostMessageX(Handle,WM_KEYDOWN, $5A, A);

    P.S. i've also tryed to use alt key modifier but used alt + f4 for my test because i don't have an application or have with other multi hotkey and after that test it did not closed.Later when i have time ii will experiment more and share my results with you


    EDIT: Your virtual keys are wrong D is 44(hex),alt is VK_MENU, left control is VK_LCONTROL and win key is VK_LWIN
    full keycodes list can be found here http://msdn.microsoft.com/en-us/library/ms927178.aspx
    Last edited by LordLoras; 05-13-2012 at 03:02 PM.

  8. #8
    akampro is offline Newbie
    Array
    Join Date
    May 2012
    Posts
    9
    Rep Power
    2
    Reputation
    0
    Thanks LordLoras

    You can share PMX.dll file. Because I searched on google. PostMessageX in PMX.dll

    Thanks
    Akam

  9. #9
    LordLoras's Avatar
    LordLoras is offline Mentor
    Array
    Join Date
    Feb 2010
    Location
    Bulgaria
    Posts
    117
    Rep Power
    4
    Reputation
    38
    here is it with list of virtual key codes i do not take any credits for creating the dll just sharing it
    Download

    and here is delphi code how to insert it:
    function PostMessageX(
    hWnd:HWND;
    MSG:UINT;
    WPARAM:wParam;
    LPARAM:lParam):BOOL;stdcall;
    external 'PMX.dll' name 'PostMessageX';

    P.S. i was not able to detect if alt+key is pressed when send with postmessage.I used getkeystate function and that function did not detected when keystroke was send thoguh postmessage

  10. #10
    akampro is offline Newbie
    Array
    Join Date
    May 2012
    Posts
    9
    Rep Power
    2
    Reputation
    0
    Thanks LordLoras
    I didn't set lParam parameter. You can help me.

    Thanks

Page 1 of 2 12 LastLast

Similar Threads

  1. Promocodes for Time shift Radio App
    By harrylee in forum iOS forum
    Replies: 0
    Last Post: 10-11-2011, 10:32 AM
  2. [News] Need for Speed Shift 2: Unleashed Trailer
    By razathru in forum Need for Speed series
    Replies: 10
    Last Post: 10-08-2011, 02:09 PM
  3. [Request] Shift Build Delay Remover/Fast Build/Autobuild program
    By FaceOfMelinda in forum Warcraft 3 Hacks
    Replies: 11
    Last Post: 08-08-2011, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •