tune GetRootWindow to return the number of windows

This commit is contained in:
Vincent Wei
2020-03-04 22:52:36 +08:00
parent 5224e31084
commit 5812c11f7c
2 changed files with 10 additions and 4 deletions

View File

@@ -8463,8 +8463,8 @@ MG_EXPORT LINT GUIAPI GetWindowId (HWND hWnd);
MG_EXPORT LINT GUIAPI SetWindowId (HWND hWnd, LINT lNewId); MG_EXPORT LINT GUIAPI SetWindowId (HWND hWnd, LINT lNewId);
/** /**
* \fn HWND GUIAPI GetRootWindow (void) * \fn HWND GUIAPI GetRootWindow (int* nrWins)
* \brief Retrieve the root window of current thread. * \brief Retrieve the root window of the current thread.
* *
* All main windows and/or virtual windows in a thread form a window tree. * All main windows and/or virtual windows in a thread form a window tree.
* The root window of the tree may be HWND_DESKTOP or the first main/virtual * The root window of the tree may be HWND_DESKTOP or the first main/virtual
@@ -8472,13 +8472,16 @@ MG_EXPORT LINT GUIAPI SetWindowId (HWND hWnd, LINT lNewId);
* *
* This function retrieves and returns the root window in the current thread. * This function retrieves and returns the root window in the current thread.
* *
* \param nrWins A pointer to an integer used to return the number of total
* windows in the current thread. It can be NULL.
*
* \return The handle to the root window. If the current thread is not * \return The handle to the root window. If the current thread is not
* a message thread, it returns HWND_INVALID. If there is no * a message thread, it returns HWND_INVALID. If there is no
* any window created in the current thread, it returns HWND_NULL. * any window created in the current thread, it returns HWND_NULL.
* *
* \sa GetHosting, GetFirstHosted, GetNextHosted, GetMainWindowById * \sa GetHosting, GetFirstHosted, GetNextHosted, GetMainWindowById
*/ */
MG_EXPORT HWND GUIAPI GetRootWindow (void); MG_EXPORT HWND GUIAPI GetRootWindow (int* nrWins);
/** /**
* \fn HWND GUIAPI GetHosting (HWND hWnd) * \fn HWND GUIAPI GetHosting (HWND hWnd)

View File

@@ -2953,7 +2953,7 @@ HWND GUIAPI GetParent (HWND hWnd)
} }
/* Since 5.0.0 */ /* Since 5.0.0 */
HWND GUIAPI GetRootWindow (void) HWND GUIAPI GetRootWindow (int *nrWins)
{ {
MSGQUEUE* pMsgQueue; MSGQUEUE* pMsgQueue;
@@ -2961,6 +2961,9 @@ HWND GUIAPI GetRootWindow (void)
return HWND_INVALID; return HWND_INVALID;
} }
if (nrWins)
*nrWins = pMsgQueue->nrWindows;
return (HWND)pMsgQueue->pRootMainWin; return (HWND)pMsgQueue->pRootMainWin;
} }