Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 11-12-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
No entiendo bien en qué forma planeas usar el Msg.Source pero haciendo algunas pruebas me parece que Delphi tiene un pequeño bug. La declaración de TWMQueryEndSession es:

Código Delphi [-]
TWMQueryEndSession = packed record
  Msg: Cardinal;
  Source: Longint;
  Unused: Longint;
  Result: Longint;
end;

pero la documentación en el SDK de Windows dice:

Cita:
wParam
This parameter is reserved for future use.

lParam
If this parameter includes ENDSESSION_LOGOFF, the user is logging off. (Note that this parameter is a bit mask. To test for this value, use a bit-wise operation; do not test for equality.)
If this parameter is zero, the system is shutting down or restarting (it is not possible to determine which event is occurring).
es decir, según yo entiendo, la declaración en Delphi está alrevés y debería ser:

Código Delphi [-]
TWMQueryEndSession = packed record
  Msg: Cardinal;
  Unused: Longint;
  Source: Longint;
  Result: Longint;
end;

Aunque no lo puedo asegurar, parece ser corroborado por esta prueba:

Código Delphi [-]
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
  inherited;

  if Msg.Source and ENDSESSION_LOGOFF <> 0 then
    ShowMessage('You are logging off...')
  else
    ShowMessage('You are shutting down or restarting...');

  Msg.Result := 0;
end;

siempre muestra el segundo mensaje. Pero si pongo

Código Delphi [-]
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
  inherited;

  if Msg.Unused and ENDSESSION_LOGOFF <> 0 then
    ShowMessage('You are logging off...')
  else
    ShowMessage('You are shutting down or restarting...');

  Msg.Result := 0;
end;

sí me pone el primer mensaje cuando intento cerrar la sesión.

Esto, con Delphi 7.

// Saludos
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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 05:25:29.


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