merged from work
This commit is contained in:
47
KattekerCreator/nsis/Examples/nsDialogs/InstallOptions.nsi
Normal file
47
KattekerCreator/nsis/Examples/nsDialogs/InstallOptions.nsi
Normal file
@ -0,0 +1,47 @@
|
||||
!include LogicLib.nsh
|
||||
!include WinMessages.nsh
|
||||
|
||||
Name "nsDialogs IO"
|
||||
OutFile "nsDialogs IO.exe"
|
||||
|
||||
Page custom nsDialogsIO UpdateINIState
|
||||
Page instfiles
|
||||
|
||||
XPStyle on
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
!include nsDialogs.nsh
|
||||
!insertmacro NSD_FUNCTION_INIFILE
|
||||
|
||||
Function nsDialogsIO
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\io.ini "..\InstallOptions\test.ini"
|
||||
|
||||
${If} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Test the right-to-left version?" IDYES`
|
||||
WriteINIStr $PLUGINSDIR\io.ini Settings RTL 1
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 $PLUGINSDIR\io.ini
|
||||
|
||||
Call CreateDialogFromINI
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 2" "State"
|
||||
DetailPrint "Install X=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 3" "State"
|
||||
DetailPrint "Install Y=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 4" "State"
|
||||
DetailPrint "Install Z=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 5" "State"
|
||||
DetailPrint "File=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 6" "State"
|
||||
DetailPrint "Dir=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 8" "State"
|
||||
DetailPrint "Info=$0"
|
||||
|
||||
SectionEnd
|
220
KattekerCreator/nsis/Examples/nsDialogs/example.nsi
Normal file
220
KattekerCreator/nsis/Examples/nsDialogs/example.nsi
Normal file
@ -0,0 +1,220 @@
|
||||
!include nsDialogs.nsh
|
||||
!include LogicLib.nsh
|
||||
!include WinCore.nsh ; MAKELONG
|
||||
|
||||
Name "nsDialogs Example"
|
||||
OutFile "nsDialogs Example.exe"
|
||||
Caption "$(^Name)"
|
||||
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
LicenseText "All the action takes place on the next page..." "Start"
|
||||
SubCaption 0 ": Ready?"
|
||||
|
||||
Page license
|
||||
Page custom nsDialogsPage
|
||||
Page custom LBPage
|
||||
Page custom RangesPage
|
||||
Page custom NotifyPage
|
||||
!pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!"
|
||||
|
||||
Var BUTTON
|
||||
Var EDIT
|
||||
Var CHECKBOX
|
||||
|
||||
Function nsDialogsPage
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
|
||||
GetFunctionAddress $0 OnBack
|
||||
nsDialogs::OnBack $0
|
||||
|
||||
${NSD_CreateButton} 0 0 100% 12u Test
|
||||
Pop $BUTTON
|
||||
GetFunctionAddress $0 OnClick
|
||||
nsDialogs::OnClick $BUTTON $0
|
||||
|
||||
${NSD_CreateText} 0 35 100% 12u hello
|
||||
Pop $EDIT
|
||||
GetFunctionAddress $0 OnChange
|
||||
nsDialogs::OnChange $EDIT $0
|
||||
${NSD_Edit_SetCueBannerText} $EDIT 0 "Type 'hello there' and get a free surprise"
|
||||
|
||||
${NSD_CreateCheckbox} 0 -50 100% 8u Test
|
||||
Pop $CHECKBOX
|
||||
GetFunctionAddress $0 OnCheckbox
|
||||
nsDialogs::OnClick $CHECKBOX $0
|
||||
|
||||
${NSD_CreateLabel} 0 40u 75% 40u "* Type `hello there` above.$\n* Click the button.$\n* Check the checkbox.$\n* Hit the Back button."
|
||||
Pop $0
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick
|
||||
Pop $0 # HWND
|
||||
MessageBox MB_OK clicky
|
||||
FunctionEnd
|
||||
|
||||
Function OnChange
|
||||
Pop $0 # HWND
|
||||
|
||||
System::Call user32::GetWindowText(p$EDIT,t.r0,i${NSIS_MAX_STRLEN})
|
||||
${If} $0 == "hello there"
|
||||
MessageBox MB_OK "right back at ya"
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function OnBack
|
||||
MessageBox MB_YESNO "are you sure?" IDYES +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Function OnCheckbox
|
||||
Pop $0 # HWND
|
||||
MessageBox MB_OK "checkbox clicked"
|
||||
FunctionEnd
|
||||
|
||||
!macro BeginControlsTestPage title
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
${NSD_SetText} $hWndParent "$(^Name): ${title}"
|
||||
!macroend
|
||||
|
||||
!macro CreateButton x y w h txt var handler data
|
||||
${NSD_CreateButton} ${x} ${y} ${w} ${h} "${txt}"
|
||||
Pop ${var}
|
||||
nsDialogs::SetUserData ${var} ${data}
|
||||
${NSD_OnClick} ${var} ${handler}
|
||||
!macroend
|
||||
|
||||
|
||||
Function LBPage
|
||||
!insertmacro BeginControlsTestPage "ListBox"
|
||||
|
||||
${NSD_CreateSortedListBox} 1u 0 -2u 70u ""
|
||||
Pop $1
|
||||
${NSD_LB_AddString} $1 "Foo"
|
||||
${NSD_LB_AddString} $1 "Bar"
|
||||
|
||||
StrCpy $9 1
|
||||
${NSD_CreateText} 1u 75u -2u 12u "New item #$9"
|
||||
Pop $EDIT
|
||||
!insertmacro CreateButton 1u 90u 50u 12u "Add (&Sorted)" $0 LBAction Add
|
||||
!insertmacro CreateButton 53u 90u 50u 12u "&Prepend" $0 LBAction Prepend
|
||||
!insertmacro CreateButton 105u 90u 50u 12u "&Append" $0 LBAction Append
|
||||
!insertmacro CreateButton 160u 90u 50u 12u "&Delete Last" $0 LBAction DL
|
||||
!insertmacro CreateButton 215u 90u 50u 12u "&Clear" $0 LBAction Clear
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function LBAction
|
||||
Pop $0
|
||||
nsDialogs::GetUserData $0
|
||||
Pop $0
|
||||
${NSD_GetText} $EDIT $8
|
||||
|
||||
${Select} $0
|
||||
${Case} "Add"
|
||||
${NSD_LB_AddString} $1 $8
|
||||
${Case} "Prepend"
|
||||
${NSD_LB_PrependString} $1 $8
|
||||
${Case} "Append"
|
||||
${NSD_LB_AppendString} $1 $8
|
||||
${Case} "DL"
|
||||
${NSD_LB_GetCount} $1 $8
|
||||
${If} $8 U> 0
|
||||
IntOp $8 $8 - 1
|
||||
${NSD_LB_DelItem} $1 $8
|
||||
${EndIf}
|
||||
Return
|
||||
${Case} "Clear"
|
||||
${NSD_LB_Clear} $1
|
||||
Return
|
||||
${EndSelect}
|
||||
|
||||
IntOp $9 $9 + 1
|
||||
${NSD_SetText} $EDIT "New item #$9"
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function RangesPage
|
||||
!insertmacro BeginControlsTestPage "Ranges"
|
||||
|
||||
${NSD_CreateHTrackBar} 1 0 -2 20u ""
|
||||
Pop $1
|
||||
${NSD_TrackBar_SetRangeMax} $1 10
|
||||
${NSD_TrackBar_SetTicFreq} $1 1
|
||||
${NSD_TrackBar_SetPos} $1 3
|
||||
|
||||
StrCpy $9 20 ; Progress pos
|
||||
${NSD_CreateProgressBar} 1 25u -2 8u ""
|
||||
Pop $2
|
||||
${NSD_CreateTimer} RangesTimer 1000
|
||||
|
||||
${NSD_CreateNumber} 1 40u 50u 12u "42"
|
||||
Pop $3
|
||||
${NSD_CreateUpDown} 0 0 0 0 ""
|
||||
Pop $4
|
||||
${NSD_UD_SetBuddy} $4 $3
|
||||
${MAKELONG} $5 $0 50 0 ; 0..50
|
||||
${NSD_UD_SetPackedRange} $4 $5
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function RangesTimer
|
||||
IntOp $9 $9 + 5
|
||||
${IfThen} $9 > 100 ${|} StrCpy $9 0 ${|}
|
||||
${NSD_ProgressBar_SetPos} $2 $9
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function NotifyPage
|
||||
!insertmacro BeginControlsTestPage "WM_NOTIFY"
|
||||
|
||||
${NSD_CreateRichEdit} 1 1 -2 -2 ""
|
||||
Pop $9
|
||||
${NSD_OnNotify} $9 OnNotify
|
||||
IntOp $8 ${ENM_LINK} | ${ENM_KEYEVENTS}
|
||||
${NSD_RichEd_SetEventMask} $9 $8
|
||||
SendMessage $9 ${EM_AUTOURLDETECT} 1 0
|
||||
${NSD_SetText} $9 "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard http://nsis.sf.net\par {\b Click the link!}\par\par Type something and I will block every other character...}"
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnNotify
|
||||
Pop $1 ; HWND
|
||||
Pop $2 ; Code
|
||||
Pop $3 ; NMHDR*
|
||||
${If} $2 = ${EN_LINK}
|
||||
System::Call '*$3(p,p,p,p.r2,p,p,i.r4,i.r5)' ; Extract from ENLINK*
|
||||
${IfThen} $2 <> ${WM_LBUTTONDOWN} ${|} Return ${|}
|
||||
IntOp $2 $5 - $4
|
||||
System::Call '*(ir4,ir5,l,&t$2,i)p.r2' ; Create TEXTRANGE and a text buffer
|
||||
${If} $2 P<> 0
|
||||
IntPtrOp $3 $2 + 16 ; Find buffer
|
||||
System::Call '*$2(i,i,p$3)' ; Set buffer in TEXTRANGE
|
||||
SendMessage $1 ${EM_GETTEXTRANGE} "" $2 $4
|
||||
${If} $4 <> 0
|
||||
System::Call 'SHELL32::ShellExecute(p$hWndParent, p0, pr3, p0, p0, i 1)'
|
||||
${EndIf}
|
||||
System::Free $2
|
||||
${EndIf}
|
||||
${ElseIf} $2 = ${EN_MSGFILTER}
|
||||
Var /Global Toggle
|
||||
System::Call '*$3(p,i,i,i.r4)' ; MSGFILTER->msg
|
||||
${If} $4 = ${WM_CHAR}
|
||||
IntOp $Toggle $Toggle ^ 1
|
||||
${If} $Toggle & 1
|
||||
${NSD_Return} 1
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
107
KattekerCreator/nsis/Examples/nsDialogs/timer.nsi
Normal file
107
KattekerCreator/nsis/Examples/nsDialogs/timer.nsi
Normal file
@ -0,0 +1,107 @@
|
||||
!include LogicLib.nsh
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
|
||||
Name "nsDialogs Timer Example"
|
||||
OutFile "nsDialogs Timer Example.exe"
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var DIALOG
|
||||
Var TEXT
|
||||
Var PROGBAR
|
||||
Var PROGBAR2
|
||||
Var PROGBAR3
|
||||
Var BUTTON
|
||||
Var BUTTON2
|
||||
|
||||
Page custom nsDialogsPage
|
||||
!pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!"
|
||||
|
||||
Function OnTimer
|
||||
|
||||
SendMessage $PROGBAR ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 = 100
|
||||
SendMessage $PROGBAR ${PBM_SETPOS} 0 0
|
||||
${Else}
|
||||
SendMessage $PROGBAR ${PBM_DELTAPOS} 10 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer2
|
||||
|
||||
SendMessage $PROGBAR2 ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 = 100
|
||||
SendMessage $PROGBAR2 ${PBM_SETPOS} 0 0
|
||||
${Else}
|
||||
SendMessage $PROGBAR2 ${PBM_DELTAPOS} 5 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer3
|
||||
|
||||
SendMessage $PROGBAR3 ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 >= 100
|
||||
${NSD_KillTimer} OnTimer3
|
||||
MessageBox MB_OK "Timer 3 killed"
|
||||
${Else}
|
||||
SendMessage $PROGBAR3 ${PBM_DELTAPOS} 2 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick
|
||||
|
||||
Pop $0
|
||||
|
||||
${NSD_KillTimer} OnTimer
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick2
|
||||
|
||||
Pop $0
|
||||
|
||||
${NSD_KillTimer} OnTimer2
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function nsDialogsPage
|
||||
|
||||
nsDialogs::Create 1018
|
||||
Pop $DIALOG
|
||||
|
||||
${NSD_CreateLabel} 0u 0u 100% 9u "nsDialogs timer example"
|
||||
Pop $TEXT
|
||||
|
||||
${NSD_CreateProgressBar} 0u 10u 100% 12u ""
|
||||
Pop $PROGBAR
|
||||
|
||||
${NSD_CreateButton} 0u 25u 100u 14u "Kill Timer 1"
|
||||
Pop $BUTTON
|
||||
${NSD_OnClick} $BUTTON OnClick
|
||||
|
||||
${NSD_CreateProgressBar} 0u 52u 100% 12u ""
|
||||
Pop $PROGBAR2
|
||||
SendMessage $PROGBAR2 ${PBM_SETBARCOLOR} 0 0x0000FF ; No visual styles
|
||||
SendMessage $PROGBAR2 ${PBM_SETSTATE} ${PBST_ERROR} 0 ; Vista+
|
||||
|
||||
${NSD_CreateButton} 0u 67u 100u 14u "Kill Timer 2"
|
||||
Pop $BUTTON2
|
||||
${NSD_OnClick} $BUTTON2 OnClick2
|
||||
|
||||
${NSD_CreateProgressBar} 0u 114u 100% 12u ""
|
||||
Pop $PROGBAR3
|
||||
|
||||
${NSD_CreateTimer} OnTimer 1000
|
||||
${NSD_CreateTimer} OnTimer2 100
|
||||
${NSD_CreateTimer} OnTimer3 200
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
214
KattekerCreator/nsis/Examples/nsDialogs/welcome.nsi
Normal file
214
KattekerCreator/nsis/Examples/nsDialogs/welcome.nsi
Normal file
@ -0,0 +1,214 @@
|
||||
!include MUI.nsh
|
||||
!include LogicLib.nsh
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
!include FileFunc.nsh
|
||||
|
||||
Name "nsDialogs Welcome"
|
||||
OutFile "nsDialogs Welcome.exe"
|
||||
|
||||
Page custom nsDialogsWelcome
|
||||
Page custom nsDialogsDirectory
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
|
||||
Var DIALOG
|
||||
Var HEADLINE
|
||||
Var TEXT
|
||||
Var IMAGECTL
|
||||
Var IMAGE
|
||||
Var DIRECTORY
|
||||
Var FREESPACE
|
||||
|
||||
Var HEADLINE_FONT
|
||||
|
||||
Function .onInit
|
||||
|
||||
CreateFont $HEADLINE_FONT "$(^Font)" "14" "700"
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\welcome.bmp "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function HideControls
|
||||
|
||||
LockWindow on
|
||||
GetDlgItem $0 $HWNDPARENT 1028
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1256
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1035
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1037
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1038
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1039
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1045
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
LockWindow off
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function ShowControls
|
||||
|
||||
LockWindow on
|
||||
GetDlgItem $0 $HWNDPARENT 1028
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1256
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1035
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1037
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1038
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1039
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1045
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
LockWindow off
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function nsDialogsWelcome
|
||||
|
||||
nsDialogs::Create 1044
|
||||
Pop $DIALOG
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u ""
|
||||
Pop $IMAGECTL
|
||||
|
||||
StrCpy $0 $PLUGINSDIR\welcome.bmp
|
||||
System::Call 'user32::LoadImage(p 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE})p.s'
|
||||
Pop $IMAGE
|
||||
|
||||
SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Welcome to nsDialogs!"
|
||||
Pop $HEADLINE
|
||||
|
||||
SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "nsDialogs is the next generation of user interfaces in NSIS. It gives the developer full control over custom pages. Some of the features include control text containing variables, callbacks directly into script functions and creation of any type of control. Create boring old edit boxes or load some external library and create custom controls with no need of creating your own plug-in.$\r$\n$\r$\nUnlike InstallOptions, nsDialogs doesn't use INI files to communicate with the script. By interacting directly with the script, nsDialogs can perform much faster without the need of costly, old and inefficient INI operations. Direct interaction also allows direct calls to functions defined in the script and removes the need of conversion functions like Io2Nsis.$\r$\n$\r$\nHit the Next button to see how it all fits into a mock directory page."
|
||||
Pop $TEXT
|
||||
|
||||
SetCtlColors $DIALOG 0 0xffffff
|
||||
SetCtlColors $HEADLINE 0 0xffffff
|
||||
SetCtlColors $TEXT 0 0xffffff
|
||||
|
||||
Call HideControls
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
Call ShowControls
|
||||
|
||||
System::Call gdi32::DeleteObject(p$IMAGE)
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!define SHACF_FILESYSTEM 1
|
||||
|
||||
Function nsDialogsDirectory
|
||||
|
||||
!insertmacro MUI_HEADER_TEXT "Choose Install Location" "Choose the folder in which to install $(^NameDA)."
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1
|
||||
EnableWindow $0 0
|
||||
|
||||
nsDialogs::Create 1018
|
||||
Pop $DIALOG
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_CENTER} 0 0 0 100% 30 "Directory page"
|
||||
Pop $HEADLINE
|
||||
|
||||
SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 30 100% 40 "Select the installation directory of NSIS to continue. $_CLICK"
|
||||
Pop $TEXT
|
||||
|
||||
nsDialogs::CreateControl EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u ""
|
||||
Pop $DIRECTORY
|
||||
|
||||
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $DIRECTORY 1
|
||||
|
||||
GetFunctionAddress $0 DirChange
|
||||
nsDialogs::OnChange $DIRECTORY $0
|
||||
|
||||
System::Call shlwapi::SHAutoComplete(p$DIRECTORY,i${SHACF_FILESYSTEM})
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -10u 100% 10u ""
|
||||
Pop $FREESPACE
|
||||
|
||||
Call UpdateFreeSpace
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function UpdateFreeSpace
|
||||
|
||||
${GetRoot} $INSTDIR $0
|
||||
StrCpy $1 " bytes"
|
||||
|
||||
System::Call kernel32::GetDiskFreeSpaceEx(tr0,*l,*l,*l.r0)
|
||||
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "kb"
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "mb"
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "gb"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
SendMessage $FREESPACE ${WM_SETTEXT} 0 "STR:Free space: $0$1"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function DirChange
|
||||
|
||||
Pop $0 # dir hwnd
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1
|
||||
|
||||
System::Call user32::GetWindowText(p$DIRECTORY,t.d,i${NSIS_MAX_STRLEN})
|
||||
|
||||
${If} ${FileExists} $INSTDIR\makensis.exe
|
||||
EnableWindow $0 1
|
||||
${Else}
|
||||
EnableWindow $0 0
|
||||
${EndIf}
|
||||
|
||||
Call UpdateFreeSpace
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
Reference in New Issue
Block a user