Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to exit WaitForSingleObject?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00844020
Message ID:
00844104
Views:
25
That would work except that I don't have a clean way of letting the user notify me of their intention to quit. I don't want the user to have to open Explorer and copy a file into a directory.

That was kind of the idea behind the system tray icon ... let the user have something visual to click on to let me know they want to quit. However, because the program is basically sleeping or suspended while the API calls are being run, the doubleclick code of the system tray icon never gets executed.

Looking at Microsoft's site, it looks like there is a WaitForMultipleObjects function but it honestly is over my head as to what all needs to take place to get that to work. But that looks like it's possible to monitor two things at once ... the directory and the system tray icon or something.


>Rodd,
>
>How about adding a key file to the directory of interest? Such as:
>pause.txt
>stop.txt
>Detect their existance and act accordingly?
>
>>I've created a little program that uses FindFirstChangeNotification, FindNext ..., and WaitForSingleObject to monitor a directory. When a file is added to the directory, the program comes to life and converts the file, zips it and moves it to another directory before resuming its monitoring of the directory.
>>
>>I had in mind that this would launch at startup on the users machine and just run all day but I'm seeing the need for the user to be able to pause or stop the program.
>>
>>Because the program has no UI, I wanted to just add a icon to the system tray and allow the user to double click the icon to pause or stop the program. The problem I'm having is that once program goes into it's wait mode, my icon becomes useless. Double clicking does nothing at that point because my program is off waiting. I could cut down the amount of time that the WaitForSingleObject function waits but won't that eat up a lot more processing time? I don't want this thing to be a resource hog.
>>
>>Any ideas on how I can accomplish this? Thanks in advance for any ideas!
>>
>>Rodd
Previous
Reply
Map
View

Click here to load this message in the networking platform