Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 20-10-2003
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Poder: 10
marcoszorrilla Va por buen camino
Mira a ver si te funciona, la verdad no he tenido ocasión de probarlo.

Código:
var
  hToken: THANDLE;
  tkp, tkDumb: TTokenPrivileges;
  DumbInt: DWord;
begin
  FillChar(tkp, sizeof(tkp), 0);
     // Obtengo el token de este proceso
  if not (OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or
TOKEN_QUERY, hToken)) then
     raise Exception.create('OpenProcessToken falló con el código ' +
inttostr(GetLastError));
     // Obtengo el LUID para provilegios de Shutdown
  LookupPrivilegeValue(nil, pchar('SeShutdownPrivilege'),
tkp.Privileges[0].Luid);
  tkp.PrivilegeCount := 1;
  tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
     // Obtengo el privilegio de shutdown para este proceso
  AdjustTokenPrivileges(hToken, false, tkp, sizeof(tkDumb), tkDumb,
DumbInt);
     // No puedo testear el valor de retorno de AdjustTokenPrivileges
  if GetLastError <> ERROR_SUCCESS then
     raise Exception.create('AdjustTokenPrivileges falló con el código ' +
inttostr(GetLastError));
     // apago el sistema, todas las aplicaciones se cerrarán
  if not ExitWindowsEx(EWX_POWEROFF, 0) then
     raise Exception.create('ExitWindowsEx falló con el código ' +
inttostr(GetLastError));
end;
Un Saludo
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 16:55:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi