最新消息:

NSIS 窗体顶置

nsis 永恒心锁 1130浏览 0评论
主要部分:
!define HWND_TOPMOST -1
!define SWP_NOSIZE 1
!define SWP_NOMOVE 2
System::Call "user32::SetWindowPos(i $HWNDPARENT, i ${HWND_TOPMOST}, i0, i0, i0, i0, i ${SWP_NOSIZE}|${SWP_NOMOVE})"


--------------------------------------------------------------------------------


详细用法:

;NSIS Modern User Interface
;Multilingual Example Script
;Written by Joost Verburg
!define HWND_TOPMOST -1
!define SWP_NOSIZE 1
!define SWP_NOMOVE 2

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "Modern UI Test"
OutFile "MultiLanguage.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\Modern UI Test"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Modern UI Test" ""

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Language Selection Dialog Settings

;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

;--------------------------------
;Pages

!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeMainFont
!insertmacro MUI_PAGE_LICENSE $(MUILicense)
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont2
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English" # first language is the default language
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"

;--------------------------------
;License Language String

LicenseLangString MUILicense ${LANG_ENGLISH} "${NSISDIR}\Docs\Modern UI\License.txt"
LicenseLangString MUILicense ${LANG_SIMPCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"
LicenseLangString MUILicense ${LANG_TRADCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"

;--------------------------------
;Reserve Files

;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)

!insertmacro MUI_RESERVEFILE_LANGDLL

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Installer Functions

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

;--------------------------------
;Descriptions

;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC

;Assign descriptions to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "A test section."
!insertmacro MUI_FUNCTION_DESCRIPTION_END


;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd

;--------------------------------
;Uninstaller Functions

Function un.onInit

!insertmacro MUI_UNGETLANGUAGE

FunctionEnd

Function ChangeFont
FindWindow $0 "#32770" "" $HWNDPARENT
System::Call "user32::SetWindowPos(i $HWNDPARENT, i ${HWND_TOPMOST},i0, i0, i0, i0, i ${SWP_NOSIZE}|${SWP_NOMOVE})"
FunctionEnd

Function ChangeFont2
FindWindow $5 "#32770" "" $HWNDPARENT
System::Call "user32::SetWindowPos(i $HWNDPARENT, i ${HWND_TOPMOST},i0, i0, i0, i0, i ${SWP_NOSIZE}|${SWP_NOMOVE})"
FunctionEnd

Function ChangeMainFont
FindWindow $2 "#32770" "" $HWNDPARENT
System::Call "user32::SetWindowPos(i $HWNDPARENT, i ${HWND_TOPMOST},i0, i0, i0, i0, i ${SWP_NOSIZE}|${SWP_NOMOVE})"
FunctionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NSIS 窗体顶置

您必须 登录 才能发表评论!