I am trying to make a simple macro thing, I want it to record messages such as the mouse inputs, but also things like page select. I plan on saving these into a list or array, and then just looping over them and sending to the computer.
I am using WinForms.
My problems, I don't know how to send them, and I don't know how to get them.
Thanks for any help!!
What I have tried:
I tried a silly thing using ChatGPT, and it was quite helpful, but then I adventally released its method doesn't capture certain events and it used PostMessage which required knowing which window to send to. I don't want to use a window as a frame(Unless that's required) I want to just know which messages happen directly as the are sent. I don't understand much about this, as I don't use C# much, so sorry if this wont work.
My current hooking method is
private IntPtr SetHook(int idHook, Delegate hookProc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
{
return SetWindowsHookEx(idHook, hookProc, GetModuleHandle(curModule.ModuleName), 0);
}
}
But again I don't usually use C# so I'm not quite sure what to do.
Thanks for any help!!