FTP | CCD | Buscar | Trucos | Trabajo | Foros |
#17
|
|||
|
|||
encontre una forma de apagar windows con el sig 'code':
en Implementation Código:
function ShutDownWindows(Flag: word): Boolean; //Función que permite apagar la computadora var TokenPriv: TTokenPrivileges; H: DWord; HToken: THandle; begin if Win32Platform = VER_PLATFORM_WIN32_NT then begin OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES,HToken); LookUpPrivilegeValue(NIL, 'SeShutdownPrivilege', TokenPriv.Privileges[0].Luid); TokenPriv.PrivilegeCount := 1; TokenPriv.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; H := 0; AdjustTokenPrivileges(HToken, FALSE, TokenPriv, 0, PTokenPrivileges(NIL)^, H); CloseHandle(HToken); end; Result := ExitWindowsEx(Flag, 0); end; Código:
ShutDownWindows(EWX_POWEROFF); ahora, el problema es el siguiente... mientras estoi programando si funciona este code, le doy a la flechita verda (para visualizar el programa) y si, efectivamente se apaga, pero al momento de compilarlo y ejecutar el exe no me funciona... ke puedo hacer? thanx, salu2... PD---> como se llama la flecita verde' ??
__________________
HazTa La VikToRia... SIEMPRE! |
|
|
|