Hi, can anyone tell me what I need to learn or what I need to search
in order to right a program that can interact with other programs? For
example, if one program has a text field and a submit button, the
program I write should be able to fill in that text field and press
the submit button. How would I do this?
i dont think it will be able to send any messages to external applications. it dont have any parameters of HWND, where will it send the output to.. which window??
he may use sendmessage or postmessage but that will also fail.. as external windows (text, buttons etc) might be handles which will be a little difficult to find..
windows hooks or dll injection may help in this case.. if you see spy++ which can tell all the controls any external windows has.. how does it work.. it works on the dll injection technique.
i dont think it will be able to send any messages to external applications
I was thinking you could use SetForegroundWindow() to give focus to the window you want before calling all of your SendInput() stuff. Not sure if this combination will give the desired results as I have never tried it, but I think its worth a shot.
you are correct.. the window may come on top.. but what next???
lets say the window has one text box and one button.. how will he send the message? he dont know the handles of these controls.. a difficult task may be... do you agree??
assuming that you have the window handle to be able to call SetForegroundWindow()... ( Use EnumWindows if you don't to find it, or FindWindowEx if you know the class and title), you can use EnumChildWindows (http://msdn.microsoft.com/en-us/library/ms633494(VS.85).aspx) to get each of the child windows, then you can use 'GetClassName' and/or 'GetClassInfo' to determine if it is a control you are looking for. Subsequently, use 'PostMessage' to send a series of messages to the desired windows to simulate the input. No worries about focus or anything, and you get directly to the controls you want. Granted, unless you know enough about the application you're communicating with, you won't know which controls to send messages to, but if there are only two, or you know which ones you want, this should work. I don't know if there's an easier way, but unless you have some pretty specific info on the app you're communicating with, it may be the best way.
actually what he is trying to do is typical of a QA guy..
these people send messages to external windows day and night..
they use QTP or silktest for that.. i hope he's not one..