C++, send keystroke to background window without focusing it

Σε Εξέλιξη Αναρτήθηκε Πριν 5 χρόνια Πληρώθηκε κατά την παράδοση
Σε Εξέλιξη Πληρώθηκε κατά την παράδοση

I'm building a complex software. This software works as a dll inside another random third party softwares. Usually the third party software catches the VK_SPACE key from the dll's window, when the lastest has the focus.

However my *.dll supports multiple windows which aren't inside the main window. It means when one of such secondary windows are focused, the third party software doesn't detect the VK_SPACE.

So, I want to emulate the VK_SPACE in the main window when it's pressed on one of the secondaries ones without moving the keyboard focus.

As data I only have the HWND of all the dll windows (including the main one).

I tried to use PostMessage, SendMessage to the HWND of the main window without sucess. However, changing temporally the focus to the main window, using SendInput or keybd_event, and then returning the focus, DOES work. But I do not want to move the focus, right?

So, your job is quite simple. You need to to the same job that keybd_event does to send the VK_SPACE to another window which is not focused.

A function like this:

void sendSpacebar(HWND target)

{

//.... do your stuff....

// .... Func(HWND, VK_SPACE, paramx, paramy);

}

Your job is just that function.

NOTE: Using third party libraries are NOT allowed, just std, or basics like windows.h

Γλώσσα Προγραμματισμού C Προγραμματισμός C++ Αρχιτεκτονική Λογισμικού Windows Επιφάνεια Εργασίας

Ταυτότητα Εργασίας: #18197850

Σχετικά με την εργασία

1 πρόταση Απομακρυσμένη εργασία Ενεργό Πριν 5 χρόνια

1 freelancer κάνει προσφορά κατά μέσο όρο $45 για αυτή τη δουλειά

gardinirafael

Thanks for share the project. I can provide to you a exe example before to choose me. If you approves we can disccuss the final goal.

$45 USD σε 1 μέρα
(3 Αξιολογήσεις)
2.7