Hello. I have a problem in my hands and would be glad if someone could help me... I was playing a game when I got tired of using the keyboard to send key combinations... That was when I decided to create something to do it for me... Basically Im trying to write a hook to intercept window messages to another application, in this case the game window, and then send a combinations of keystrokes to the target window if the user press key X. Sending keys is not the problem, the problem is that I cant get this dll to work.
The problem is that calling a normal function works, but calling a function like this:
simply does not work.. By saying "normal function" I mean a function like void readKbMessages(). Im trying to link to it because I had created all the application logic, but could not connect to the LRESULT CALLBACK funcName(int, HOOKPROC, HINSTANCE, DWORD) function. The pointer is always nullCode:LRESULT __declspec(dllexport)__stdcall CALLBACK readKbMessages(void)
{
//some code
}
This is the code where I link to the dll:
Code:HMODULE hDll = LoadLibraryA("dll.dll");
LRESULT CALLBACK (*func)() = (LRESULT CALLBACK(*)())GetProcAddress(hDll, "readKbMessages");
it works ok for "normal functions", but I cannot get it to work on that miserable function. The function to intercept key strokes should be similar to that one.. Also I tried every combination I could think of.... LRESULT CALLBACK __stdcall(dllexport), etc, etc, etc... Im not very used to dlls, but I wont stop until I get to the end..
Also any info about hooking applications, intercepting window messages, etc, etc, would be great. This is the first time Im actually tryng this.
The final application should attach to a process, get its process ID, hook to it, intercept its messages, look for the user selected key, and if matched send the user selected key combinations to the target process. Thats all