Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How does someone go about writing a "macro" in C#?

Bill_ThompsonBill_Thompson Posts: 2Member
I know something about MACROS. I don't mean the ASSEMBLY language kind. I am talking about those programs that you can use perform repetitions actions on another program. I am talking about those programs that you can use to record a series of events on your computer, like, mouse movements and button clicks and then you can play them back. Some of them are elaborate enough to run only on a paricular app that you designate.

I wrote one of sorts once. It was a program that launched an Excel sessions and then used the dynamic data exchage pipe of some kind to feed the excell session script commands. It worked.

But something on the level of the operating system, I imagine, is a whole different story.

How does someone go about writing a "macro" in C#?

I think the approach I will take is to use the spy routine that comes with the development environment to get a list of the proper messages and parameters (wm_lbuttondown for example) and then use dynamic data exchange to send those messages to the app.

So I have three questions.

#1. Is this the best way to do this?
#2. How do I get a handle to an app that is already running?
#3. How do I send user-like messages to an app that is already running?

This is mostly a C# issue. There are system commands you can use to grab ahold of a handle of an already running application and there are ways of using this handle to send commands to to simulate a user interface. I need to know what these are.


  • itdelphiaitdelphia Posts: 28Member
    oh man, if you can write "a sort macro" in C#, then please share your application, 'cause for what i know, C# dont support macro.

    Personaly, when i need to create a macro in my application i use VB NET or MS assembly IL to create it in my solution. That make debugging less complex. Well, but i have enough problems with macro.
Sign In or Register to comment.