Francois Gouget : user32: Handle WM_ENDSESSION in DefWinProc().

Francois Gouget fgouget at codeweavers.com
Sat Mar 11 17:06:51 CST 2006


Hi,

Rein Klazes wrote:
[...]
> This patch is causing a problem in Pegasus Mail. Closing some dialogs
> cause termination of the complete program.
> Here is a part of SPY++ log when run under win2000, when I close the
> edit new mail dialog:
> 
> |<00202> 00130A82 S ..........................WM_SYSCOMMAND uCmdType:SC_CLOSE xPos:672 yPos:121 [wParam:0000F060 lParam:007902A0]
> |<00203> 00130A82 S ...........................WM_CLOSE wParam:00000000 lParam:00000000
> |<00204> 00130A82 S ............................WM_QUERYENDSESSION nSource:1 (End Task from Task List dialog) [wParam:00000001 lParam:00000000]
> |<00951> 00130A82 R ............................WM_QUERYENDSESSION fShutdownIsOk:True [lResult:00000001]
> ...
> |<00952> 00130A82 S ............................WM_ENDSESSION fEndSession:True [wParam:00000001 lParam:00000000]
> |<00953> 00130A82 R ............................WM_ENDSESSION lResult:00000000
> 
> The WM_QUERYENDSESSION and WM_ENDSESSION are sent by the program:
> 
> |0009:Call user32.SendMessageA(00030024,00000011,00000001,00000000) ret=0040641d

It's pretty weird that the application is sending a 
WM_QUERYENDSESSION/WM_ENDSESSION to itself.


> How did you check the behavior of the Windows DefWindowProc? If I put a
> DefWindowProc(hwnd, WM_ENDSESSION, 1, 0); some where in a windows
> program nothing happens, while a PostQuitMesage certainly closes the
> app.

I used a modified poppad sample app from Petzold and used Spy++ to check 
that a WM_ENDSESSION caused the app to exit eventhough that 
application's main loop did not contain any special handling for 
WM_ENDSESSION.

So, since the decision to exit on WM_ENDSESSION is not made in the 
application's main loop I placed it in the DefWindowProc. But I must 
have gotten some detail wrong. Unfortunately I'm away from my computer 
for the next week, so I can't investigate right now.


-- 
Francois Gouget
fgouget at codeweavers.com




More information about the wine-devel mailing list