Suspending HH

G

Guest

Hallo,
I my solution i use communication component witch keeps comport opened all
the time. When COM1 is opened, system's suspender is not able to enter
suspend mode. So i would like to close comport when system attemps to enter
suspend mode let it suspend and when returning from suspend mode i would
reopen that port...
I know that system sends some notification when entering suspend mode, but
is there any way to notify when user power it on again?
Thanks for any idea!


ps: I am sorry that this question is not related to CF...
 
G

Guest

Thanks for your help,
RequestPowerNotifications work fine, but when handling on-suspend transition
only some of my actions are perfomed before entering suspend mode - rest of
them are performed after returning to on state.
I tried to find on msdn how to refuse current transition, do my work and
then suspend manually, but without any success.
Is there any way to get more time for my handler of on-suspend transition?


Sergey Bogdanov said:
You need to use RequestPowerNotifications function to receive these events:

[DllImport("coredll")]
static extern IntPtr RequestPowerNotifications(IntPtr hMsgQ,
PowerEventType Flags);

How to use this function check out Alex Feinman's example:
http://www.alexfeinman.com/download.asp?doc=PowerAwareApp.zip


Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

Michal said:
Hallo,
I my solution i use communication component witch keeps comport opened all
the time. When COM1 is opened, system's suspender is not able to enter
suspend mode. So i would like to close comport when system attemps to enter
suspend mode let it suspend and when returning from suspend mode i would
reopen that port...
I know that system sends some notification when entering suspend mode, but
is there any way to notify when user power it on again?
Thanks for any idea!


ps: I am sorry that this question is not related to CF...
 
S

Sergey Bogdanov

Refer to this document:
http://msdn.microsoft.com/library/d...us/dncenet/html/power_management_features.asp

It seems that when you press On/Off button this operation can't be canceled.


Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

Michal said:
Thanks for your help,
RequestPowerNotifications work fine, but when handling on-suspend transition
only some of my actions are perfomed before entering suspend mode - rest of
them are performed after returning to on state.
I tried to find on msdn how to refuse current transition, do my work and
then suspend manually, but without any success.
Is there any way to get more time for my handler of on-suspend transition?


:

You need to use RequestPowerNotifications function to receive these events:

[DllImport("coredll")]
static extern IntPtr RequestPowerNotifications(IntPtr hMsgQ,
PowerEventType Flags);

How to use this function check out Alex Feinman's example:
http://www.alexfeinman.com/download.asp?doc=PowerAwareApp.zip


Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

Michal said:
Hallo,
I my solution i use communication component witch keeps comport opened all
the time. When COM1 is opened, system's suspender is not able to enter
suspend mode. So i would like to close comport when system attemps to enter
suspend mode let it suspend and when returning from suspend mode i would
reopen that port...
I know that system sends some notification when entering suspend mode, but
is there any way to notify when user power it on again?
Thanks for any idea!


ps: I am sorry that this question is not related to CF...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top