Implement CenterWindowRelativeToParent.

svn path=/trunk/; revision=16379
This commit is contained in:
Eric Kohl 2005-07-02 14:05:38 +00:00
parent 50c2bb7322
commit 6c58ea3cd7
4 changed files with 50 additions and 2 deletions

View file

@ -675,6 +675,7 @@ LONG WINAPI AddTagToGroupOrderList(PCWSTR, DWORD, DWORD);
VOID WINAPI AssertFail(LPSTR, UINT, LPSTR);
DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
VOID WINAPI CenterWindowRelativeToParent(HWND);
BOOL WINAPI ConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
BOOL WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);

View file

@ -860,7 +860,7 @@ VOID WINAPI AssertFail(LPSTR lpFile, UINT uLine, LPSTR lpMessage)
CHAR szModule[MAX_PATH];
CHAR szBuffer[2048];
LPSTR lpName;
LPSTR lpBuffer;
// LPSTR lpBuffer;
TRACE("%s %u %s\n", lpFile, uLine, lpMessage);
@ -1044,3 +1044,49 @@ ConcatenatePaths(LPWSTR lpPath,
return (dwBufferSize >= dwTotalSize);
}
/**************************************************************************
* CenterWindowRelativeToParent [SETUPAPI.@]
*
* Centers a window relative to its parent.
*
* PARAMS
* hwnd [I] Window to center.
*
* RETURNS
* None
*/
VOID WINAPI
CenterWindowRelativeToParent(HWND hwnd)
{
HWND hwndOwner;
POINT ptOrigin;
RECT rcWindow;
RECT rcOwner;
INT nWindowWidth, nWindowHeight;
INT nOwnerWidth, nOwnerHeight;
INT posX, posY;
hwndOwner = GetWindow(hwnd, GW_OWNER);
if (hwndOwner == NULL)
return;
ptOrigin.x = 0;
ptOrigin.y = 0;
ClientToScreen(hwndOwner, &ptOrigin);
GetWindowRect(hwnd, &rcWindow);
GetClientRect(hwndOwner, &rcOwner);
nWindowWidth = rcWindow.right - rcWindow.left;
nWindowHeight = rcWindow.bottom - rcWindow.top;
nOwnerWidth = rcOwner.right - rcOwner.left;
nOwnerHeight = rcOwner.bottom - rcOwner.top;
posX = ((nOwnerWidth - nWindowWidth) / 2) + ptOrigin.x;
posY = ((nOwnerHeight - nWindowHeight) / 2) + ptOrigin.y;
MoveWindow(hwnd, posX, posY, nWindowHeight, nWindowWidth, 0);
}

View file

@ -192,7 +192,7 @@
@ stub CM_Unregister_Device_Interface_ExW
@ stdcall CaptureAndConvertAnsiArg(str ptr)
@ stdcall CaptureStringArg(wstr ptr)
@ stub CenterWindowRelativeToParent
@ stdcall CenterWindowRelativeToParent(long)
@ stdcall ConcatenatePaths(wstr wstr long ptr)
@ stdcall DelayedMove(wstr wstr)
@ stub DelimStringToMultiSz

View file

@ -1038,6 +1038,7 @@ typedef SP_BACKUP_QUEUE_PARAMS_A SP_BACKUP_QUEUE_PARAMS,
WINSETUPAPI LONG WINAPI AddTagToGroupOrderList(PCWSTR, DWORD, DWORD);
WINSETUPAPI VOID WINAPI CenterWindowRelativeToParent(HWND);
WINSETUPAPI PWSTR WINAPI DuplicateString(PCWSTR);
WINSETUPAPI BOOL WINAPI IsUserAdmin(VOID);
WINSETUPAPI VOID WINAPI MyFree(PVOID);