Sending inputs to an inactive window menu

User Tag List

Results 1 to 9 of 9
  1. #1
    5waycarry's Avatar Member
    Reputation
    1
    Join Date
    Sep 2024
    Posts
    4
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sending inputs to an inactive window

    I'm trying to figure out how to send input to an inactive window (Path of Exile).

    So far I managed to send some input to an inactive notepad window:
    Code:
        #include  <Windows.h>
         
        int main()
        {
            HWND hWnd = FindWindowA("Notepad", NULL);
            HWND childHWND = FindWindowExA(hWnd, NULL, "Edit", NULL);
         
            if (!hWnd) {
                MessageBoxA(NULL, "Notepad window not found!", "Error", MB_OK);
                return 1;
            }
         
            PostMessage(childHWND, WM_CHAR, 'a', 0);
         
            return 0;
        }
    However this obviously doesn't work for PoE as they have some kind of an input system. Also I'd need it to press that button at a specific mouse location. It can be right click too instead of a keypress, doesn't matter. Any ideas?
    Right now the best thing I managed to do was changing the active window back and forth but it's not as fast as I would want it to be.

    Sending inputs to an inactive window
  2. #2
    Razzue's Avatar Elite User Avid Ailurophile

    CoreCoins Purchaser Authenticator enabled
    Reputation
    398
    Join Date
    Jun 2017
    Posts
    608
    Thanks G/R
    193/283
    Trade Feedback
    2 (100%)
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 5waycarry View Post
    I'm trying to figure out how to send input to an inactive window (Path of Exile).

    So far I managed to send some input to an inactive notepad window:
    Code:
        #include  <Windows.h>
         
        int main()
        {
            HWND hWnd = FindWindowA("Notepad", NULL);
            HWND childHWND = FindWindowExA(hWnd, NULL, "Edit", NULL);
         
            if (!hWnd) {
                MessageBoxA(NULL, "Notepad window not found!", "Error", MB_OK);
                return 1;
            }
         
            PostMessage(childHWND, WM_CHAR, 'a', 0);
         
            return 0;
        }
    However this obviously doesn't work for PoE as they have some kind of an input system. Also I'd need it to press that button at a specific mouse location. It can be right click too instead of a keypress, doesn't matter. Any ideas?
    Right now the best thing I managed to do was changing the active window back and forth but it's not as fast as I would want it to be.
    Iirc Microsoft themselves block mouse input on inactive/background windows. Even with PostMessage/PostUserObject
    "May all your bacon burn"

  3. #3
    5waycarry's Avatar Member
    Reputation
    1
    Join Date
    Sep 2024
    Posts
    4
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. Unlucky

  4. #4
    Hazzbazzy's Avatar wannabe hackerlol Authenticator enabled
    Reputation
    1346
    Join Date
    Aug 2011
    Posts
    1,215
    Thanks G/R
    256/489
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Razzue View Post
    Iirc Microsoft themselves block mouse input on inactive/background windows. Even with PostMessage/PostUserObject
    I had luck with SendMessage in W10 for this purpose, haven't tried it on 11.
    "HOLY TIME MACHINE BATMAN! it's 1973!"
    https://youtube.com/Hazzbazzy

  5. #5
    cout00's Avatar Active Member
    Reputation
    27
    Join Date
    Sep 2022
    Posts
    70
    Thanks G/R
    20/24
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Hazzbazzy View Post
    I had luck with SendMessage in W10 for this purpose, haven't tried it on 11.
    he mean mouse events. any mouse click events to inactive windows will be filtered by basic window wndproc. cos mouse should be captured by window, but you cant a capture not a foreground window

  6. #6
    Razzue's Avatar Elite User Avid Ailurophile

    CoreCoins Purchaser Authenticator enabled
    Reputation
    398
    Join Date
    Jun 2017
    Posts
    608
    Thanks G/R
    193/283
    Trade Feedback
    2 (100%)
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Hazzbazzy View Post
    I had luck with SendMessage in W10 for this purpose, haven't tried it on 11.
    I have never been able to send a mouseclick to a background window via SendMessage (Of which both that, and PostMessage wrap NtPostUserObject, so if the direct syscall doesn't work neither would either of the wrappers.. ) on windows 10, plus depending on the game, they'd then have to worry about scrubbing the LLMH injected flags
    "May all your bacon burn"

  7. Thanks Hazzbazzy (1 members gave Thanks to Razzue for this useful post)
  8. #7
    Hazzbazzy's Avatar wannabe hackerlol Authenticator enabled
    Reputation
    1346
    Join Date
    Aug 2011
    Posts
    1,215
    Thanks G/R
    256/489
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Razzue View Post
    I have never been able to send a mouseclick to a background window via SendMessage (Of which both that, and PostMessage wrap NtPostUserObject, so if the direct syscall doesn't work neither would either of the wrappers.. ) on windows 10, plus depending on the game, they'd then have to worry about scrubbing the LLMH injected flags
    Apologies, I cannot read on occasion and didn't see the obvious point about "mouse input"; was referring to keyboard input.
    "HOLY TIME MACHINE BATMAN! it's 1973!"
    https://youtube.com/Hazzbazzy

  9. #8
    Razzue's Avatar Elite User Avid Ailurophile

    CoreCoins Purchaser Authenticator enabled
    Reputation
    398
    Join Date
    Jun 2017
    Posts
    608
    Thanks G/R
    193/283
    Trade Feedback
    2 (100%)
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Hazzbazzy View Post
    Apologies, I cannot read on occasion and didn't see the obvious point about "mouse input"; was referring to keyboard input.
    Actually, fun fact about that: The latest vanilla client update blocked left/right alt/ctrl/shift modifiers without actually setting up the lparams(scan code, transition/previous state) if you use post message (so by extention, I would assume SendMessage/SendInput as well)

    You can still set lparam as IntPtr.Zero on cata and retail clients still however.
    "May all your bacon burn"

  10. #9
    Sychotix's Avatar Moderator Authenticator enabled
    Reputation
    1444
    Join Date
    Apr 2006
    Posts
    4,002
    Thanks G/R
    295/588
    Trade Feedback
    1 (100%)
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    PoE will accept the mouse click event you send it, but it ignores the mouse location you pass in. It calls GetCursorPos() to get the current cursor position and sends the click to that location.

    If you want background input with PoE, you're going to need to hook the necessary methods (or maybe find/modify their input method to actually use the passed in position instead of calling GetCursorPos()).

  11. Thanks 5waycarry, d3ars0me1 (2 members gave Thanks to Sychotix for this useful post)

Similar Threads

  1. ControlSend or different method to send keystrokes to background PoE window
    By ProfessionalUberlabCarry in forum Path of Exile
    Replies: 1
    Last Post: 02-08-2022, 09:44 PM
  2. [Tool] Sending mouse input to the WoW Client (specifically 2.4.3) with Windows API
    By sneakydick in forum World of Warcraft Bots and Programs
    Replies: 3
    Last Post: 01-28-2019, 11:06 AM
  3. Replies: 1
    Last Post: 12-14-2015, 01:24 PM
  4. Send input to minimized window
    By fizzlesticks23 in forum Programming
    Replies: 0
    Last Post: 01-03-2014, 12:53 AM
  5. Freebie method for sending keys to multiple WoW windows
    By tomit12 in forum World of Warcraft Guides
    Replies: 6
    Last Post: 03-03-2008, 10:49 AM
All times are GMT -5. The time now is 06:38 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search