Sign in to follow this  
Followers 0
pixi

Hoe to detect the On/Off button on a laptop computer?

6 posts in this topic

is it possible to set the on/off button on a laptop a hotkey???

i try to search but i dont found anything about it??

/Andreas

Share this post


Link to post
Share on other sites



Hi Andreas,

Interesting question. Unfortunately I don't have a good answer, but maybe some ideas you could work on?

As the Power button ain't a regular keyboard key I doubt you will find a regular HotKey solution. If I was to explore this I would try to figure out if I could detect any windows message corresponding to shutdown or suspend from the OS. I would also explore if any of the PowerManagement API's could be hooked or used. maybe you could get some ideas in this topic?

Best wishes for your quest..:)

Share this post


Link to post
Share on other sites

or you could just use Shutdown() and set it as a hotkey like this:

Hotkeyset("{END}", "_Shutdown")

Func _Shutdown()

Shutdown(8)

ENdfunc

i think its 8...not sure check the helpfile :)

Share this post


Link to post
Share on other sites

when y say that u give me a idea :-)

in the power manager i can chose what i want to to if i press the button hibernate,standby,"ask me what to to"

if i chose "ask me what to do" a windows will appear, and my be detect that window.

i write a scrips and se if it works, i come back if it works

Thanks

/Andreas

Share this post


Link to post
Share on other sites

no it works what i want it to work,i detect the window and can do what i want :-)

thanks for your fast replay

/Andreas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0