Commit f5e5fcac authored by Alexandre Julliard's avatar Alexandre Julliard

Tried to make IsDialogMessageW more compatible. Changed

IsDialogMessage16/A to call IsDialogMessageW.
parent 803eb16d
...@@ -2202,6 +2202,18 @@ BOOL WINAPI GetMessageA( MSG *msg, HWND hwnd, UINT first, UINT last ) ...@@ -2202,6 +2202,18 @@ BOOL WINAPI GetMessageA( MSG *msg, HWND hwnd, UINT first, UINT last )
/*********************************************************************** /***********************************************************************
* IsDialogMessage (USER32.@)
* IsDialogMessageA (USER32.@)
*/
BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG pmsg )
{
MSG msg = *pmsg;
msg.wParam = map_wparam_AtoW( msg.message, msg.wParam );
return IsDialogMessageW( hwndDlg, &msg );
}
/***********************************************************************
* SetMessageQueue (USER32.@) * SetMessageQueue (USER32.@)
*/ */
BOOL WINAPI SetMessageQueue( INT size ) BOOL WINAPI SetMessageQueue( INT size )
......
...@@ -348,6 +348,31 @@ LONG WINAPI DispatchMessage32_16( const MSG32_16 *msg16, BOOL16 wHaveParamHigh ) ...@@ -348,6 +348,31 @@ LONG WINAPI DispatchMessage32_16( const MSG32_16 *msg16, BOOL16 wHaveParamHigh )
/*********************************************************************** /***********************************************************************
* IsDialogMessage (USER.90)
*/
BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, MSG16 *msg16 )
{
MSG msg;
switch(msg16->message)
{
case WM_KEYDOWN:
case WM_CHAR:
case WM_SYSCHAR:
msg.hwnd = WIN_Handle32(msg16->hwnd);
msg.lParam = msg16->lParam;
WINPROC_MapMsg16To32W( msg.hwnd, msg16->message, msg16->wParam,
&msg.message, &msg.wParam, &msg.lParam );
/* these messages don't need an unmap */
return IsDialogMessageW( WIN_Handle32(hwndDlg), &msg );
}
TranslateMessage16( msg16 );
DispatchMessage16( msg16 );
return TRUE;
}
/***********************************************************************
* MsgWaitForMultipleObjects (USER.640) * MsgWaitForMultipleObjects (USER.640)
*/ */
DWORD WINAPI MsgWaitForMultipleObjects16( DWORD count, CONST HANDLE *handles, DWORD WINAPI MsgWaitForMultipleObjects16( DWORD count, CONST HANDLE *handles,
......
...@@ -90,7 +90,7 @@ rsrc resources/version16.res ...@@ -90,7 +90,7 @@ rsrc resources/version16.res
87 pascal16 DialogBox(word str word segptr) DialogBox16 87 pascal16 DialogBox(word str word segptr) DialogBox16
88 pascal16 EndDialog(word s_word) EndDialog16 88 pascal16 EndDialog(word s_word) EndDialog16
89 pascal16 CreateDialog(word str word segptr) CreateDialog16 89 pascal16 CreateDialog(word str word segptr) CreateDialog16
90 pascal16 IsDialogMessage(word segptr) IsDialogMessage16 90 pascal16 IsDialogMessage(word ptr) IsDialogMessage16
91 pascal16 GetDlgItem(word word) GetDlgItem16 91 pascal16 GetDlgItem(word word) GetDlgItem16
92 pascal16 SetDlgItemText(word word segstr) SetDlgItemText16 92 pascal16 SetDlgItemText(word word segstr) SetDlgItemText16
93 pascal16 GetDlgItemText(word word segptr word) GetDlgItemText16 93 pascal16 GetDlgItemText(word word segptr word) GetDlgItemText16
......
...@@ -935,7 +935,7 @@ BOOL16 WINAPI WinHelp16(HWND16,LPCSTR,UINT16,DWORD); ...@@ -935,7 +935,7 @@ BOOL16 WINAPI WinHelp16(HWND16,LPCSTR,UINT16,DWORD);
UINT16 WINAPI WNetAddConnection16(LPCSTR,LPCSTR,LPCSTR); UINT16 WINAPI WNetAddConnection16(LPCSTR,LPCSTR,LPCSTR);
INT16 WINAPI wvsprintf16(LPSTR,LPCSTR,LPCVOID); INT16 WINAPI wvsprintf16(LPSTR,LPCSTR,LPCVOID);
BOOL16 WINAPI DrawState16A(HDC16,HBRUSH16,DRAWSTATEPROC16,LPARAM,WPARAM16,INT16,INT16,INT16,INT16,UINT16); BOOL16 WINAPI DrawState16A(HDC16,HBRUSH16,DRAWSTATEPROC16,LPARAM,WPARAM16,INT16,INT16,INT16,INT16,UINT16);
BOOL16 WINAPI IsDialogMessage16(HWND16,SEGPTR); BOOL16 WINAPI IsDialogMessage16(HWND16,MSG16*);
INT16 WINAPI GetCommError16(INT16,LPCOMSTAT16); INT16 WINAPI GetCommError16(INT16,LPCOMSTAT16);
INT16 WINAPI BuildCommDCB16(LPCSTR,LPDCB16); INT16 WINAPI BuildCommDCB16(LPCSTR,LPDCB16);
INT16 WINAPI GetCommState16(INT16,LPDCB16); INT16 WINAPI GetCommState16(INT16,LPDCB16);
......
...@@ -1040,8 +1040,6 @@ static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner ) ...@@ -1040,8 +1040,6 @@ static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
} }
else if (!GetMessageW( &msg, 0, 0, 0 )) break; else if (!GetMessageW( &msg, 0, 0, 0 )) break;
if (CallMsgFilterW( &msg, MSGF_DIALOGBOX )) continue;
if (!IsWindow( hwnd )) return -1; if (!IsWindow( hwnd )) return -1;
if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg)) if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
{ {
...@@ -1242,7 +1240,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT retval ) ...@@ -1242,7 +1240,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT retval )
/*********************************************************************** /***********************************************************************
* DIALOG_IsAccelerator * DIALOG_IsAccelerator
*/ */
static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey ) static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM wParam )
{ {
HWND hwndControl = hwnd; HWND hwndControl = hwnd;
HWND hwndNext; HWND hwndNext;
...@@ -1260,8 +1258,6 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey ) ...@@ -1260,8 +1258,6 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
{ {
/* find the accelerator key */ /* find the accelerator key */
LPWSTR p = buffer - 2; LPWSTR p = buffer - 2;
char a_char = vKey;
WCHAR w_char = 0;
do do
{ {
...@@ -1270,8 +1266,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey ) ...@@ -1270,8 +1266,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
while (p != NULL && p[1] == '&'); while (p != NULL && p[1] == '&');
/* and check if it's the one we're looking for */ /* and check if it's the one we're looking for */
MultiByteToWideChar(CP_ACP, 0, &a_char, 1, &w_char, 1); if (p != NULL && toupperW( p[1] ) == toupperW( wParam ) )
if (p != NULL && toupperW( p[1] ) == toupperW( w_char ) )
{ {
if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX ) if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX )
{ {
...@@ -1352,47 +1347,31 @@ static HWND DIALOG_FindMsgDestination( HWND hwndDlg ) ...@@ -1352,47 +1347,31 @@ static HWND DIALOG_FindMsgDestination( HWND hwndDlg )
} }
/*********************************************************************** /***********************************************************************
* DIALOG_IsDialogMessage * IsDialogMessageW (USER32.@)
*/ */
static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg, BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
UINT message, WPARAM wParam,
LPARAM lParam, BOOL *translate,
BOOL *dispatch, INT dlgCode )
{ {
*translate = *dispatch = FALSE; INT dlgCode = 0;
if (message == WM_PAINT) if (CallMsgFilterW( msg, MSGF_DIALOGBOX )) return TRUE;
{
/* Apparently, we have to handle this one as well */
*dispatch = TRUE;
return TRUE;
}
/* Only the key messages get special processing */ hwndDlg = WIN_GetFullHandle( hwndDlg );
if ((message != WM_KEYDOWN) && if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd )) return FALSE;
(message != WM_SYSKEYDOWN) &&
(message != WM_SYSCHAR) &&
(message != WM_CHAR))
return FALSE;
if (dlgCode & DLGC_WANTMESSAGE)
{
*translate = *dispatch = TRUE;
return TRUE;
}
hwndDlg = DIALOG_FindMsgDestination(hwndDlg); hwndDlg = DIALOG_FindMsgDestination(hwndDlg);
switch(message) switch(msg->message)
{ {
case WM_KEYDOWN: case WM_KEYDOWN:
switch(wParam) dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, msg->wParam, (LPARAM)msg );
if (dlgCode & DLGC_WANTMESSAGE) break;
switch(msg->wParam)
{ {
case VK_TAB: case VK_TAB:
if (!(dlgCode & DLGC_WANTTAB)) if (!(dlgCode & DLGC_WANTTAB))
{ {
SendMessageA( hwndDlg, WM_NEXTDLGCTL, SendMessageW( hwndDlg, WM_NEXTDLGCTL, (GetKeyState(VK_SHIFT) & 0x8000), 0 );
(GetKeyState(VK_SHIFT) & 0x8000), 0 );
return TRUE; return TRUE;
} }
break; break;
...@@ -1403,144 +1382,59 @@ static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg, ...@@ -1403,144 +1382,59 @@ static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg,
case VK_UP: case VK_UP:
if (!(dlgCode & DLGC_WANTARROWS)) if (!(dlgCode & DLGC_WANTARROWS))
{ {
BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP); BOOL fPrevious = (msg->wParam == VK_LEFT || msg->wParam == VK_UP);
HWND hwndNext = HWND hwndNext = GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious ); SendMessageW( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
return TRUE; return TRUE;
} }
break; break;
case VK_CANCEL:
case VK_ESCAPE: case VK_ESCAPE:
SendMessageA( hwndDlg, WM_COMMAND, IDCANCEL, SendMessageW( hwndDlg, WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
(LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
return TRUE; return TRUE;
case VK_EXECUTE:
case VK_RETURN: case VK_RETURN:
{ {
DWORD dw = SendMessageW( hwndDlg, DM_GETDEFID, 0, 0 ); DWORD dw = SendMessageW( hwndDlg, DM_GETDEFID, 0, 0 );
if (HIWORD(dw) == DC_HASDEFID) if (HIWORD(dw) == DC_HASDEFID)
{ {
SendMessageA( hwndDlg, WM_COMMAND, SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
(LPARAM)GetDlgItem(hwndDlg, LOWORD(dw))); (LPARAM)GetDlgItem(hwndDlg, LOWORD(dw)));
} }
else else
{ {
SendMessageA( hwndDlg, WM_COMMAND, IDOK, SendMessageW( hwndDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hwndDlg, IDOK ) );
(LPARAM)GetDlgItem( hwndDlg, IDOK ) );
} }
} }
return TRUE; return TRUE;
} }
*translate = TRUE; break;
break; /* case WM_KEYDOWN */
case WM_CHAR: case WM_CHAR:
if (dlgCode & DLGC_WANTCHARS) break; dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, msg->wParam, (LPARAM)msg );
if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break;
if (msg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break;
/* drop through */ /* drop through */
case WM_SYSCHAR: case WM_SYSCHAR:
if (DIALOG_IsAccelerator( WIN_GetFullHandle(hwnd), hwndDlg, wParam )) if (DIALOG_IsAccelerator( WIN_GetFullHandle(msg->hwnd), hwndDlg, msg->wParam ))
{ {
/* don't translate or dispatch */ /* don't translate or dispatch */
return TRUE; return TRUE;
} }
break; break;
case WM_SYSKEYDOWN:
*translate = TRUE;
break;
} }
/* If we get here, the message has not been treated specially */ TranslateMessage( msg );
/* and can be sent to its destination window. */ DispatchMessageW( msg );
*dispatch = TRUE;
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* IsDialogMessage (USER.90)
*/
BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, SEGPTR msg16 )
{
LPMSG16 msg = MapSL(msg16);
BOOL ret, translate, dispatch;
INT dlgCode = 0;
if ((hwndDlg != msg->hwnd) && !IsChild16( hwndDlg, msg->hwnd ))
return FALSE;
if ((msg->message == WM_KEYDOWN) ||
(msg->message == WM_CHAR))
{
dlgCode = SendMessage16( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg16);
}
ret = DIALOG_IsDialogMessage( WIN_Handle32(msg->hwnd), WIN_Handle32(hwndDlg),
msg->message, msg->wParam, msg->lParam,
&translate, &dispatch, dlgCode );
if (translate) TranslateMessage16( msg );
if (dispatch) DispatchMessage16( msg );
return ret;
}
/***********************************************************************
* IsDialogMessage (USER32.@)
* IsDialogMessageA (USER32.@)
*/
BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG msg )
{
BOOL ret, translate, dispatch;
INT dlgCode = 0;
hwndDlg = WIN_GetFullHandle( hwndDlg );
if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
return FALSE;
if ((msg->message == WM_KEYDOWN) ||
(msg->message == WM_CHAR))
{
dlgCode = SendMessageA( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
}
ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
msg->wParam, msg->lParam,
&translate, &dispatch, dlgCode );
if (translate) TranslateMessage( msg );
if (dispatch) DispatchMessageA( msg );
return ret;
}
/***********************************************************************
* IsDialogMessageW (USER32.@)
*/
BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
{
BOOL ret, translate, dispatch;
INT dlgCode = 0;
hwndDlg = WIN_GetFullHandle( hwndDlg );
if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
return FALSE;
if ((msg->message == WM_KEYDOWN) ||
(msg->message == WM_CHAR))
{
dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
}
ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
msg->wParam, msg->lParam,
&translate, &dispatch, dlgCode );
if (translate) TranslateMessage( msg );
if (dispatch) DispatchMessageW( msg );
return ret;
}
/***********************************************************************
* GetDlgCtrlID (USER32.@) * GetDlgCtrlID (USER32.@)
*/ */
INT WINAPI GetDlgCtrlID( HWND hwnd ) INT WINAPI GetDlgCtrlID( HWND hwnd )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment