No, it is required. The DEFDLG_SetDefButton() is also called from message DM_SETDEFID. In this case idResult should set to the default button ID passed. And the current logic of DEFDLG_SetDefButton() does what is required for DM_SETDEFID.
But when called from the WM_NEXTDLGCTL, it should not change idResult. It should only change the look of the button by drawing the default button rectangle if it is a push button.
Otherwise we need to enhance the DEFDLG_SetDefButton() to accept one more parameter which indicates who invoked the method. Krishna
-----Original Message----- From: Alexandre Julliard [mailto:julliard@winehq.org] Sent: Thursday, June 17, 2004 8:36 PM To: Krishna Murthy Cc: wine-devel@winehq.org Subject: Re: FW: WM_NEXTDLGCTL changes the default button ID and does not rest ore default control identifier
Krishna Murthy Krishna.Murthy@guptaworldwide.com writes:
/**
* if the next control is push button, then draw default
push button
* rectangle.
*
* if the next control is not a push button, then draw
the push button
* rectangle for the default control.
*
* Call SetDefButton to draw the default rectangle, but
do not change the
* default push button ID (idResult) - As Per MSDN
*/
if ( !(SendMessageW(hwndDest, WM_GETDLGCODE, 0, 0 ) &
(DLGC_UNDEFPUSHBUTTON | DLGC_BUTTON)) )
hwndDest = GetDlgItem(hwnd, idSaveResult);
DEFDLG_SetDefButton( hwnd, dlgInfo,
GetDlgCtrlID(hwndDest) );
dlgInfo->idResult = idSaveResult;
It seems you are doing redundant work here, since DEFDLG_SetDefButton will also send the same WM_GETDLGCODE. Wouldn't a simpler fix be to have DEFDLG_SetDefButton not set idResult unless it really changed the default button?
-- Alexandre Julliard julliard@winehq.org