WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Handling Asynchronous Notifications


Question:

My winbatch exe is launched by another windows application (let us call it MyApp). MyApp wants to periodically check if the exe is running or has crashed.

MyApp can post this health check query and will wait for a response for specific time. This problem is that my winbatch script is doing something in a loop which has a delay between the loops. This delay is not fixed and depends on number of variables.

How can I make winbatch respond within wait time of MyAPP? I was thinking if it is possible for MyApp to use "SendMessage" to the script ? Another way could be to look for a window with the title "Error" but I am not sure if this will work everytime.

Please advise.

Answer:

Directing SendMessage at a WinBatch script is probably not the best way to go. WinBatch is designed to use SendMessage to control other applications but doesn't have a lot of scriptable facilities for responding to SendMessage from other applications.

What you are taking about is interprocess communication and there are several ways this can be done. It large extent it depends on how much control you have over the 'other' application. For example, you can use a file, TCP port or named pipes to conduct interprocess communication or you could have WinBatch periodically send a messge to the other application using the WinBatch 'SendMessageA' or 'SendMessageW' functions. But which, if any, of these techniques you use is driven to a large extent by the nature of 'MyApp'. I believe that examples of most of these techniques can be found in the Tech Support Data Base so you might start by searching there.

And don't be afraid to experiment. One of the advantages of using WinBatch is that sophisticated techniques can often be tried without the investment of a lot of time.


Article ID:   W17423
File Created: 2008:04:10:15:09:44
Last Updated: 2008:04:10:15:09:44