LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active);
void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id );
-#define CW_USEDEFAULT16 0x00008000
-
/* FUNCTIONS *****************************************************************/
HDWP WINAPI
BeginDeferWindowPos(int nNumWindows)
{
- if (nNumWindows < 0)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
-#if 0
- UNIMPLEMENTED;
- return (HDWP)0;
-#else
- return (HDWP)1;
-#endif
+ return (HDWP)NtUserCallOneParam((DWORD_PTR)nNumWindows, ONEPARAM_ROUTINE_BEGINDEFERWNDPOS);
}
{
SendMessageA(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
- return (BOOL)(hWnd);
+ return HandleToUlong(hWnd);
}
VOID
POINT mPos[2];
UINT id = 0;
HWND top_child;
- PWND WndParent;
- PCLS pcls;
+ PWND pWndParent;
+
+ pWndParent = ValidateHwnd(hWndParent);
- if(!(WndParent = ValidateHwnd(hWndParent)) ||
- !(pcls = DesktopPtrToUser(WndParent->pcls)))
- return 0;
+ if (!pWndParent) return NULL;
- if (pcls->fnid != FNID_MDICLIENT)
+ if (pWndParent->fnid != FNID_MDICLIENT) // wine uses WIN_ISMDICLIENT
{
- ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
- return 0;
+ WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
+ return NULL;
}
/* lpParams of WM_[NC]CREATE is different for MDI children.
lpParam = (LPVOID)&mdi;
- if (GetWindowLongPtrW(hWndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
+ if (pWndParent->style & MDIS_ALLCHILDSTYLES)
{
if (dwStyle & WS_POPUP)
{
MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
- if (!(dwStyle & WS_POPUP)) hMenu = (HMENU)id;
+ if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
if (dwStyle & (WS_CHILD | WS_POPUP))
{
POINT mPos[2];
UINT id = 0;
HWND top_child;
- PWND WndParent;
- PCLS pcls;
-
- WndParent = ValidateHwnd(hWndParent);
+ PWND pWndParent;
- if(!WndParent)
- return 0;
+ pWndParent = ValidateHwnd(hWndParent);
- pcls = DesktopPtrToUser(WndParent->pcls);
+ if (!pWndParent) return NULL;
- if(!pcls)
- return 0;
-
- if (pcls->fnid != FNID_MDICLIENT)
+ if (pWndParent->fnid != FNID_MDICLIENT)
{
- ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
- return 0;
+ WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
+ return NULL;
}
-
+
/* lpParams of WM_[NC]CREATE is different for MDI children.
* MDICREATESTRUCT members have the originally passed values.
*/
lpParam = (LPVOID)&mdi;
- if (GetWindowLongPtrW(hWndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
+ if (pWndParent->style & MDIS_ALLCHILDSTYLES)
{
if (dwStyle & WS_POPUP)
{
MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
- if (!(dwStyle & WS_POPUP)) hMenu = (HMENU)id;
+ if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
if (dwStyle & (WS_CHILD | WS_POPUP))
{
int cy,
UINT uFlags)
{
-#if 0
return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
-#else
- SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
- return hWinPosInfo;
-#endif
}
BOOL WINAPI
EndDeferWindowPos(HDWP hWinPosInfo)
{
-#if 0
- UNIMPLEMENTED;
- return FALSE;
-#else
- return TRUE;
-#endif
+ return NtUserEndDeferWindowPosEx(hWinPosInfo, 0);
}
return FALSE;
}
+ if (!dwCount)
+ {
+ if (!dwThreadId)
+ return FALSE;
+ else
+ return TRUE;
+ }
+
/* call the user's callback function until we're done or
they tell us to quit */
for ( i = 0; i < dwCount; i++ )
/* FIXME I'm only getting NULLs from Thread Enumeration, and it's
* probably because I'm not doing it right in NtUserBuildHwndList.
* Once that's fixed, we shouldn't have to check for a NULL HWND
- * here
+ * here
+ * This is now fixed in revision 50205. (jt)
*/
- if (!(ULONG)pHwnd[i]) /* don't enumerate a NULL HWND */
+ if (!pHwnd[i]) /* don't enumerate a NULL HWND */
continue;
if (!(*lpfn)(pHwnd[i], lParam))
{
_SEH2_TRY
{
WndParent = NULL;
- if (Wnd->style & WS_CHILD)
- {
- if (Wnd->spwndParent != NULL)
- WndParent = DesktopPtrToUser(Wnd->spwndParent);
- }
- else if (Wnd->style & WS_POPUP)
+ if (Wnd->style & WS_POPUP)
{
if (Wnd->spwndOwner != NULL)
WndParent = DesktopPtrToUser(Wnd->spwndOwner);
}
+ else if (Wnd->style & WS_CHILD)
+ {
+ if (Wnd->spwndParent != NULL)
+ WndParent = DesktopPtrToUser(Wnd->spwndParent);
+ }
if (WndParent != NULL)
Ret = UserHMGetHandle(WndParent);
{ // We are current.
//FIXME("Current!\n");
if (lpdwProcessId)
- *lpdwProcessId = (DWORD)NtCurrentTeb()->ClientId.UniqueProcess;
- Ret = (DWORD)NtCurrentTeb()->ClientId.UniqueThread;
+ *lpdwProcessId = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
+ Ret = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueThread;
}
else
{ // Ask kernel for info.
IsChild(HWND hWndParent,
HWND hWnd)
{
- PWND WndParent, Wnd;
+ PWND WndParent, DesktopWnd, Wnd;
BOOL Ret = FALSE;
WndParent = ValidateHwnd(hWndParent);
if (!Wnd)
return FALSE;
+ DesktopWnd = GetThreadDesktopWnd();
+ if (!DesktopWnd)
+ return FALSE;
+
_SEH2_TRY
{
- while (Wnd != NULL)
+ while (Wnd != NULL && ((Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD))
{
if (Wnd->spwndParent != NULL)
{
Wnd = DesktopPtrToUser(Wnd->spwndParent);
+
if (Wnd == WndParent)
{
Ret = TRUE;
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
- DefWndNCPaint(hWnd, (HRGN)1, -1);
+ DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
}
return TRUE;
}
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
{
- DefWndNCPaint(hWnd, (HRGN)1, -1);
+ DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
}
return TRUE;
}
return FALSE;
}
-
-/*
- * @implemented
- */
-HWND WINAPI
-WindowFromPoint(POINT Point)
-{
- //TODO: Determine what the actual parameters to
- // NtUserWindowFromPoint are.
- return NtUserWindowFromPoint(Point.x, Point.y);
-}
-
-
-/*
- * @implemented
- */
-int WINAPI
-MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
-{
- PWND FromWnd, ToWnd;
- POINT Delta;
- UINT i;
-
- FromWnd = ValidateHwndOrDesk(hWndFrom);
- if (!FromWnd)
- return 0;
-
- ToWnd = ValidateHwndOrDesk(hWndTo);
- if (!ToWnd)
- return 0;
-
- Delta.x = FromWnd->rcClient.left - ToWnd->rcClient.left;
- Delta.y = FromWnd->rcClient.top - ToWnd->rcClient.top;
-
- for (i = 0; i != cPoints; i++)
- {
- lpPoints[i].x += Delta.x;
- lpPoints[i].y += Delta.y;
- }
-
- return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-ScreenToClient(HWND hWnd, LPPOINT lpPoint)
-{
- PWND Wnd, DesktopWnd;
-
- Wnd = ValidateHwnd(hWnd);
- if (!Wnd)
- return FALSE;
-
- DesktopWnd = GetThreadDesktopWnd();
-
- lpPoint->x += DesktopWnd->rcClient.left - Wnd->rcClient.left;
- lpPoint->y += DesktopWnd->rcClient.top - Wnd->rcClient.top;
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-ClientToScreen(HWND hWnd, LPPOINT lpPoint)
-{
- PWND Wnd, DesktopWnd;
-
- Wnd = ValidateHwnd(hWnd);
- if (!Wnd)
- return FALSE;
-
- DesktopWnd = GetThreadDesktopWnd();
-
- lpPoint->x += Wnd->rcClient.left - DesktopWnd->rcClient.left;
- lpPoint->y += Wnd->rcClient.top - DesktopWnd->rcClient.top;
-
- return TRUE;
-}
-
-
/*
* @implemented
*/
return NtUserSetWindowContextHelpId(hwnd, dwContextHelpId);
}
-
/*
* @implemented
*/
BOOL WINAPI
AnyPopup(VOID)
{
- return NtUserAnyPopup();
+ int i;
+ BOOL retvalue;
+ HWND *list = WIN_ListChildren( GetDesktopWindow() );
+
+ if (!list) return FALSE;
+ for (i = 0; list[i]; i++)
+ {
+ if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break;
+ }
+ retvalue = (list[i] != 0);
+ HeapFree( GetProcessHeap(), 0, list );
+ return retvalue;
}
/*
BOOL WINAPI
IsWindowInDestroy(HWND hWnd)
{
- return NtUserIsWindowInDestroy(hWnd);
+ PWND pwnd;
+ pwnd = ValidateHwnd(hWnd);
+ if (!pwnd)
+ return FALSE;
+ return ((pwnd->state2 & WNDS2_INDESTROY) == WNDS2_INDESTROY);
}
/*