Domanda

I have got a problem when I try to control another Windows application using my own C# application.

The requirement is like this. The "another application" is a business software which our company have bought. We want to develop an application to fill text boxes and simulate mouse clicking. All text input is from a certain XML file.

I have tried to approach such function with SendMessage and SendWait function call. Problem is in some cases or at some end user's laptop, the text filling is not correct. Meanwhile, the mouse clicking will be fail in some other cases.

My imagination of the reason cause is synchronisation problems with call SendMessage. But I have no idea how to fix it. Is there any suggestion or solutions?

Looking forward your reply.

È stato utile?

Soluzione

SendMessage and SendWait will always have those sorts of issues (especially app-to-app), e.g. the user clicks someone on the screen at exactly the right/wrong time. Really the only way I know to reliably do this is by hooking onto the mouse/keyboard and take total control... its hard and painful.

Note: there are plenty of professional macro'ing software packages on the market (faking keyboard input, mouse movement, clicks etc). Some are very sophisticated with their own programming language and will possibly do what you want. Google "windows macroing software" and you will find heaps - I recommend you do you research, trial several packages til you find one you want and then purchase it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top