!include "MUI2.nsh" ; Local bitmap path. !define BITMAP_FILE res.bmp ; -------------------------------------------------------------------------------------------------- ; Installer Settings ; -------------------------------------------------------------------------------------------------- Name "Background Bitmap" OutFile "bgbitmap.exe" ShowInstDetails show !define MUI_HEADERIMAGE # this is responsible for the big window !define MUI_UI_HEADERIMAGE ".\dimm_beta_img.exe" # modded exe ; -------------------------------------------------------------------------------------------------- ; Modern UI Settings ; -------------------------------------------------------------------------------------------------- !define MUI_COMPONENTSPAGE_NODESC !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_CUSTOMFUNCTION_GUIINIT MyGUIInit ; -------------------------------------------------------------------------------------------------- ; Definitions ; -------------------------------------------------------------------------------------------------- Var hBitmap ; -------------------------------------------------------------------------------------------------- ; Pages ; -------------------------------------------------------------------------------------------------- !define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageShow !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_LANGUAGE English ; -------------------------------------------------------------------------------------------------- ; Macros ; -------------------------------------------------------------------------------------------------- ; Destroy a window. !macro DestroyWindow HWND IDC GetDlgItem $R0 ${HWND} ${IDC} System::Call `user32::DestroyWindow(i R0)` !macroend ; Give window transparent background. !macro SetTransparent HWND IDC GetDlgItem $R0 ${HWND} ${IDC} SetCtlColors $R0 0x444444 transparent !macroend ; Refresh window. !macro RefreshWindow HWND IDC GetDlgItem $R0 ${HWND} ${IDC} ShowWindow $R0 ${SW_HIDE} ShowWindow $R0 ${SW_SHOW} !macroend ; -------------------------------------------------------------------------------------------------- ; Functions ; -------------------------------------------------------------------------------------------------- Function MyGUIInit ; Extract bitmap image. InitPluginsDir ReserveFile `${BITMAP_FILE}` File `/ONAME=$PLUGINSDIR\res.bmp` `${BITMAP_FILE}` ; Get the size of the window. System::Call `*${stRECT} .R0` System::Call `user32::GetClientRect(i $HWNDPARENT, i R0)` System::Call `*$R0${stRECT} (, , .R1, .R2)` System::Free $R0 ; Create bitmap control. System::Call `kernel32::GetModuleHandle(i 0) i.R3` System::Call `user32::CreateWindowEx(i 0, t "STATIC", t "", i ${SS_BITMAP}|${WS_CHILD}|${WS_VISIBLE}, i 0, i 0, i R1, i R2, i $HWNDPARENT, i ${IDC_BITMAP}, i R3, i 0) i.R1` System::Call `user32::SetWindowPos(i R1, i ${HWND_TOP}, i 0, i 0, i 0, i 0, i ${SWP_NOSIZE}|${SWP_NOMOVE})` ; Set the bitmap. System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\res.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) i.s` Pop $hBitmap SendMessage $R1 ${STM_SETIMAGE} ${IMAGE_BITMAP} $hBitmap ; Set transparent backgrounds. !insertmacro SetTransparent $HWNDPARENT 3 !insertmacro SetTransparent $HWNDPARENT 1 !insertmacro SetTransparent $HWNDPARENT 2 !insertmacro SetTransparent $HWNDPARENT 1034 !insertmacro SetTransparent $HWNDPARENT 1037 !insertmacro SetTransparent $HWNDPARENT 1038 !insertmacro SetTransparent $HWNDPARENT 1028 !insertmacro SetTransparent $HWNDPARENT 1256 ; !insertmacro SetTransparent $HWNDPARENT 1045 !insertmacro SetTransparent $HWNDPARENT 1035 ; Remove unwanted controls. !insertmacro DestroyWindow $HWNDPARENT 1256 !insertmacro DestroyWindow $HWNDPARENT 1028 ; !insertmacro DestroyWindow $HWNDPARENT 1039 !insertmacro DestroyWindow $HWNDPARENT 1045 # dimm remove line from bottom ; !insertmacro DestroyWindow $HWNDPARENT 1035 ; !insertmacro DestroyWindow $HWNDPARENT 1256 FunctionEnd Function RefreshParentControls !insertmacro RefreshWindow $HWNDPARENT 1037 !insertmacro RefreshWindow $HWNDPARENT 1038 FunctionEnd Function WelcomePageShow # Sets background image System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\res.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) i.s` Pop $hBitmap ; SendMessage $bitmapWindow ${STM_SETIMAGE} ${IMAGE_BITMAP} $hBitmap # Start solution SetCtlColors $mui.WelcomePage ${CTRL_COLOUR} transparent SetCtlColors $mui.WelcomePage.text ${CTRL_COLOUR} transparent SetCtlColors $mui.WelcomePage.title 0x333333 transparent !insertmacro DestroyWindow $HWNDPARENT 1037 !insertmacro DestroyWindow $HWNDPARENT 1038 !insertmacro DestroyWindow $HWNDPARENT 1036 SetCtlColors $0 222425 transparent System::Call `user32::DestroyWindow(i $mui.WelcomePage.Image)` Call RefreshParentControls FunctionEnd ; BrandingText "" ; Free loaded resources. Function .onGUIEnd ; Destroy the bitmap. System::Call `gdi32::DeleteObject(i s)` $hBitmap FunctionEnd ; -------------------------------------------------------------------------------------------------- ; Dummy section ; -------------------------------------------------------------------------------------------------- Section "Dummy Section" SectionEnd
Directory Page
::Code
;working examle for "Directory Page" Full Transparent /// DIMM_V2 !include "MUI2.nsh" ; Local bitmap path. !define BITMAP_FILE res.bmp ; -------------------------------------------------------------------------------------------------- ; Installer Settings ; -------------------------------------------------------------------------------------------------- Name "Background Bitmap" OutFile "bgbitmap.exe" ShowInstDetails show ; -------------------------------------------------------------------------------------------------- ; Modern UI Settings ; -------------------------------------------------------------------------------------------------- ; !define MUI_UI ".\dimm_beta_img.exe" ;The interface file with the dialog resources. Change this if you have made your own customized UI. ; !define MUI_HEADERIMAGE # это отвечает за большое окно ; !define MUI_UI_HEADERIMAGE ".\dimm_beta_img.exe" # измененный ехе ; dimm 1018 my bmp image ! !define MUI_DIRECTORYPAGE_BGCOLOR CDCDCD # gray color of Destination Folder !define BGCOLOR Transparent ; Setting this to "Transparent" only works partially and requires some hacks... !define MUI_CUSTOMFUNCTION_GUIINIT MyGUIInit !define MUI_TEXTCOLOR ffffff # white : ffffff !define MUI_BGCOLOR Transparent # back upper side must be transparent DirText "$\r" # псевдо затирание! /// hide text in directory page !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install Folder" ; -------------------------------------------------------------------------------------------------- ; Definitions InstallDir "$temp" ; -------------------------------------------------------------------------------------------------- Var hBitmap ; -------------------------------------------------------------------------------------------------- ; Pages ; -------------------------------------------------------------------------------------------------- !define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE English ; -------------------------------------------------------------------------------------------------- ; Macros ; -------------------------------------------------------------------------------------------------- ; Destroy a window. !macro DestroyWindow HWND IDC GetDlgItem $R0 ${HWND} ${IDC} System::Call `user32::DestroyWindow(i R0)` !macroend ; Give window transparent background. !macro SetTransparent HWND IDC GetDlgItem $R0 ${HWND} ${IDC} SetCtlColors $R0 0x444444 transparent !macroend !macro setwhite HWND IDC GetDlgItem $R0 ${HWND} ${IDC} SetCtlColors $R0 ffffff transparent # set text color here ==> white - ffffff gray , transparent !macroend ; Refresh window. !macro RefreshWindow HWND IDC GetDlgItem $R0 ${HWND} ${IDC} ShowWindow $R0 ${SW_HIDE} ShowWindow $R0 ${SW_SHOW} !macroend ; -------------------------------------------------------------------------------------------------- ; Macros ; -------------------------------------------------------------------------------------------------- ; -------------------------------------------------------------------------------------------------- ; Functions ; -------------------------------------------------------------------------------------------------- Function MyGUIInit ; Extract bitmap image. InitPluginsDir ReserveFile `${BITMAP_FILE}` File `/ONAME=$PLUGINSDIR\bg.bmp` `${BITMAP_FILE}` System::Call `user32::GetClientRect(i $HWNDPARENT, i R0)` System::Free $R0 ; Create bitmap control. System::Call `kernel32::GetModuleHandle(i 0) i.R3` System::Call `user32::CreateWindowEx(i 0, t "STATIC", t "", i ${SS_BITMAP}|${WS_CHILD}|${WS_VISIBLE}, i 0, i 0, i R1, i R2, i $HWNDPARENT, i,i R3, i 0) i.R1` System::Call `user32::SetWindowPos(i R1, i , i 0, i 0, i 0, i 0, i })` ; Set the bitmap. System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\bg.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) i.s` Pop $hBitmap SendMessage $R1 ${STM_SETIMAGE} ${IMAGE_BITMAP} $hBitmap FunctionEnd ; Refresh parent window controls. ; Has to be done for some controls if they have a transparent background. Function RefreshParentControls !insertmacro RefreshWindow $HWNDPARENT 1020 !insertmacro RefreshWindow $HWNDPARENT 1019 !insertmacro RefreshWindow $HWNDPARENT 1256 !insertmacro RefreshWindow $HWNDPARENT 1024 !insertmacro RefreshWindow $HWNDPARENT 1023 FunctionEnd ; from page dir ; DirectoryPage "#32770" "" $HWNDPARENT ; DirectoryPage.Text $mui.DirectoryPage 1006 ; DirectoryPage.DirectoryBox $mui.DirectoryPage 1020 ; DirectoryPage.Directory $mui.DirectoryPage 1019 ; DirectoryPage.BrowseButton $mui.DirectoryPage 1001 ; DirectoryPage.SpaceRequired $mui.DirectoryPage 1023 ; DirectoryPage.SpaceAvailable $mui.DirectoryPage 1024 ; For directory page. Function DirectoryPageShow SetCtlColors $mui.DirectoryPage.title 0xFFFFFF transparent # Set Transparent page bg ;Set transparent backgrounds. FindWindow $0 "#32770" "" $HWNDPARENT !insertmacro setwhite $0 1256 # SpaceRequired !insertmacro setwhite $0 1023 # SpaceRequired !insertmacro SetTransparent $0 1001 # dimm this is working !insertmacro SetTransparent $0 1008 # dimm this is working !insertmacro SetTransparent $0 1001 !insertmacro setwhite $0 1024 # space availbe !insertmacro SetTransparent $0 1008 !insertmacro SetTransparent $0 1006 # middle bg ; !insertmacro SetTransparent $0 1020 # this is label of Dest. Folder SendMessage $R0 ${WM_SETTEXT} 0 STR: # hide label "Directory Folder" ; Remove unwanted controls. !insertmacro DestroyWindow $HWNDPARENT 1023 # remove line here working !insertmacro DestroyWindow $HWNDPARENT 1020 # remove line here working !insertmacro DestroyWindow $HWNDPARENT 1256 # remove line here working !insertmacro DestroyWindow $HWNDPARENT 1028 # remove line here working !insertmacro DestroyWindow $HWNDPARENT 1039 # remove line here working ; Refresh controls. Call RefreshParentControls FunctionEnd ; Free loaded resources. Function .onGUIEnd ; Destroy the bitmap. ; System::Call `gdi32::DeleteObject(i s)` $hBitmap FunctionEnd ; -------------------------------------------------------------------------------------------------- ; Dummy section ; -------------------------------------------------------------------------------------------------- Section "Dummy Section" SectionEnd
;working examle for "Directory Page" Full Transparent /// DIMM_V2 !include "MUI2.nsh" ; Local bitmap path. !define BITMAP_FILE res.bmp ; -------------------------------------------------------------------------------------------------- ; Installer Settings ; -------------------------------------------------------------------------------------------------- Name "Background Bitmap" OutFile "bgbitmap.exe" ShowInstDetails show ; -------------------------------------------------------------------------------------------------- ; Modern UI Settings ; -------------------------------------------------------------------------------------------------- ; !define MUI_UI ".\dimm_beta_img.exe" ;The interface file with the dialog resources. Change this if you have made your own customized UI.
Install Page
:: Code
RequestExecutionLevel User !include "MUI2.nsh" !include "nsDialogs.nsh" !define MUI_HEADERIMAGE # need to load custom exe !define MUI_UI_HEADERIMAGE ".\dimm_beta_img.exe" ; dimm 1018 my bmp image ! ; !define MUI_HEADER_TRANSPARENT_TEXT ; Set this if you don't want header text !define MUI_TEXTCOLOR ffffff # white color here !define MUI_BGCOLOR Transparent !define TEXTCOLOR 0x${MUI_TEXTCOLOR} !define BGCOLOR Transparent ; Setting this to "Transparent" only works partially and requires some hacks... !define MUI_CUSTOMFUNCTION_GUIINIT GuiInit !define MUI_PAGE_CUSTOMFUNCTION_SHOW ConfigureInstFilesPage # need for transparent !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" BrandingText "DIMM_V2" Function GuiInit GetDlgItem $0 $HWNDPARENT 0x4E8 # hide lines and not used objects ShowWindow $0 0 GetDlgItem $0 $HWNDPARENT 0x404 # hide lines and not used objects ShowWindow $0 0 GetDlgItem $0 $HWNDPARENT 0x40b # hide lines and not used objects ShowWindow $0 0 GetDlgItem $0 $HWNDPARENT 0x40c # hide lines and not used objects ShowWindow $0 0 ShowWindow $mui.Header.Background 0 #hide lines and not used objects ShowWindow $mui.Header.Image 0 #hide lines and not used objects StrCpy $1 $HWNDPARENT System::Call 'USER32::GetClientRect(pr1, @r2)' System::Call '*$2(i.r6,i.r7,i.r3,i.r4)' #https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_CHILD}|${WS_VISIBLE}|${SS_BITMAP}|${WS_CLIPSIBLINGS}, ir6, ir7, ir3, ir4, pr1, p0, p0, p0)p.r5' File "/OName=$Pluginsdir\bg.bmp" "bg.bmp" LoadAndSetImage /STRINGID /RESIZETOFIT $5 0 0x10 "bg.bmp" $6 !if ${BGCOLOR} == Transparent ${NSD_AddExStyle} $mui.Header.Text ${WS_EX_TRANSPARENT} ${NSD_AddExStyle} $mui.Header.SubText ${WS_EX_TRANSPARENT} !endif FunctionEnd !macro FixTransparentText !if ${BGCOLOR} == Transparent System::Call 'USER32::RedrawWindow(p$HWNDPARENT,p0,p0,i4|1|512|128)' !endif !macroend !macro PageInit SetCtlColors $mui.Header.Text ${TEXTCOLOR} ${BGCOLOR} SetCtlColors $mui.Header.SubText ${TEXTCOLOR} ${BGCOLOR} FindWindow $1 "#32770" "" $HWNDPARENT ; Inner dialog SetCtlColors $1 ${TEXTCOLOR} transparent !insertmacro FixTransparentText !macroend Function ConfigureInstFilesPage # need for transparent !insertmacro PageInit SetCtlColors $mui.InstFilesPage.Text ${TEXTCOLOR} ${BGCOLOR} FunctionEnd Section !insertmacro FixTransparentText Sleep 4000 File /r "D:\DEKSTOP_WIN\WP\Normal WP\Processors\*" File /r "D:\DEKSTOP_WIN\WP\Normal WP\Processors\*" DetailPrint "Installing product..." !insertmacro FixTransparentText DetailPrint "Hello1" ; !insertmacro FixTransparentText !insertmacro FixTransparentText DetailPrint "Hello222222" Sleep 2000 ; !insertmacro FixTransparentText !insertmacro FixTransparentText Sleep 1000 DetailPrint "Hello3" !insertmacro FixTransparentText Sleep 4000 DetailPrint "Hello4" DetailPrint Hello Sleep 1 SectionEnd Section "-LastSectionToFixRedrawBug" SetCtlColors $0 ${TEXTCOLOR} transparent !insertmacro PageInit !insertmacro MUI_HEADER_TEXT "" "" !insertmacro FixTransparentText SectionEnd