Access another program's controls?
-
Hello, I am wondering that if you could have 2 executables or programs, one accessing another one's controls, like my Vb.NET program pressing a button on notepad.exe, or menus.
Simple Thanks and Regards, Brandon T. H. Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#. Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
-
Hello, I am wondering that if you could have 2 executables or programs, one accessing another one's controls, like my Vb.NET program pressing a button on notepad.exe, or menus.
Simple Thanks and Regards, Brandon T. H. Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#. Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
Brandon T. H. wrote:
I am wondering that if you could have 2 executables or programs, one accessing another one's controls, like my Vb.NET program pressing a button on notepad.exe, or menus.
Yup, that's possible, the collection of those techniques would be called "interprocess communication". You can take a pick between TCP/IP, (Named) Pipes, SendKeys, Memory mapped files and many more. A good CodeProject-article would be ".NET Remoting in Simple English (Really, it's that simple)[^]". --edit not cool to see the same question twice.
Bastard Programmer from Hell :suss:
-
Brandon T. H. wrote:
I am wondering that if you could have 2 executables or programs, one accessing another one's controls, like my Vb.NET program pressing a button on notepad.exe, or menus.
Yup, that's possible, the collection of those techniques would be called "interprocess communication". You can take a pick between TCP/IP, (Named) Pipes, SendKeys, Memory mapped files and many more. A good CodeProject-article would be ".NET Remoting in Simple English (Really, it's that simple)[^]". --edit not cool to see the same question twice.
Bastard Programmer from Hell :suss:
Those concepts will only work if he has access to both programs' code. If you are trying to control a program you did not create or cannot modify, you will need to use API calls such as "FindWindow"/"FindWindowEx" to locate the window and child control (also considered a "window"). You can use programs like spy++ or winspector spy to figure out the class/caption of the windows and controls. Once you have the handle (intptr) to the control, you can use other API calls to send key presses and/or mouse clicks. You'll have to google those, tho. Hope that helps! Ray