Hi there!
I have made a program in VB6 that helps to automate an external program. I am using FindWindow, FindWindowEx, SendMessage, IsWindow, PostMessage etc. to access the external program's windows and controls with success but I don't know if there is a better way of going about the way I have coded it.
During the process of the external application, there are many pop-up windows (msgboxes), and I need to access these windows, however they all vary in which order they may pop up.
At the moment I am using "Do.. Loop Until" one after the other to search for a set of these windows that (most of the time) will pop-up in the same sequence order, however every now and then there are a few other windows that may pop-up in between these normally in sequence windows.. And then my program gets stuck in a loop until the exact window it's looking for pops up again which might be a while.
My main question is: Is this the best way of going about what I am trying to do? I originally had many timers waiting for a specific window to pop up and then run code for that said window.
Would it be better to just constantly search for the ForegroundWindow and then match it up in a select case statement to run the code I need according to that window? Or am I going about this completely the wrong way and there is some other obvious way of doing this?
P.s. I am sorry I have not posted any code as I am currently at work, but as soon as I get home (approx. 5 hours from now) I will post the snippet of my code so you can see what I am talking about.
Thanks for reading this!
Thomas
I have made a program in VB6 that helps to automate an external program. I am using FindWindow, FindWindowEx, SendMessage, IsWindow, PostMessage etc. to access the external program's windows and controls with success but I don't know if there is a better way of going about the way I have coded it.
During the process of the external application, there are many pop-up windows (msgboxes), and I need to access these windows, however they all vary in which order they may pop up.
At the moment I am using "Do.. Loop Until" one after the other to search for a set of these windows that (most of the time) will pop-up in the same sequence order, however every now and then there are a few other windows that may pop-up in between these normally in sequence windows.. And then my program gets stuck in a loop until the exact window it's looking for pops up again which might be a while.
My main question is: Is this the best way of going about what I am trying to do? I originally had many timers waiting for a specific window to pop up and then run code for that said window.
Would it be better to just constantly search for the ForegroundWindow and then match it up in a select case statement to run the code I need according to that window? Or am I going about this completely the wrong way and there is some other obvious way of doing this?
P.s. I am sorry I have not posted any code as I am currently at work, but as soon as I get home (approx. 5 hours from now) I will post the snippet of my code so you can see what I am talking about.
Thanks for reading this!
Thomas