Set default button patch.

Rein Klazes rklazes at xs4all.nl
Tue Jan 15 03:05:33 CST 2002


Hi,

Some application uses owner drawn buttons and uses DM_SETDEFID and
DM_GETDEFID messages to set/get the default button. Wine's code only
worked for normal pushbuttons. Verified behaviour under win2000.

	windows/	:	defdlg.c
	Make DM_SETDEFID message work for owner drawn buttons as well.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/windows/defdlg.c	Mon Oct 15 19:56:45 2001
+++ mywine/windows/defdlg.c	Tue Jan 15 09:25:34 2002
@@ -119,8 +119,10 @@
 static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo,
                                    HWND hwndNew )
 {
+    DWORD dlgcode;
     if (hwndNew &&
-        !(SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ) & DLGC_UNDEFPUSHBUTTON))
+        !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 )) 
+            & (DLGC_UNDEFPUSHBUTTON | DLGC_BUTTON)))
         return FALSE;  /* Destination is not a push button */
     
     if (dlgInfo->idResult)  /* There's already a default pushbutton */
@@ -131,7 +133,8 @@
     }
     if (hwndNew)
     {
-        SendMessageA( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
+        if(dlgcode==DLGC_UNDEFPUSHBUTTON)
+            SendMessageA( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
         dlgInfo->idResult = GetDlgCtrlID( hwndNew );
     }
     else dlgInfo->idResult = 0;


More information about the wine-patches mailing list