Results 1 to 4 of 4

Thread: How to intercept Windows Hybernate message using intrinsic VB only.

  1. #1

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819

    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.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    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.

  3. #3
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,014

    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".

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    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.
    Last edited by Shaggy Hiker; Dec 12th, 2024 at 10:07 AM.
    Please remember next time...elections matter!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width