Fixed window positioning in case of change in screen resolution or workarea size.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3399 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
43e954d702
commit
6206755ccf
1 changed files with 21 additions and 0 deletions
|
@ -304,6 +304,27 @@ void RestoreWindowPos(HWND hwnd) {
|
|||
DWORD l = sizeof(p);
|
||||
DWORD t;
|
||||
if ((RegQueryValueEx(hKey,REGLOC,NULL,&t,(unsigned char*)&p,&l)==ERROR_SUCCESS)&&(t == REG_BINARY)&&(l==sizeof(p))) {
|
||||
int width, height;
|
||||
|
||||
width = GetSystemMetrics(SM_CXFULLSCREEN);
|
||||
height = GetSystemMetrics(SM_CYFULLSCREEN);
|
||||
height += GetSystemMetrics(SM_CYCAPTION);
|
||||
if((p.rcNormalPosition.right-p.rcNormalPosition.left) > width) {
|
||||
p.rcNormalPosition.left = 0;
|
||||
p.rcNormalPosition.right = width;
|
||||
}
|
||||
else if(p.rcNormalPosition.right > width) {
|
||||
p.rcNormalPosition.left = (width - (p.rcNormalPosition.right-p.rcNormalPosition.left))/2;
|
||||
}
|
||||
|
||||
if((p.rcNormalPosition.bottom-p.rcNormalPosition.top) > height) {
|
||||
p.rcNormalPosition.top = 0;
|
||||
p.rcNormalPosition.bottom = height;
|
||||
}
|
||||
else if(p.rcNormalPosition.bottom > height) {
|
||||
p.rcNormalPosition.top = (height - (p.rcNormalPosition.bottom-p.rcNormalPosition.top))/2;
|
||||
}
|
||||
|
||||
p.length = sizeof(p);
|
||||
SetWindowPlacement(hwnd, &p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue