Skip to content
⌘ NSIS Forum Archive

Part of the Form Not Rendering on Smaller Displays

4 posts

r2du-soft#

Part of the Form Not Rendering on Smaller Displays

I am developing an installer using NSIS (Nullsoft Scriptable Install System) and encountering an issue. My goal is to change the size of the form in my application, but when the form size exceeds the user's screen resolution, part of the form does not render correctly.

Problem:

When I use the SetWindowPos function to change the size of the form, if the form size is larger than the screen resolution, it seems that parts of the form outside the screen area are not being rendered at all.

For example, if the user's screen resolution is set to 800x600, after using the provided code, the form does not resize to 900x800 as intended. Instead, 100 pixels are not rendered from one side and 200 pixels from the other side of the form.

Code:

Here is the NSIS code I am using:


System::Call 'user32::SetWindowPos(i$HWNDPARENT,i,i,i,i 900,i 800,i 0x16)'


Issue I Am Facing:

1-Part of the Form Not Rendering: When I set the form size to be larger than the screen resolution, it appears that parts of the form outside the display area are not being rendered at all.

2-Size and Position Settings: Even though I am using SetWindowPos and ensuring that the parameters are set correctly, the issue persists.

Question:

Is there a solution to ensure that all parts of the form, even those outside the visible screen area, are rendered correctly? Should I change any specific settings or parameters in NSIS to address this issue?

Thank you for your guidance and help.
Anders#
What do you mean by not rendered? If it is outside the screen, how do you know its not rendered?

Screenshot? Windows version?
r2du-soft#

;-----------------
!include "MUI2.nsh"
!include "x64.nsh"
!include "WinMessages.nsh"
;-----------------

;-----------------
Var nsDialogs
Var BTN_QUIT
;-----------------

;-----------------
Page Custom Custom_Page_Show
;-----------------


Function Custom_Page_Show
;-----------------
MoveAnywhere::Hook
;-----------------
System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)'
;-----------------
System::Call 'user32::SetWindowPos(i$HWNDPARENT,i,i,i,i 1400,i 1024,i 0x16)'

nsDialogs::Create 1044
Pop $nsDialogs
SetCtlColors $nsDialogs 0x000000 0xfafafa
System::Call 'USER32::MoveWindow(p$nsDialogs,i0,i0,i 1400,i 1024,i1)'
;-----------------

;-----------------
${NSD_CreateButton} 100 17 100 29 "QUIT"
Pop $BTN_QUIT
CreateFont $0 "Myriad Pro" 20 700
SendMessage $BTN_QUIT ${WM_SETFONT} $0 1
SetCtlColors $BTN_QUIT 0xffffff 0x015f72
${NSD_OnClick} $BTN_QUIT BTN_QUIT_Click
;-----------------

;-----------------
${NSD_CreateButton} 1200 17 100 29 "CLOSE"
Pop $BTN_QUIT
CreateFont $0 "Myriad Pro" 20 700
SendMessage $BTN_QUIT ${WM_SETFONT} $0 1
SetCtlColors $BTN_QUIT 0xffffff 0x015f72
${NSD_OnClick} $BTN_QUIT BTN_QUIT_Click
;-----------------

;-----------------
nsDialogs::Show
;-----------------
FunctionEnd


Function BTN_QUIT_Click
;-----------------
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Bye!!"
SendMessage $HWNDPARENT ${WM_CLOSE} 0 0
Quit
;-----------------
FunctionEnd



Section

SectionEnd
In the provided code, I have set the page size to 1400 X 1024. If the display resolution in Windows is set to a value larger than this, the entire program form is displayed, and the two buttons, QUIT and CLOSE, are also visible.

Click image for larger version

Name:	OK.jpg
Views:	102
Size:	71.3 KB
ID:	4636757

However, if the display resolution in Windows is set to a value smaller than the one defined in the program (e.g., 800 X 600), the program form is rendered according to the display resolution (which in this case is 800 X 600).

Click image for larger version

Name:	NOT.jpg
Views:	72
Size:	15.5 KB
ID:	4636758

This issue occurs when using the following code:

System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)'
This code is used to remove the program's Title Bar. I have conducted extensive investigations, but I have not been able to resolve the issue.

r2du-soft#
After further investigation, I managed to solve the issue, but I am not sure if it is the definitive and correct solution or not.

All default styles of the NSIS form have a code equal to -1798698932. If the style named {WS_POPUPWINDOW} is removed, the final code becomes 339871820. In the previous explanation, we applied this style, but this caused an issue where part of the program's form wouldn't load (as explained earlier).

To resolve this issue, in order to remove the Title Bar (without problems such as the form not loading properly), {WS_POPUPWINDOW} should be removed and replaced with {WS_POPUP}.

The following code can be used to perform this action:


System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i -1807611828)'

other info:
;------------------------------
+DEFAULT STYLE
-1798698932
;------------------------------

;------------------------------
-REMOVE {WS_POPUPWINDOW}
339871820
;------------------------------

;------------------------------
-REMOVE {WS_POPUPWINDOW}
+ADD {WS_POPUP}
-1807611828
;------------------------------