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:
AutoIt DLL CALL:
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
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