英文:
nsis : How to insert background picture with nsdialog or function in MUI_PAGE_INSTFILES
问题
; DIMM_V2 Easy NSIS GUI 脚本
!include MUI2.nsh
!define MUI_CUSTOMFUNCTION_GUIINIT dimm_hide
!include "page1.nsdinc"
!include "page2.nsdinc"
!include "page3.nsdinc"
!define MUI_HEADERIMAGE # 需要加载自定义 exe
!define MUI_UI_HEADERIMAGE ".\dimm_beta_img.exe" ; dimm 1018 我的 bmp 图片!
; !define MUI_UI_HEADERIMAGE ".\modern.exe" ; dimm 1018 我的 bmp 图片!
; 切换页面的 dimm 代码在各自的 .nsdinc 文件中
Page custom fnc_page1_Show
Page custom fnc_page2_Show
Page custom fnc_page3_Show
; Page custom dimm_hide
; !insertmacro MUI_PAGE_WELCOME
; !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
; BringToFront
; Destroy a window.
!macro DestroyWindow HWND IDC
GetDlgItem $R0 ${HWND} ${IDC}
System::Call `user32::DestroyWindow(i R0)`
!macroend
; 106 这一页是详细信息页面
Function dimm_hide
; dimm 隐藏 ; 需要隐藏 1256 /// 1037
!insertmacro DestroyWindow $HWNDPARENT 1045 # dimm 从底部删除一行
!insertmacro DestroyWindow $HWNDPARENT 1256 # dimm 从底部删除一行
!insertmacro DestroyWindow $HWNDPARENT 1037 # dimm 从底部删除一行
!insertmacro DestroyWindow $HWNDPARENT 1028 # dimm 从底部删除一行
FunctionEnd
Section
SectionEnd
英文:
my code is :
; DIMM_V2 Easy NSIS GUI Script
!include MUI2.nsh
!define MUI_CUSTOMFUNCTION_GUIINIT dimm_hide
!include "page1.nsdinc"
!include "page2.nsdinc"
!include "page3.nsdinc"
!define MUI_HEADERIMAGE # need to load custom exe
!define MUI_UI_HEADERIMAGE ".\dimm_beta_img.exe" ; dimm 1018 my bmp image !
; !define MUI_UI_HEADERIMAGE ".\modern.exe" ; dimm 1018 my bmp image !
; dimm code for switching pages is is inside of pages .nsdinc
Page custom fnc_page1_Show
Page custom fnc_page2_Show
Page custom fnc_page3_Show
; Page custom dimm_hide
; !insertmacro MUI_PAGE_WELCOME
; !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
; BringToFront
; Destroy a window.
!macro DestroyWindow HWND IDC
GetDlgItem $R0 ${HWND} ${IDC}
System::Call `user32::DestroyWindow(i R0)`
!macroend
; 106 this page is Details Page
Function dimm_hide
; dimm hide ; need to hide 1256 /// 1037
!insertmacro DestroyWindow $HWNDPARENT 1045 # dimm remove line from bottom
!insertmacro DestroyWindow $HWNDPARENT 1256 # dimm remove line from bottom
!insertmacro DestroyWindow $HWNDPARENT 1037 # dimm remove line from bottom
!insertmacro DestroyWindow $HWNDPARENT 1028 # dimm remove line from bottom
FunctionEnd
Section
SectionEnd
Working with the NSIS installer and i want to set a static background image on the MUI_PAGE_INSTFILES page "MUI_PAGE_INSTFILES "
thx for any help.
*edit - my others pages are already full bg image, so i want to keep the same designt.
edit 2 : in this example it is green but it using "commctrl.nsh"
and so i dont know how to build all toghether .
code :
!include "MUI2.nsh"
!include "..\CommCtrl.nsh"
Caption "List View"
OutFile example1.exe
Page custom CreatePage
!insertmacro MUI_LANGUAGE "English"
Section Install
SectionEnd
Function CreatePage
!insertmacro MUI_HEADER_TEXT "List view control" "A SysListView32 control created by nsDialogs plugin"
nsDialogs::Create 1018
Pop $0
StrCmp $0 error 0 +2
Abort
${NSD_CreateListView} 0u 0u 300u 120u "ListView"
Pop $1
SendMessage $1 ${LVM_SETBKCOLOR} 0 0xC7EDCC # green bg for details page
; Insert a new item ${NSD_LV_InsertItem} "hWnd" "iItem" "szText"
${NSD_LV_InsertItem} $1 0 "Item 0"
${NSD_LV_InsertItem} $1 1 "Item 1"
nsDialogs::Show
FunctionEnd
答案1
得分: 2
以下是翻译好的部分:
nsDialogs
控件无法在其他页面上使用,但可以使用图像宏:
nsDialogs
控件不能在其他页面上使用,但可以使用图像宏:
NSIS从未被设计用于支持完整的背景图像。最好的选择可能是使用 Graphical Installer,但也可以自己进行一些修改:
NSIS从未被设计用于支持完整的背景图像。最好的选择可能是使用 Graphical Installer,但也可以自己进行一些修改:
Function GuiInit
GetDlgItem $0 $HWNDPARENT 0x4E8
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x404
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40b
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40c
ShowWindow $0 0
ShowWindow $mui.Header.Background 0
ShowWindow $mui.Header.Image 0
StrCpy $1 $HWNDPARENT
System::Call 'USER32::GetClientRect(pr1, @r2)'
System::Call '*$2(i.r6,i.r7,i.r3,i.r4)'
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\ifp.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
LoadAndSetImage /STRINGID /RESIZETOFIT $5 0 0x10 "$Pluginsdir\ifp.bmp" $6
!if ${BGCOLOR} == Transparent
${NSD_AddExStyle} $mui.Header.Text ${WS_EX_TRANSPARENT}
${NSD_AddExStyle} $mui.Header.SubText ${WS_EX_TRANSPARENT}
!endif
FunctionEnd
Function GuiInit
GetDlgItem $0 $HWNDPARENT 0x4E8
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x404
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40b
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40c
ShowWindow $0 0
ShowWindow $mui.Header.Background 0
ShowWindow $mui.Header.Image 0
StrCpy $1 $HWNDPARENT
System::Call 'USER32::GetClientRect(pr1, @r2)'
System::Call '*$2(i.r6,i.r7,i.r3,i.r4)'
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\ifp.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
LoadAndSetImage /STRINGID /RESIZETOFIT $5 0 0x10 "$Pluginsdir\ifp.bmp" $6
!if ${BGCOLOR} == Transparent
${NSD_AddExStyle} $mui.Header.Text ${WS_EX_TRANSPARENT}
${NSD_AddExStyle} $mui.Header.SubText ${WS_EX_TRANSPARENT}
!endif
FunctionEnd
Function 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
FunctionEnd
Function 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
FunctionEnd
Function fnc_page1_Create
nsDialogs::Create 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $0
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateText} 0 13u 100% 30u "Type something here..."
Pop $0
!insertmacro MUI_HEADER_TEXT "Blah" "Blah blah blah"
!insertmacro PageInit
nsDialogs::Show
FunctionEnd
Function fnc_page1_Create
nsDialogs::Create 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $0
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateText} 0 13u 100% 30u "Type something here..."
Pop $0
!insertmacro MUI_HEADER_TEXT "Blah" "Blah blah blah"
!insertmacro PageInit
nsDialogs::Show
FunctionEnd
Function ConfigureInstFilesPage
!insertmacro PageInit
SetCtlColors $mui.InstFilesPage.Text ${TEXTCOLOR} ${BGCOLOR}
FunctionEnd
Function ConfigureInstFilesPage
!insertmacro PageInit
SetCtlColors $mui.InstFilesPage.Text ${TEXTCOLOR} ${BGCOLOR}
FunctionEnd
Section
DetailPrint Hello
Sleep 1234
SectionEnd
Section
DetailPrint Hello
Sleep 1234
SectionEnd
Section "-LastSectionToFixRedrawBug"
!insertmacro MUI_HEADER_TEXT "" ""
!insertmacro FixTransparentText
SectionEnd
Section "-LastSectionToFixRedrawBug"
!insertmacro MUI_HEADER_TEXT "" ""
!insertmacro FixTransparentText
SectionEnd
<details>
<summary>英文:</summary>
You can't use nsDialogs controls on other pages but you can use the image macros:
RequestExecutionLevel User
!include "MUI2.nsh"
!include "WinMessages.nsh"
!include "nsDialogs.nsh"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ConfigureInstFilesPage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function ConfigureInstFilesPage
FindWindow $1 "#32770" "" $HWNDPARENT ; Inner dialog
System::Call 'USER32::GetClientRect(pr1, @r2)'
System::Call '*$2(i.r6,i.r7,i.r3,i.r4)'
; Tweak $6, $7, $3 and $4 with IntOp and remove ${SS_CENTERIMAGE} if desired
System::Call 'USER32::CreateWindowEx(i0, t"STATIC", p0, i ${WS_CHILD}|${WS_VISIBLE}|${SS_BITMAP}|${SS_CENTERIMAGE}, ir6, ir7, ir3, ir4, pr1, p0, p0, p0)p.r5'
File "/OName=$Pluginsdir\ifp.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
${NSD_SetBitmap} $5 "$Pluginsdir\ifp.bmp" $6
FunctionEnd
Section
Sleep 1234
SectionEnd
NSIS was never designed to support full background images. The best option is probably to use [Graphical Installer][1] but it is possible to hack something up yourself:
RequestExecutionLevel User
!include "MUI2.nsh"
!include "WinMessages.nsh"
!include "nsDialogs.nsh"
#!define MUI_HEADER_TRANSPARENT_TEXT ; Set this if you don't want header text
!define MUI_TEXTCOLOR 000066
!define MUI_BGCOLOR 667788
!define TEXTCOLOR 0x${MUI_TEXTCOLOR}
#!define BGCOLOR "0x${MUI_BGCOLOR}"
!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
Page custom fnc_page1_Create
!insertmacro MUI_PAGE_INSTFILES
Page custom fnc_page1_Create
!insertmacro MUI_LANGUAGE "English"
BrandingText " "
Function GuiInit
GetDlgItem $0 $HWNDPARENT 0x4E8
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x404
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40b
ShowWindow $0 0
GetDlgItem $0 $HWNDPARENT 0x40c
ShowWindow $0 0
ShowWindow $mui.Header.Background 0
ShowWindow $mui.Header.Image 0
StrCpy $1 $HWNDPARENT
System::Call 'USER32::GetClientRect(pr1, @r2)'
System::Call '*$2(i.r6,i.r7,i.r3,i.r4)'
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\ifp.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
LoadAndSetImage /STRINGID /RESIZETOFIT $5 0 0x10 "$Pluginsdir\ifp.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 fnc_page1_Create
nsDialogs::Create 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $0
SetCtlColors $0 ${TEXTCOLOR} transparent
${NSD_CreateText} 0 13u 100% 30u "Type something here..."
Pop $0
!insertmacro MUI_HEADER_TEXT "Blah" "Blah blah blah"
!insertmacro PageInit
nsDialogs::Show
FunctionEnd
Function ConfigureInstFilesPage
!insertmacro PageInit
SetCtlColors $mui.InstFilesPage.Text ${TEXTCOLOR} ${BGCOLOR}
FunctionEnd
Section
DetailPrint Hello
Sleep 1234
SectionEnd
Section "-LastSectionToFixRedrawBug"
!insertmacro MUI_HEADER_TEXT "" ""
!insertmacro FixTransparentText
SectionEnd
[1]: http://graphical-installer.com/web/
</details>
# 答案2
**得分**: 0
以下是您要翻译的代码部分:
```nsis
;working example 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 available
!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
请注意,这部分代码是一段NSIS脚本,用于创建一个安装程序,并在"Directory Page"上实现完全透明的背景效果。如果您需要进一步的解释或有其他问题,请随时提出。
英文:
Working examle for "Directory Page" Full Transparent
;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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论