📄 utilw32.tcl
字号:
# PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP subKey# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP key# key name; eg "Uninstall", "TornadoV2.0"# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regKeyCreateLog {rootKey subKey key {log true}} { global setupVals lappend setupVals(commandQueue) \ [list regKeyCreateLogHelper $rootKey $subKey $key $log]}############################################################################### regKeyCreateLogHelper - helper procedure to create registry key and# save the actions## This procedure is a helper procedure to create registry key and save the# actions## SYNOPSIS# .tS# regKeyCreateLogHelper <rootKey> <subKey> <key> [log]# .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP subKey# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP key# key name; eg "Uninstall", "TornadoV2.0"# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regKeyCreateLogHelper {rootKey subKey key log} { if {[catch {setupRegKeyExists $rootKey "$subKey\\$key"} error] && ![catch {sysRegistryKeyCreate $rootKey $subKey $key} error] && "$log" == "true"} { uninstLog resource "regkey\t$rootKey\t$subKey\\$key" }}############################################################################### regValueExists - test if registry key exists## This procedure will test if registry key exists## SYNOPSIS# .tS# regValueExists <rootKey> <subKey> <value># .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP subKey# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP key# key name; eg "Uninstall", "TornadoV2.0"## RETURNS: retVal - 0 -- registry key does not exist# - 1 -- registry key exists## ERRORS: N/A#proc regValueExists {rootKey subKey value} { set retVal 0 if {[lsearch [setupRegValueEnum $rootKey $subKey] $value] != -1} { set retVal 1 } return $retVal}############################################################################### regValueWriteLog - write registry key to the Windows registry and save# the actions for uninstall use later## This procedure will write registry key to the Windows registry and save# the actions for uninstall use later## SYNOPSIS# .tS# regValueWriteLog <rootKey> <key> <valueName> <value> [log]# .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP key# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP valueName# key name; eg "Uninstall", "TornadoV2.0"# .IP value# value associated with the key# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regValueWriteLog {rootKey key valueName value {log true}} { global setupVals lappend setupVals(commandQueue) \ [list regValueWriteLogHelper $rootKey $key $valueName $value $log]}############################################################################### regValueWriteLogHelper - helper procedure to regValueWriteLog## This procedure is a helper procedure to regValueWriteLog## SYNOPSIS# .tS# regValueWriteLogHelper <rootKey> <key> <valueName> <value> [log]# .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP key# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP valueName# key name; eg "Uninstall", "TornadoV2.0"# .IP value# value associated with the key# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regValueWriteLogHelper {rootKey key valueName value log} { if {[catch {sysRegistryValueWrite $rootKey $key $valueName $value} error]} { puts "error when writing value $valueName: $error" } elseif {"$log" == "true" && ![regValueExists $rootKey $key $valueName]} { uninstLog resource "regValue\t$rootKey\t$key\t$valueName" }}############################################################################### regIntValueWriteLog - write registry key to the Windows registry and save# the actions for uninstall use later## This procedure will write registry key to the Windows registry and save# the actions for uninstall use later. Value is an integer. ## SYNOPSIS# .tS# regIntValueWriteLog <rootKey> <key> <valueName> <value> [log]# .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP key# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP valueName# key name; eg "Uninstall", "TornadoV2.0"# .IP value# value associated with the key# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regIntValueWriteLog {rootKey key valueName value {log true}} { global setupVals lappend setupVals(commandQueue) \ [list regIntValueWriteLogHelper $rootKey $key $valueName $value $log]}############################################################################### regIntValueWriteLogHelper - helper procedure to regIntValueWriteLog## This procedure is a helper procedure to regIntValueWriteLog## SYNOPSIS# .tS# regIntValueWriteLogHelper <rootKey> <key> <valueName> <value> [log]# .tE## PARAMETERS:# .IP rootKey# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE# .IP key# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion# .IP valueName# key name; eg "Uninstall", "TornadoV2.0"# .IP value# value associated with the key# .IP log# true -- log the actions (default)# false -- do not log the actions## RETURNS: N/A## ERRORS: N/A#proc regIntValueWriteLogHelper {rootKey key valueName value log} { if {[catch {sysRegistryValueWrite -int $rootKey $key $valueName $value} error]} { puts "error when writing value $valueName: $error" } elseif {"$log" == "true" && ![regValueExists $rootKey $key $valueName]} { uninstLog resource "regValue\t$rootKey\t$key\t$valueName" }}############################################################################### queueExecute - execute commands in the queue## This procedure will execute commands in the queue. The purpose is to store# a list of commands in case if users decide to exit the setup program, these# commands can all be executed at once.## SYNOPSIS# .tS# queueExecute# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc queueExecute {} { global setupVals foreach command $setupVals(commandQueue) { eval $command } # reset the list set setupVals(commandQueue) ""}############################################################################### windRegValueRead - load WIND_REGISTRY registry value from the previous# installation if any## This procedure will load WIND_REGISTRY registry value from the previous# installation if any## SYNOPSIS# .tS# windRegValueRead# .tE## PARAMETERS: N/A## RETURNS: WIND_REGISTRY value## ERRORS: N/A#proc windRegValueRead {} { global setupVals global ctrlVals # Load WIND_REGISTRY from the previous installation if any if ![info exists setupVals(registry)] { set setupVals(registry) "" if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)\\$setupVals(prodRegEntry)" \ WIND_REGISTRY} retVal]} { set setupVals(registry) $retVal } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \ "SOFTWARE\\$setupVals(WRS)\\$setupVals(prodRegEntry)" \ WIND_REGISTRY} retVal]} { set setupVals(registry) $retVal } } return $setupVals(registry)}############################################################################### dlgFrmCreate - create wizard page## This procedure will create wizard page## SYNOPSIS# .tS# dlgFrmCreate <title># .tE## PARAMETERS:# .IP title# name of the wizard page## RETURNS: N/A## ERRORS: N/A#proc dlgFrmCreate {title} { global ctrlVals global setupVals global env if {[removeBackground]} { set title "$title" } if {[windHostTypeGet]=="x86-win32"} { set backButtXPos 147 set helpButtXPos 87 } else { set backButtXPos 143 set helpButtXPos 83 } if {[windowExists $ctrlVals(mainWindow)] != 1 } { set controls [list \ [list bitmap -name bitmap \ -title $ctrlVals(dlgImage) -stretch \ -x 10 -y 10 -w 80 -h 160] \ [list frame -gray -name frm2 -x 10 -y 178 -w 295 -h 2] \ [list button -name backButt -title "< &Back" \ -callback backCallback \ -disable -x $backButtXPos -y 185 -w 50 -h 14] \ [list button -name nextButt -title "&Next >" \ -default -callback nextCallback \ -x 197 -y 185 -w 50 -h 14] \ [list button -name cancelButt -title "&Cancel" \ -callback quitCallback \ -x 255 -y 185 -w 50 -h 14] \ [list button -name helpButt -title "&Help" \ -callback helpCallback \ -x $helpButtXPos -y 185 -w 50 -h 14] \ ] if {[removeBackground] && ![info exists env(SETUP_USEKDE)]} { # add a minimize box to the dialog form since # there is no background to minimize. # create the dialog with initial size of 1 1, then # resize and reposition the dialog after. This is # to workaround a UITclSh bug which does not allow # the window to shrink below its original size for # the billboard dialogs. dialogCreate -name $ctrlVals(mainWindow) \ -title $title -w 315 -h 204 \ -nocontexthelp \ -parent $ctrlVals(parentDialog) \ -modeless \ -controls $controls windowSizeSet $ctrlVals(mainWindow) 315 204 } elseif {[removeBackground] && [info exists env(SETUP_USEKDE)]} { # Sizing and positioning a window causes # KDE to crash. Initialize window for KDE at # full size, and later keep the same size # in the file copying billboard page. dialogCreate -name $ctrlVals(mainWindow) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -