Hello.

I'm a bit confused, and I don't know QUITE how to explain it, however I'll try my best!

Anyway, say I wanted to code a API, that would grab a list from ANOTHER program.
For example, if I had a small chatting program, and there was a list of people, say John and Bob, how would I be able to treat the list, as if it was in the main program I'm coding? Also, how can I send messages to the window to tell it to say, press on button number 5, 2, etc..

If anyone needs more explaining, <b>PLEASE</b> post.

Thanks!

Oh, and also, how can I make it so that if someone presses exit that it spawns a message?
I.E. How can I make a annoying exit yes/no box appear?

Okay, you will need to delve into the world of the API to accomplish what you want to do. You can start with FindWindow or FindWindowEx to get the hwnd of another application. Then to read text from a window you will need to use SendMessage with the const WM_GETTEXT but you will need a handle to that specific window (each control on a form is a window) so you will need to use EnumChildWindows to enumerate through the controls on the other applications form. As for clicking on the other applications buttons you will once again need the handles to those windows via EnumChildWindows and then use SendMessage once again with a WM_MBUTTONDOWN followed by a WM_MBUTTONUP message.

As for the anoying message, use the query_unload event of your form to test for how the program is being shut down because when the OS is shutting down you may not want to nag the user.


Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.