Whew! After about 6 hours of constant debugging and testing in VMWare I finally managed to find the cause for a problem that prevented Windows from shutting down if my Application was running. The solution is very simple, in my case at least. Basically I had one component that used AllocateHWND to create a handle. In my WindowProc I didn’t have a call to the DefWindowProc, so the WM_QUERYENDSESSION didn’t get handled properly.
So as a tip to everyone who has this issue, scan you sources for AllocateHWND and check that the DefWindowProc is called.
procedure TMyComponent.MsgProc(var Message: TMessage);
begin
// Do you stuff
case msg.Msg of
WM_USER + 1: ShowMessage('Do some stuff');
end;
// Handle default messages
Message.Result:= DefWindowProc(fMyHandle,
Message.Msg,
Message.WParam,
Message.LParam);
end;








in effect it is a problem that i’ve experienced many times but i was thinking it was only my problem (’cause on the forum it’s long time we don’t talk about this lack…)
cool!