+ add code snippet (activation only prepare for future extensions)

This commit is contained in:
Rainer Kottenhoff 2017-10-17 14:08:55 +02:00
parent 3b084fcae5
commit 05c7927634
2 changed files with 37 additions and 0 deletions

View File

@ -608,6 +608,7 @@ void CenterDlgInParent(HWND hDlg)
SetWindowPos(hDlg,NULL,max(xMin,min(xMax,x)),max(yMin,min(yMax,y)),0,0,SWP_NOZORDER|SWP_NOSIZE);
//SnapToDefaultButton(hDlg);
}
@ -672,6 +673,41 @@ void SetDlgPos(HWND hDlg,int xDlg,int yDlg)
}
/*
... only if we are working with nonstandard dialog boxes ...
//=============================================================================
//
// SnapToDefaultButton()
//
// Why doesn't the "Automatically move pointer to the default button in a dialog box"
// work for nonstandard dialog boxes, and how do I add it to my own nonstandard dialog boxes?
// https://blogs.msdn.microsoft.com/oldnewthing/20130826-00/?p=3413/
//
void SnapToDefaultButton(HWND hwndBox)
{
BOOL bSnapToDefButton = FALSE;
if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &bSnapToDefButton, 0) && bSnapToDefButton) {
// get child window at the top of the Z order.
// for all our MessageBoxs it's the OK or YES button or NULL.
HWND btn = GetWindow(hwndBox, GW_CHILD);
if (btn != NULL) {
WCHAR className[32] = L"";
GetClassName(btn, className, COUNTOF(className));
if (lstrcmpi(className, L"Button") == 0) {
RECT rect;
int x, y;
GetWindowRect(btn, &rect);
x = rect.left + (rect.right - rect.left) / 2;
y = rect.top + (rect.bottom - rect.top) / 2;
SetCursorPos(x, y);
}
}
}
}
*/
//=============================================================================
//

View File

@ -125,6 +125,7 @@ void SetWindowTransparentMode(HWND,BOOL);
void CenterDlgInParent(HWND);
void GetDlgPos(HWND,LPINT,LPINT);
void SetDlgPos(HWND,int,int);
//void SnapToDefaultButton(HWND);
void ResizeDlg_Init(HWND,int,int,int);
void ResizeDlg_Destroy(HWND,int*,int*);
void ResizeDlg_Size(HWND,LPARAM,int*,int*);