Reputation: 770
I'm trying to develop a little helper tool to enable mouse integration for Windows 3.11 in VMWare Fusion since VMWare does not provide tools for this platform.
I can already read the mouse position in my application using the WH_MOUSE hook using the following code:
// VMOUSE - Hook global mouse to escape VM automatically
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include "smprintf.h"
HHOOK hMouseHook;
LRESULT CALLBACK mouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
MOUSEHOOKSTRUCT *pMouseStruct = (MOUSEHOOKSTRUCT*)lParam;
printf("Mouse position X = %d, Y = %d\n", pMouseStruct->pt.x, pMouseStruct->pt.y);
return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
hMouseHook = SetWindowsHookEx(WH_MOUSE, mouseProc, hInstance, NULL);
MessageBox(NULL, "Hello World", "Title", MB_OK);
return 0;
}
I understand that modern Win32 provides a WH_MOUSE_LL hook to detect mouse movement outside of the application itself and I was wondering if such a hook was available for Windows 3.11.
The communication between the host and the VM is a whole other thing, currently I'm planning to do this via winsock and trigger the keystroke on the host.
It would be amazing if anyone actually knows how to do this.
Thank you
Upvotes: 1
Views: 96