How to intercept Windows Hybernate message using intrinsic VB only.
Anyone know how to do it?
No third-party controls are allowed in the app so that's not an option.
Would like to do it using APIs unless it's something actually built into VB that I've never seen.
I did an internet search and only found results for .net.
Re: How to intercept Windows Hybernate message using intrinsic VB only.
WM_POWERBROADCAST. You may need PowerRegisterSuspendResumeNotification for certain modern standby modes. You can't distinguish target power states (sleep vs hibernate) from user mode; you'd need a driver.
Re: How to intercept Windows Hybernate message using intrinsic VB only.
my game is using a "on error" for this kind of things.
it happens when windows get into hybernation/login-page etc. direct2d assets get lost.
when I get that error, it will "exit" the game loop and enter another loop that will check GetForegroundWindow and my form.hwnd.
and when that happens, I "restart" the initialization and re-enter the game loop.
to try to fetch window messages are hell and will not work in all cases. I have tried it many times for different things but theres always that "situation" it will not work.
better with this method. and that "on error" also helps with any other kind of error as well so why not.
for u, Im not sure, as I assume u are not using direct2d.
but the idea can be the same, if theres things that will break during hybernation that could be the "trigger".
if nothing breaks, but u just want to monitor this, Im not sure.
maybe a "timer" that call a "sensible" API or function that breaks during hybernation. that can also be a "trigger".
Re: How to intercept Windows Hybernate message using intrinsic VB only.
Here is a program I use to keep my screen saver from coming on. I believe it uses the Windows API that keeps the computer active during installs. Credit goes to "Mike Metzger - Certifications: CISSP, Security+" and that is in the program. I hope I'm not breaking rules loading it.