im a newbie with c++ today and im trying to make a dll to send key to inactive window but i tryed calling it and nothing gets sent dont know if i call it right or not .
DLL:
Code:
#include "main.h"
#include <windows.h>
// a sample exported function
int DLL_EXPORT SendMessage(int x = 0){
//HWND Client = FindWindow(0, "D3D Window");
HWND hwnd = FindWindow("D3D Window", NULL);
// SendInput(hwnd, '2');
SendMessage(hwnd, WM_KEYDOWN, VK_F4, 0);
Sleep(300);
SendMessage(hwnd, WM_KEYUP, VK_F4, 0);
return x;
// PostMessage(hwnd, WM_KEYDOWN, 0x43, 0);
// PostMessage(hwnd, WM_CHAR, (WPARAM)'C', 0);
// PostMessage(hwnd, WM_KEYUP, 0x43, 0);
// cout << "pressed" << endl;
MessageBox(0, "Join us at Inferno Dev!", "DLL Message", MB_OK | MB_ICONINFORMATION);
return x;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // successful
}
AutoIt DLL CALL:
Code:
DllCall("test.dll", "none", 'SendMessage')
please help me how can i make the dll send a key to inactive window
tryed googling tutorials of c++ but nothing at all o.o
Sendkey (=SendMessage) doesnt work. A window has a message queue in which it peeks for messages, but it does not receive messages while inactive, to save CPU time. Plus, if your window is a game, it probably uses directinput which doesnt check the message queue anyway.
On a side-note; your signature is telling everyone that you have no idea of computer science.
Sendkey (=SendMessage) doesnt work. A window has a message queue in which it peeks for messages, but it does not receive messages while inactive, to save CPU time.
this is just wrong.
windows wont send normal windows messages anymore, but the messagepump is still active even if the window has not the focus.
if you place a message in the messagequeue via send/postmessage windows will reactivate the messagepump and the window will proceed the message.
but most likely the game/the anticheat has a check wether the window is ontop / the input is emulated.
or the game simply uses directinput.
if you place a message in the messagequeue via send/postmessage windows will reactivate the messagepump and the window will proceed the message.
yes, windows will do that. however, on a custom message loop you dont necessarily check any messages (if you suspend your window thread or check in a peekmessage loop for example).
Keep SRO active while window is inactive? 05/28/2012 - Silkroad Online - 0 Replies I remember I used to have this happen - that I could open up 2 windows side by side, one SRO, other a browser, for example. And while I surfed in the browser the SRO window would be inactive but picture would still keep moving so I could watch my bot do the work or keep an eye on the chat window.
But now when I click on any other window the SRO window will freeze : \
Anyone know how to avoid that?
Autoit Controlsend (inactive window) 12/05/2009 - AutoIt - 3 Replies Hiho,
ich hab soweit einen funktionierenden Bot - ich wollte nun das Script so umschreiben das es auch auf das inaktive Fenster von dem Spiel zugreift.
Habe mich im Forum etwas belesen und bin zu folgenden Aussagen gekommen:
- #requireAdmin(funktioniert nicht)
- "0" oder "" bei dem Absatz ControlID (funktioniert auch nicht)
Den Titel des Fensters habe ich nun schon dutzende male überprüft, der ist 100%ig korrekt.
1Cabal Window 1Maple Window at Same TIME?? 05/26/2008 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 0 Replies let talk about 1 cabal 1 maple at same time...
possible??
how to do tat...??
teach me please :p
Rename CO2 window title (any window actually) 05/13/2006 - CO2 Exploits, Hacks & Tools - 4 Replies I have seen a few posts requesting this. It is a simple autohotkey macro nothing fancy here. You will notice also that the UPX packer detection is not triggered. If you use autohotkey and want to know how to remove the packer PM me it is rather simple. To use this little tool thingie it is very simple:
Execute the code.
Focus your window.
Press Hotkey CTRL+WIN+w
Change the Title.
Apply