Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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!!
Posted
Updated 25-Apr-24 15:08pm
v2

1 solution

This is too close to providing code that aids in writing key logging software. Over the years, we have had many requests to provide code to people that can be used maliciously. Now, you might have benign intentions, and if it were just you and me discussing this over a cup of coffee, we could probably have an enjoyable open conversation about this. However, it's not just you and me. There are millions of people who can see this post, so that would be putting harmful information in easy reach of people. This is why we don't provide answers to questions like this.
 
Share this answer
 
Comments
G Schulz 26-Apr-24 17:58pm    
Oh I see, I am just trying to write a macro recorded, But I understand the risks. What should I do from here, as I still want to make a macro recorder, and those ones I find online don't always work how I'd want them too.
G Schulz 26-Apr-24 18:00pm    
I'd still like a reply, but I may have found a answer else where on stackoverflow, but I haven't tested it yet.
G Schulz 26-Apr-24 18:20pm    
We dang it... WH_JOURNALPLAYBACK Doesn't work in window 11 and that's the one that the Microsoft page says is good for macros
G Schulz 26-Apr-24 19:12pm    
https://www.codeproject.com/Questions/5381471/Using-WH-MOUSE-LL-as-Csharp-recording-and-sendinpu
This is the new question that might be more appropriate.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900