Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sleep mode hanging program

Status
Not open for further replies.

CaKiwi

Programmer
Apr 8, 2001
1,294
0
0
US
I have a vb program on a win98 machine which communicates with a control through the serial port. If there is no mouse or keyboard activity, the machine goes into sleep mode and the program hangs. I have turned off sleep mode but I am wondering if there is a way within my program to prevent sleep mode from being activated.

I posted this in the other vb forum ( thread222-377469 )and got some general responses, but I am wondering if anyone here can suggest something specific.

TIA CaKiwi
 
Hi CaKiwi.

There is three possibilities for your system hanging:
1: A Known Bug in win16 code ported from Windows 3.1,
(code never returns in Windows 95 because the EV_RING event is not detected by the system) has been reported in early win98 versions.

2: The WaitForSingleObject waits infinately long.
(So DoEvents)
3: flow control has blocked the transmission.
(So Error Checks)

You can be a real un-tidy coder and post mouse_events to windows, but this will not free up the EV_RING event, or flow controll blocked transmission, which will result in needing a reset.

I would suggest that you Log onto microsoft.com and look up the EV_RING in the support and patch win98, then include error handling in your coms code along with DoEvents and background processing.
 
Hi kesm,

I am using Windows 98 SE, so can I assume the bug you mentioned has been fixed?

At the time the system goes into sleep mode, the vb program is in a loop waiting for data to arrive at the serial port and doing a doevents call each time round the loop. The device I am communicating with has sent a DC1 character and I am waiting for a DC3 before resuming transmission. I am not checking for data communication errors at that point, although I probably should be, but I don't think errors are causing this problem.



CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top