MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / SetDlgPos

Function SetDlgPos

src/Helpers.c:528–550  ·  view source on GitHub ↗

============================================================================= SetDlgPos()

Source from the content-addressed store, hash-verified

526// SetDlgPos()
527//
528void SetDlgPos ( HWND hDlg, int xDlg, int yDlg )
529{
530 RECT rcDlg;
531 HWND hParent;
532 RECT rcParent;
533 MONITORINFO mi;
534 HMONITOR hMonitor;
535 int xMin, yMin, xMax, yMax, x, y;
536 GetWindowRect ( hDlg, &rcDlg );
537 hParent = GetParent ( hDlg );
538 GetWindowRect ( hParent, &rcParent );
539 hMonitor = MonitorFromRect ( &rcParent, MONITOR_DEFAULTTONEAREST );
540 mi.cbSize = sizeof ( mi );
541 GetMonitorInfo ( hMonitor, &mi );
542 xMin = mi.rcWork.left;
543 yMin = mi.rcWork.top;
544 xMax = ( mi.rcWork.right ) - ( rcDlg.right - rcDlg.left );
545 yMax = ( mi.rcWork.bottom ) - ( rcDlg.bottom - rcDlg.top );
546 // desired positions relative to parent window
547 x = rcParent.left + xDlg;
548 y = rcParent.top + yDlg;
549 SetWindowPos ( hDlg, NULL, max ( xMin, min ( xMax, x ) ), max ( yMin, min ( yMax, y ) ), 0, 0, SWP_NOZORDER | SWP_NOSIZE );
550}
551
552
553//=============================================================================

Callers 1

EditFindReplaceDlgProcWFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected