Ich hoffe, ich kann euch mit diesen einfachen Codes etwas helfen...
Einfach so modifiziern wie ihr es braucht.
1. Windows herunterfahren/Neustart
Private Declare Function ExitWindowsEx Lib
"user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Public Enum WinBeendenArt
Abmelden = 0
Herunterfahren = 1
q Neustart = 2
End Enum
Public Function WindowsBeenden(ByVal Art As WinBeendenArt) As Boolean
Dim lSuccess As Long
lSuccess = ExitWindowsEx(Art, 0)
If lSuccess <> 0 Then
WindowsBeenden = True
Else
WindowsBeenden = False
End If
End Function
Private Declare Function FindWindow Lib
"user32" Alias "FindWindowA" (ByVal lpClassName As String,
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As
Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx
As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const SWP_SHOWWINDOW = &H40
Const SWP_HIDEWINDOW = &H80
Public Enum Task
zeigen = 0
verstecken = -1
End Enum
Public Sub Taskbar(tOption As Task)
Dim i As Long
Select Case tOption
Case "-1"
i = FindWindow("Shell_TrayWnd", "")
SetWindowPos i, 0, 0, 0, 0, 0, SWP_HIDEWINDOW
Case "0"
i = FindWindow("Shell_TrayWnd", "")
SetWindowPos i, 0, 0, 0, 0, 0, SWP_SHOWWINDOW
End Select
End Sub
Option Explicit Private Declare Function
SystemParametersInfo Lib "User32" Alias "SystemParametersInfoA"
(ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal
fuWinIni As Long) As Long
Public Enum Taste
aus = 0
ein = -1
End Enum
Public Sub StrgAltEntf(tOption As Taste)
Select Case tOption
Case "-1"
SystemParametersInfo 97, False, "1", 0
Case "0"
SystemParametersInfo 97, True, "1", 0
End Select
End Sub