Jump to content

Power Button VB.Net


a3deluxe

Recommended Posts

Boa tarde,

Queria substituir a tecla Z pela tecla do Power do PC, já a desativei no painel de control, se precionada  não faz nada, queria utiliza-la pelo programa VB.

Alguém  para dar uma ajudinha?

Ja fiz muita pesquisa e nada é complicado por ser uma tecla especial.

Obrigado

	Private Function LowLevelKeyboardProc(ByVal nCode As Integer, ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) As Integer
	If nCode = HC_ACTION Then
	If wParam = WM_KEYDOWN Then
	Dim key As Integer = lParam.vkCode
	If key = Keys.Z Then
	Process.Start("shutdown", "-s -t 0")
	End If
	
Link to comment
Share on other sites

  • 2 weeks later...

Tenho o botão do power do pc desativado no painel de controlo,

no meu programa se carregar na tecla Z por exemplo, faz o shutdown.

queria substituir pela tecla do power, mas como a tecla power não faz parte do teclado e é uma tecla especial é complicado.

O que eu queria resolver com esta ideia,era  quando carregasse no botão de power para desligar, o programa Virtualbox que tenho aberto fecha-se corretamente antes de encerrar o windows 10.

 

Obrigado

Link to comment
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
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.