HELP: Sleep API call and W95 system shutdown 
Author Message
 HELP: Sleep API call and W95 system shutdown

Hello!

I've written a little utility in VB v4.0 for Windows95 that basically
consists of an invisible form with a "timer" object with an interval of "1"
that has the following code:

Private Sub Timer1_Timer()

    *** code deleted that grabs some system values and logs to a file ****

    Call Sleep(600000) 'sleep for 10 minutes

End Sub

It's obviously an infinite loop, but that's what I want.  The program is
intended to be started when the system starts, and should run (in the
background) until the system is shut down.  The problem I have is that when
you do an orderly system shutdown of Windows95, the message "This program
is not responding..." is displayed and some user action is required to stop
the task.

I'd like to figure out a way to have my monitoring program shutdown along
with the operating system in a nice way, without requiring
user-interaction.

Any ideas?  I'm stuck!
--
Marty Chamberlain

Homepage: http://www.*-*-*.com/
--------------------
Join PinHeads Online! http://www.*-*-*.com/ ~martyc



Sun, 21 Nov 1999 03:00:00 GMT  
 HELP: Sleep API call and W95 system shutdown

"Marty Chamberlain"

15:54:33 GMT):

Quote:
>I'd like to figure out a way to have my monitoring program shutdown along
>with the operating system in a nice way, without requiring
>user-interaction.

Read our FAQ (link below).

The question is answered both in the SDK and in the FAQ.

Mathias Schiffer, Germany
-----------------------------------------------
VB-FAQ: http://home.sol.no/jansh/vb/default.htm
NG-tips: http://www.rat.de/metty/vbnews



Sun, 21 Nov 1999 03:00:00 GMT  
 HELP: Sleep API call and W95 system shutdown

I would suggest that you not use the Sleep API call in this case.  Instead,
use a static variable inside your timer proc.  Set the timer interval to
1000 (1 second) and increment the static counter each time.  When you reach
600000 reset the timer and take the actions that you want to take every 10
minutes.

This should cause the system to be able to shutdown.
--
Keith Benedict
Software Engineer
Triad Systems

*** My reply email address is mangled to cut down on the

US Code Title 47, Sec.227(a)(2)(B), a computer / modem / printer
meets the definition of a telephone fax machine.  Sec. 227
(b)(1)(C), it is unlawful to send any unsolicited adverti{*filter*}t
to such equipment.  Sec.227(b)(3)(C), a violation of the
aforementioned Section is punishable by action to recover actual
monetary loss, or $500, whichever is greater, for each violation.



Quote:
> Hello!

> I've written a little utility in VB v4.0 for Windows95 that basically
> consists of an invisible form with a "timer" object with an interval of
"1"
> that has the following code:

> Private Sub Timer1_Timer()

>     *** code deleted that grabs some system values and logs to a file
****

>     Call Sleep(600000) 'sleep for 10 minutes

> End Sub

> It's obviously an infinite loop, but that's what I want.  The program is
> intended to be started when the system starts, and should run (in the
> background) until the system is shut down.  The problem I have is that
when
> you do an orderly system shutdown of Windows95, the message "This program
> is not responding..." is displayed and some user action is required to
stop
> the task.

> I'd like to figure out a way to have my monitoring program shutdown along
> with the operating system in a nice way, without requiring
> user-interaction.

> Any ideas?  I'm stuck!
> --
> Marty Chamberlain

> Homepage: http://www.*-*-*.com/
> --------------------
> Join PinHeads Online! http://www.*-*-*.com/ ~martyc



Sun, 21 Nov 1999 03:00:00 GMT  
 HELP: Sleep API call and W95 system shutdown

DoEvents?

--


() http://www.btinternet.com/~andrew.morgan/
() The ZILTRO Zone, ActiveX search page and lots more!



Quote:
> Hello!

> I've written a little utility in VB v4.0 for Windows95 that basically
> consists of an invisible form with a "timer" object with an interval of
"1"
> that has the following code:

> Private Sub Timer1_Timer()

>     *** code deleted that grabs some system values and logs to a file
****

>     Call Sleep(600000) 'sleep for 10 minutes

> End Sub



Tue, 23 Nov 1999 03:00:00 GMT  
 HELP: Sleep API call and W95 system shutdown

On 4 Jun 1997 15:54:33 GMT, "Marty Chamberlain"

Monitor the unloadquery event this will allow you to check if the
system is being shut down by the system or the user is trying to shut
it down.  You should have a doevents in your loop as well so that the
events get handled.

Cheers
Duncan

Quote:
>Hello!

>I've written a little utility in VB v4.0 for Windows95 that basically
>consists of an invisible form with a "timer" object with an interval of "1"
>that has the following code:

>Private Sub Timer1_Timer()

>    *** code deleted that grabs some system values and logs to a file ****

>    Call Sleep(600000) 'sleep for 10 minutes

>End Sub

>It's obviously an infinite loop, but that's what I want.  The program is
>intended to be started when the system starts, and should run (in the
>background) until the system is shut down.  The problem I have is that when
>you do an orderly system shutdown of Windows95, the message "This program
>is not responding..." is displayed and some user action is required to stop
>the task.

>I'd like to figure out a way to have my monitoring program shutdown along
>with the operating system in a nice way, without requiring
>user-interaction.

>Any ideas?  I'm stuck!
>--
>Marty Chamberlain

>Homepage: http://204.186.118.254/martyc
>--------------------
>Join PinHeads Online! http://home.ptd.net/~martyc



Mon, 06 Dec 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Sleep - How do I respond to system shutdown request

2. Windows Sleep API call Help.

3. Problems after calling WaitForSingleObject and Sleep API functions

4. Sleep() API call problem

5. WIN32 API : SYSTEM SHUTDOWN

6. Help with System API call

7. Forms look fine on W95 system but are in disarray on NT 3.51 system

8. Unconditional shutdown API call

9. API Shutdown/Reboot Call

10. HELP I NEED SLEEP OR EQUIVALENT CALL!!!

11. help for the W95 API

12. WinAPI Shutdown, a desperate call for help

 

 
Powered by phpBB® Forum Software