isxfunc.xml 201 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233
  1. <?xml version="1.0" standalone="yes" ?>
  2. <isxhelp version="1.0">
  3. <copyright>
  4. Inno Setup
  5. Copyright (C) 1997-2024 Jordan Russell
  6. Portions by Martijn Laan
  7. For conditions of distribution and use, see LICENSE.TXT.
  8. </copyright>
  9. <isxfunc>
  10. <category>
  11. <description>Setup or Uninstall Info</description>
  12. <subcategory>
  13. <function>
  14. <name>GetCmdTail</name>
  15. <prototype>function GetCmdTail: String;</prototype>
  16. <description><p>Returns all command line parameters passed to Setup or Uninstall as a single string, including undocumented internal parameters used by Setup and Uninstall.</p></description>
  17. <seealso><p><link topic="isxfunc_ParamStr">ParamStr</link></p></seealso>
  18. </function>
  19. <function>
  20. <name>ParamCount</name>
  21. <prototype>function ParamCount: Integer;</prototype>
  22. <description><p>Returns the number of command line parameters passed to Setup or Uninstall, excluding undocumented internal parameters used by Setup and Uninstall.</p></description>
  23. <seealso><p><link topic="isxfunc_ParamStr">ParamStr</link><br />
  24. <link topic="isxfunc_GetCmdTail">GetCmdTail</link></p></seealso>
  25. </function>
  26. <function>
  27. <name>ParamStr</name>
  28. <prototype>function ParamStr(Index: Integer): String;</prototype>
  29. <description><p>Returns the Index-th command line parameter passed to Setup or Uninstall, excluding undocumented internal parameters used by Setup and Uninstall.</p>
  30. <p>Parameter number zero is the full file name with which Setup or Uninstall was started.</p>
  31. <p>If Index is invalid, ParamStr returns an empty string.</p></description>
  32. <seealso><p><link topic="isxfunc_ParamCount">ParamCount</link><br />
  33. <link topic="isxfunc_GetCmdTail">GetCmdTail</link></p></seealso>
  34. </function>
  35. </subcategory>
  36. <subcategory>
  37. <function>
  38. <name>ActiveLanguage</name>
  39. <prototype>function ActiveLanguage: String;</prototype>
  40. <description><p>Returns the name of the active language.</p></description>
  41. </function>
  42. </subcategory>
  43. <subcategory>
  44. <function>
  45. <name>CustomMessage</name>
  46. <prototype>function CustomMessage(const MsgName: String): String;</prototype>
  47. <description><p>Returns the value of the [CustomMessages] entry with the specified name. If an entry with the specified name does not exist, an exception will be raised.</p></description>
  48. <example><pre>var
  49. S: String;
  50. begin
  51. S := CustomMessage('CreateDesktopIcon');
  52. // S = 'Create a &amp;desktop icon'
  53. S := FmtMessage(CustomMessage('NameAndVersion'), ['My Program', '1.0']);
  54. // S = 'My Program version 1.0'
  55. end;</pre></example>
  56. </function>
  57. <function>
  58. <name>FmtMessage</name>
  59. <prototype>function FmtMessage(const S: String; const Args: array of String): String;</prototype>
  60. <description><p>Formats the string S using the specified string arguments. A <tt>%1</tt> in the format string will be replaced with the first value in the Args array; a <tt>%2</tt> will be replaced with the second value; and so on. <tt>%%</tt> will be replaced with <tt>%</tt>.</p></description>
  61. <remarks><p>If a <tt>%</tt>-specifier references a non-existing argument, it will be returned untouched. No exception will be raised.</p></remarks>
  62. <example><pre>var
  63. S: String;
  64. begin
  65. S := FmtMessage('%1 version %2 will be installed.', ['My Program', '1.0']);
  66. // S = 'My Program version 1.0 will be installed.'
  67. S := FmtMessage(SetupMessage(msgNotOnThisPlatform), ['Windows 2000']);
  68. // S = 'This program will not run on Windows 2000.'
  69. end;</pre></example>
  70. </function>
  71. <function>
  72. <name>SetupMessage</name>
  73. <prototype>function SetupMessage(const ID: TSetupMessageID): String;</prototype>
  74. <description><p>Returns the value of the specified message.</p>
  75. <p>TSetupMessageID is defined as:</p>
  76. <p>'msg' + the message name. Example: <i>SetupMessage(msgSetupAppTitle)</i></p></description>
  77. <example><pre>var
  78. S: String;
  79. begin
  80. S := SetupMessage(msgButtonNext);
  81. // S now equals '&amp;Next &gt;'
  82. end;</pre></example>
  83. </function>
  84. </subcategory>
  85. <subcategory>
  86. <function>
  87. <name>WizardDirValue</name>
  88. <prototype>function WizardDirValue: String;</prototype>
  89. <description><p>Returns the current contents of the edit control on the <i>Select Destination Location</i> page of the wizard.</p>
  90. <p>Unlike <tt>ExpandConstant('{app}')</tt>, this function will not fail if called after the wizard is shown but prior to the user selecting a directory. Rather, it will return the default directory name.</p></description>
  91. </function>
  92. <function>
  93. <name>WizardGroupValue</name>
  94. <prototype>function WizardGroupValue: String;</prototype>
  95. <description><p>Returns the current contents of the edit control on the <i>Select Start Menu Folder</i> page of the wizard.</p>
  96. <p>Unlike <tt>ExpandConstant('{group}')</tt>, this function will not fail if called after the wizard is shown but prior to the user selecting a folder. Rather, it will return the default folder name.</p></description>
  97. </function>
  98. <function>
  99. <name>WizardNoIcons</name>
  100. <prototype>function WizardNoIcons: Boolean;</prototype>
  101. <description><p>Returns the current setting of the <i>Don't create a Start Menu folder</i> check box on the <i>Select Start Menu Folder</i> page of the wizard.</p></description>
  102. </function>
  103. <function>
  104. <name>WizardSetupType</name>
  105. <prototype>function WizardSetupType(const Description: Boolean): String;</prototype>
  106. <description><p>Returns the name or description of the setup type selected by the user.</p></description>
  107. </function>
  108. <function>
  109. <name>WizardSelectedComponents</name>
  110. <prototype>function WizardSelectedComponents(const Descriptions: Boolean): String;</prototype>
  111. <description><p>Returns a comma-separated list of names or descriptions of the components selected by the user.</p></description>
  112. <seealso><p><link topic="isxfunc_WizardIsComponentSelected">WizardIsComponentSelected</link><br />
  113. <link topic="isxfunc_WizardSelectComponents">WizardSelectComponents</link></p></seealso>
  114. </function>
  115. <function>
  116. <name>WizardIsComponentSelected</name>
  117. <prototype>function WizardIsComponentSelected(const Components: String): Boolean;</prototype>
  118. <description><p>Returns True if the specified component is selected. Multiple components may be specified in the same manner as in a <link topic="componentstasksparams" window="main">Components parameter</link>.</p></description>
  119. <seealso><p><link topic="isxfunc_WizardSelectedComponents">WizardSelectedComponents</link><br />
  120. <link topic="isxfunc_WizardSelectComponents">WizardSelectComponents</link></p></seealso>
  121. <example><pre>begin
  122. if WizardIsComponentSelected('helpfiles') then
  123. // the 'helpfiles' component is selected
  124. end;</pre></example>
  125. </function>
  126. <function>
  127. <name>WizardSelectComponents</name>
  128. <prototype>procedure WizardSelectComponents(const Components: String);</prototype>
  129. <description><p>Selects the specified comma separated list of component names.</p>
  130. <p>If a component name is prefixed with a "*" character, any child components will be selected as well (except for those that include the <tt>dontinheritcheck</tt> flag). If a component name is prefixed with a "!" character, the component will be deselected.</p>
  131. <p>This function does not change the state of unspecified components. This function can change the state of specified components that include the <tt>fixed</tt> flag.</p>
  132. </description>
  133. <seealso><p><link topic="isxfunc_WizardSelectedComponents">WizardSelectedComponents</link><br />
  134. <link topic="isxfunc_WizardIsComponentSelected">WizardIsComponentSelected</link></p></seealso>
  135. <example><pre>begin
  136. WizardSelectComponents('!helpfiles');
  137. // the 'helpfiles' component is deselected
  138. end;</pre></example>
  139. </function>
  140. <function>
  141. <name>WizardSelectedTasks</name>
  142. <prototype>function WizardSelectedTasks(const Descriptions: Boolean): String;</prototype>
  143. <description><p>Returns a comma-separated list of names or descriptions of the tasks selected by the user.</p></description>
  144. <seealso><p><link topic="isxfunc_WizardIsTaskSelected">WizardIsTaskSelected</link><br />
  145. <link topic="isxfunc_WizardSelectTasks">WizardSelectTasks</link></p></seealso>
  146. </function>
  147. <function>
  148. <name>WizardIsTaskSelected</name>
  149. <prototype>function WizardIsTaskSelected(const Tasks: String): Boolean;</prototype>
  150. <description><p>Returns True if the specified task is selected. Multiple tasks may be specified in the same manner as in a <link topic="componentstasksparams" window="main">Tasks parameter</link>.</p></description>
  151. <seealso><p><link topic="isxfunc_WizardSelectedTasks">WizardSelectedTasks</link><br />
  152. <link topic="isxfunc_WizardSelectTasks">WizardSelectTasks</link></p></seealso>
  153. <example><pre>begin
  154. if WizardIsTaskSelected('desktopicon') then
  155. // the 'desktopicon' task is selected
  156. end;</pre></example>
  157. </function>
  158. <function>
  159. <name>WizardSelectTasks</name>
  160. <prototype>procedure WizardSelectTasks(const Tasks: String);</prototype>
  161. <description><p>Selects the specified comma separated list of task names.</p>
  162. <p>If a task name is prefixed with a "!" character, the task will be deselected.</p>
  163. <p>This function does not change the state of unspecified tasks.</p>
  164. </description>
  165. <seealso><p><link topic="isxfunc_WizardSelectedTasks">WizardSelectedTasks</link><br />
  166. <link topic="isxfunc_WizardIsTaskSelected">WizardIsTaskSelected</link></p></seealso>
  167. <example><pre>begin
  168. WizardSelectTasks('!desktopicon');
  169. // the 'desktopicon' task is deselected
  170. end;</pre></example>
  171. </function>
  172. <function>
  173. <name>WizardSilent</name>
  174. <prototype>function WizardSilent: Boolean;</prototype>
  175. <description><p>Returns True if Setup is running silently, False otherwise.</p></description>
  176. </function>
  177. </subcategory>
  178. <subcategory>
  179. <function>
  180. <name>IsUninstaller</name>
  181. <prototype>function IsUninstaller: Boolean;</prototype>
  182. <description><p>Returns True if Uninstall is running as opposed to Setup, False otherwise.</p></description>
  183. </function>
  184. <function>
  185. <name>UninstallSilent</name>
  186. <prototype>function UninstallSilent: Boolean;</prototype>
  187. <description><p>Returns True if Uninstall is running silently, False otherwise.</p></description>
  188. </function>
  189. </subcategory>
  190. <subcategory>
  191. <function>
  192. <name>CurrentFilename</name>
  193. <prototype>function CurrentFilename: String;</prototype>
  194. <description><p>Returns the destination file name of the [Files] entry that is currently being processed. The returned name may include constants.</p>
  195. <p>Do not attempt to call this function from outside a Check, BeforeInstall or AfterInstall event function belonging to a [Files] entry.</p></description>
  196. </function>
  197. <function>
  198. <name>CurrentSourceFilename</name>
  199. <prototype>function CurrentSourceFilename: String;</prototype>
  200. <description><p>Returns the source file name of the [Files] entry that is currently being processed. The returned name may include constants.</p>
  201. <p>Do not attempt to call this function from outside a Check, BeforeInstall or AfterInstall event function belonging to a [Files] entry with the "external" flag.</p></description>
  202. </function>
  203. </subcategory>
  204. <subcategory>
  205. <function>
  206. <name>ExpandConstant</name>
  207. <prototype>function ExpandConstant(const S: String): String;</prototype>
  208. <description><p>Changes all constants in S to their values. For example, ExpandConstant('{srcexe}') is changed to the filename of Setup.</p>
  209. <p>An exception will be raised if there was an error expanding the constants.</p></description>
  210. </function>
  211. <function>
  212. <name>ExpandConstantEx</name>
  213. <prototype>function ExpandConstantEx(const S: String; const CustomConst, CustomValue: String): String;</prototype>
  214. <description><p>Changes all constants in S to their values. Additionally, any constant equal to CustomConst will be changed to CustomValue.</p>
  215. <p>An exception will be raised if there was an error expanding the constants.</p></description>
  216. </function>
  217. </subcategory>
  218. <subcategory>
  219. <function>
  220. <name>GetPreviousData</name>
  221. <prototype>function GetPreviousData(const ValueName, DefaultValueData: String): String;</prototype>
  222. <description><p>Gets a value that was previously stored using SetPreviousData.</p></description>
  223. </function>
  224. <function>
  225. <name>SetPreviousData</name>
  226. <prototype>function SetPreviousData(const PreviousDataKey: Integer; const ValueName, ValueData: String): Boolean;</prototype>
  227. <description><p>Sets a value that can be restored later using GetPreviousData. Call SetPreviousData inside a RegisterPreviousData event function, once per setting.</p></description>
  228. </function>
  229. </subcategory>
  230. <subcategory>
  231. <function>
  232. <name>Terminated</name>
  233. <prototype>function Terminated: Boolean;</prototype>
  234. <description><p>Returns True if Setup or Uninstall is terminating, False otherwise.</p></description>
  235. </function>
  236. <function>
  237. <name>Debugging</name>
  238. <prototype>function Debugging: Boolean;</prototype>
  239. <description><p>Returns True if Setup or Uninstall is being debugged by the Compiler IDE or another application, False otherwise.</p></description>
  240. <seealso><p><link topic="scriptdebug">Run-time debugger</link></p></seealso>
  241. </function>
  242. </subcategory>
  243. <subcategory>
  244. <function>
  245. <name>RegisterExtraCloseApplicationsResource</name>
  246. <prototype>function RegisterExtraCloseApplicationsResource(const DisableFsRedir: Boolean; const AFilename: String): Boolean;</prototype>
  247. <description><p>Register an extra file which Setup should check for being in-use. Call RegisterExtraCloseApplicationsResource inside a RegisterExtraCloseApplicationsResources event function, once per file. Ignores <link topic="setup_closeapplicationsfilter">CloseApplicationsFilter</link>. Returns True if successful.</p></description>
  248. </function>
  249. <function>
  250. <name>RmSessionStarted</name>
  251. <prototype>function RmSessionStarted: Boolean;</prototype>
  252. <description><p>Returns True if a Restart Manager session was started, False otherwise.</p></description>
  253. <seealso><p><link topic="setup_closeapplications">CloseApplications</link></p></seealso>
  254. </function>
  255. </subcategory>
  256. <subcategory>
  257. <function>
  258. <name>GetWizardForm</name>
  259. <prototype>function GetWizardForm: TWizardForm;</prototype>
  260. <description><p>Returns the <tt>WizardForm</tt> support object, or raises an internal error if the object has not yet been created.</p></description>
  261. <seealso><p><link topic="scriptclasses" anchor="WizardForm">WizardForm</link></p></seealso>
  262. </function>
  263. <function>
  264. <name>GetUninstallProgressForm</name>
  265. <prototype>function GetUninstallProgressForm: TUninstallProgressForm;</prototype>
  266. <description><p>Returns the <tt>UninstallProgressForm</tt> support object, or raises an internal error if the object has not yet been created.</p></description>
  267. <seealso><p><link topic="scriptclasses" anchor="UninstallProgressForm">UninstallProgressForm</link></p></seealso>
  268. </function>
  269. </subcategory>
  270. </category>
  271. <category>
  272. <description>Exception</description>
  273. <subcategory>
  274. <function>
  275. <name>Abort</name>
  276. <prototype>procedure Abort;</prototype>
  277. <description><p>Escapes from the current execution path without reporting an error.</p>
  278. <p>Abort raises a special "silent exception" which operates like any other exception, but does not display an error message to the end user.</p></description>
  279. <remarks><p>Abort does not cause Setup or Uninstall to exit unless it's called from one of these event functions (or another function invoked by them):</p>
  280. <p><tt>InitializeSetup<br />
  281. InitializeWizard<br />
  282. CurStepChanged(ssInstall)</tt></p>
  283. <p><tt>InitializeUninstall<br />
  284. CurUninstallStepChanged(usAppMutexCheck)<br />
  285. CurUninstallStepChanged(usUninstall)</tt></p></remarks>
  286. <seealso><p><link topic="scriptevents" anchor="PrepareToInstall">PrepareToInstall</link></p></seealso>
  287. </function>
  288. <function>
  289. <name>RaiseException</name>
  290. <prototype>procedure RaiseException(const Msg: String);</prototype>
  291. <description><p>Raises an exception with the specified message.</p></description>
  292. <example><pre>begin
  293. RaiseException('Your message goes here');
  294. // The following line will not be executed because of the exception
  295. MsgBox('You will not see this.', mbInformation, MB_OK);
  296. end;</pre></example>
  297. </function>
  298. </subcategory>
  299. <subcategory>
  300. <function>
  301. <name>GetExceptionMessage</name>
  302. <prototype>function GetExceptionMessage: String;</prototype>
  303. <description><p>Returns the message associated with the current exception. This function should only be called from within an <tt>except</tt> section, or a function called from an <tt>except</tt> section.</p></description>
  304. <remarks><p>Exception messages generally do not end in a period. Pass the result of this function to AddPeriod to add one.</p></remarks>
  305. <example><pre>var
  306. I: Integer;
  307. begin
  308. I := 1;
  309. try
  310. // The following line will raise a "Division by zero" exception
  311. I := I div 0;
  312. except
  313. // Catch the exception, deal with it, and continue
  314. MsgBox('We caught this exception: ' + AddPeriod(GetExceptionMessage),
  315. mbError, MB_OK);
  316. end;
  317. end;</pre></example>
  318. </function>
  319. <function>
  320. <name>ShowExceptionMessage</name>
  321. <prototype>procedure ShowExceptionMessage;</prototype>
  322. <description><p>Shows the message associated with the current exception in a message box. This function should only be called from within an <tt>except</tt> section, or a function called from an <tt>except</tt> section.</p></description>
  323. <remarks><p>If logging is enabled (via the <link topic="setupcmdline">/LOG</link> command line parameter or the <link topic="setup_setuplogging">SetupLogging</link> [Setup] section directive or the <link topic="setup_uninstalllogging">UninstallLogging</link> [Setup] section directive or debugging from the Compiler IDE) the message will be recorded in the log file and/or in the Compiler IDE's "Debug Output" view in addition to being shown.</p></remarks>
  324. <example><pre>var
  325. I: Integer;
  326. begin
  327. I := 1;
  328. try
  329. // The following line will raise a "Division by zero" exception
  330. I := I div 0;
  331. except
  332. // Catch the exception, show it, and continue
  333. ShowExceptionMessage;
  334. end;
  335. end;</pre></example>
  336. </function>
  337. </subcategory>
  338. </category>
  339. <category>
  340. <description>System</description>
  341. <subcategory>
  342. <function>
  343. <name>IsAdmin</name>
  344. <prototype>function IsAdmin: Boolean;</prototype>
  345. <description><p>Returns True if Setup/Uninstall is running with administrative privileges.</p></description>
  346. </function>
  347. <function>
  348. <name>IsAdminInstallMode</name>
  349. <prototype>function IsAdminInstallMode: Boolean;</prototype>
  350. <description><p>Returns True if Setup is running in <link topic="admininstallmode">administrative install mode</link> or if Uninstall is running with administrative privileges.</p></description>
  351. </function>
  352. <function>
  353. <name>GetWindowsVersion</name>
  354. <prototype>function GetWindowsVersion: Cardinal;</prototype>
  355. <description><p>Returns the version number of Windows packed into a single integer. The upper 8 bits specify the major version; the following 8 bits specify the minor version; the lower 16 bits specify the build number. For example, this function will return $0A002800 on Windows 10 Version 1507, which is version 10.0.10240.</p>
  356. <p>To retrieve just the major version number, use: "GetWindowsVersion shr 24". To retrieve just the minor version number, use: "(GetWindowsVersion shr 16) and $FF". To retrieve just the build number, use: "GetWindowsVersion and $FFFF".</p></description>
  357. <example><pre>function IsWindows8OrLater: Boolean;
  358. begin
  359. Result := (GetWindowsVersion &gt;= $06020000);
  360. end;</pre></example>
  361. <seealso><p><link topic="isxfunc_GetWindowsVersionEx">GetWindowsVersionEx</link></p></seealso>
  362. </function>
  363. <function>
  364. <name>GetWindowsVersionEx</name>
  365. <prototype>procedure GetWindowsVersionEx(var Version: TWindowsVersion);</prototype>
  366. <description><p>Returns extended information about the version of Windows in a record.</p>
  367. <p>TWindowsVersion is defined as:</p>
  368. <pre>
  369. TWindowsVersion = record
  370. Major: Cardinal; // Major version number
  371. Minor: Cardinal; // Minor version number
  372. Build: Cardinal; // Build number
  373. ServicePackMajor: Cardinal; // Major version number of service pack
  374. ServicePackMinor: Cardinal; // Minor version number of service pack
  375. NTPlatform: Boolean; // True if an NT-based platform
  376. ProductType: Byte; // Product type (see below)
  377. SuiteMask: Word; // Product suites installed (see below)
  378. end;
  379. </pre>
  380. <p>The ProductType field can be one of the following values:</p>
  381. <pre>
  382. VER_NT_WORKSTATION
  383. VER_NT_DOMAIN_CONTROLLER
  384. VER_NT_SERVER
  385. </pre>
  386. <p>It can also be zero if the product type could not be determined (unlikely). VER_NT_WORKSTATION indicates a non-server edition of Windows (e.g. Workstation, Professional, or Home).</p>
  387. <p>The SuiteMask field can be a combination of the following values:</p>
  388. <pre>
  389. VER_SUITE_BACKOFFICE
  390. VER_SUITE_BLADE
  391. VER_SUITE_DATACENTER
  392. VER_SUITE_ENTERPRISE
  393. VER_SUITE_EMBEDDEDNT
  394. VER_SUITE_PERSONAL
  395. VER_SUITE_SINGLEUSERTS
  396. VER_SUITE_SMALLBUSINESS
  397. VER_SUITE_SMALLBUSINESS_RESTRICTED
  398. VER_SUITE_TERMINAL
  399. </pre>
  400. <p>VER_SUITE_PERSONAL, for example, is set on Home edition of Windows XP, and VER_SUITE_BLADE is set on the Web edition of Windows Server 2003.</p></description>
  401. <example><p>The following example demonstrates how you can disallow installation on certain editions of Windows, and check service pack levels on multiple operating system versions. (Neither of these things are possible with the <tt>MinVersion</tt> [Setup] section directive.)</p>
  402. <pre>function InitializeSetup: Boolean;
  403. var
  404. Version: TWindowsVersion;
  405. S: String;
  406. begin
  407. GetWindowsVersionEx(Version);
  408. // Disallow installation on Home edition of Windows
  409. if Version.SuiteMask and VER_SUITE_PERSONAL &lt;&gt; 0 then
  410. begin
  411. SuppressibleMsgBox('This program cannot be installed on a Home edition of Windows.',
  412. mbCriticalError, MB_OK, IDOK);
  413. Result := False;
  414. Exit;
  415. end;
  416. // Disallow installation on domain controllers
  417. if Version.ProductType = VER_NT_DOMAIN_CONTROLLER then
  418. begin
  419. SuppressibleMsgBox('This program cannot be installed on domain controllers.',
  420. mbCriticalError, MB_OK, IDOK);
  421. Result := False;
  422. Exit;
  423. end;
  424. Result := True;
  425. end;</pre></example>
  426. </function>
  427. <function>
  428. <name>GetWindowsVersionString</name>
  429. <prototype>function GetWindowsVersionString: String;</prototype>
  430. <description><p>Returns the version number of Windows in string form. On Windows 2000, for example, this function will return "5.00.2195".</p></description>
  431. </function>
  432. </subcategory>
  433. <subcategory>
  434. <function>
  435. <name>IsWin64</name>
  436. <prototype>function IsWin64: Boolean;</prototype>
  437. <description><p>Returns True if the system is running a 64-bit version of Windows. If False is returned, you cannot utilize any of Inno Setup's 64-bit-only features.</p>
  438. <p>Another way to describe this function is: Returns True if the system matches architecture identifier <link topic="archidentifiers">win64</link>.</p>
  439. <p>Do not use this function to detect <link topic="32vs64bitinstalls">64-bit install mode</link>, use <link topic="isxfunc_Is64BitInstallMode">Is64BitInstallMode</link> instead.</p></description>
  440. <example><pre>begin
  441. // Check IsWin64 before using a 64-bit-only feature to
  442. // avoid an exception when running on 32-bit Windows.
  443. if IsWin64 then
  444. begin
  445. MsgBox('64-bit program files reside in: ' +
  446. ExpandConstant('{autopf64}'), mbInformation, MB_OK);
  447. end;
  448. end;</pre></example>
  449. <seealso><p><link topic="isxfunc_Is64BitInstallMode">Is64BitInstallMode</link><br />
  450. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  451. </function>
  452. <function>
  453. <name>Is64BitInstallMode</name>
  454. <prototype>function Is64BitInstallMode: Boolean;</prototype>
  455. <description><p>Returns True if Setup or Uninstall is running in <link topic="32vs64bitinstalls">64-bit install mode</link>, or False if it is running in <link topic="32vs64bitinstalls">32-bit install mode</link>.</p></description>
  456. <remarks><p>When True is returned, it is safe to assume that <link topic="isxfunc_IsWin64">IsWin64</link> will also return True.</p></remarks>
  457. <example><pre>begin
  458. if Is64BitInstallMode then
  459. MsgBox('Installing in 64-bit mode', mbInformation, MB_OK)
  460. else
  461. MsgBox('Installing in 32-bit mode', mbInformation, MB_OK);
  462. end;</pre></example>
  463. <seealso><p><link topic="isxfunc_IsWin64">IsWin64</link><br />
  464. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  465. </function>
  466. <function>
  467. <name>ProcessorArchitecture</name>
  468. <prototype>function ProcessorArchitecture: TSetupProcessorArchitecture;</prototype>
  469. <description><p>Returns the architecture of the system's Windows installation.</p>
  470. <p><tt>TSetupProcessorArchitecture</tt> is an enumerated type, defined as:</p>
  471. <p><tt>TSetupProcessorArchitecture = (paUnknown, paX86, paX64, paArm32, paArm64);</tt></p></description>
  472. <remarks><p><tt>paUnknown</tt> is returned if Setup/Uninstall does not recognize the architecture of the Windows installation. It can be assumed that an "unknown" architecture is at least capable of executing 32-bit x86 code, or Setup/Uninstall wouldn't be running at all.</p>
  473. <p><tt>paArm32</tt> is not a possible return value for this function because no version of Windows for 32-bit Arm processors had the ability to run x86 binaries. (An x86 emulator was first introduced in Arm64 Windows.)</p></remarks>
  474. <example><pre>var
  475. S: String;
  476. begin
  477. case ProcessorArchitecture of
  478. paX86: S := 'x86';
  479. paX64: S := 'x64';
  480. paArm64: S := 'Arm64';
  481. else
  482. S := 'Unrecognized';
  483. end;
  484. MsgBox('Windows architecture: ' + S, mbInformation, MB_OK);
  485. end;</pre></example>
  486. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  487. <link topic="isxfunc_Is64BitInstallMode">Is64BitInstallMode</link></p></seealso>
  488. </function>
  489. <function>
  490. <name>IsArm32Compatible</name>
  491. <prototype>function IsArm32Compatible: Boolean;</prototype>
  492. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">arm32compatible</link>.</p></description>
  493. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  494. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  495. </function>
  496. <function>
  497. <name>IsArm64</name>
  498. <prototype>function IsArm64: Boolean;</prototype>
  499. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">arm64</link>.</p></description>
  500. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  501. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  502. </function>
  503. <function>
  504. <name>IsX64Compatible</name>
  505. <prototype>function IsX64Compatible: Boolean;</prototype>
  506. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">x64compatible</link>.</p></description>
  507. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  508. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  509. </function>
  510. <function>
  511. <name>IsX64OS</name>
  512. <prototype>function IsX64OS: Boolean;</prototype>
  513. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">x64os</link>.</p>
  514. <p>Before Inno Setup 6.3, <tt>IsX64OS</tt> was named <tt>IsX64</tt>. The compiler still accepts <tt>IsX64</tt> as an alias for <tt>IsX64OS</tt>, but will emit a deprecation warning when used.</p></description>
  515. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  516. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  517. </function>
  518. <function>
  519. <name>IsX86Compatible</name>
  520. <prototype>function IsX86Compatible: Boolean;</prototype>
  521. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">x86compatible</link>.</p></description>
  522. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  523. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  524. </function>
  525. <function>
  526. <name>IsX86OS</name>
  527. <prototype>function IsX86OS: Boolean;</prototype>
  528. <description><p>Returns True if the system matches architecture identifier <link topic="archidentifiers">x86os</link>.</p>
  529. <p>Before Inno Setup 6.3, <tt>IsX86OS</tt> was named <tt>IsX86</tt>. The compiler still accepts <tt>IsX86</tt> as an alias for <tt>IsX86OS</tt>.</p></description>
  530. <seealso><p><link topic="isarchidentifier">Architecture Identifier Matchers like IsX64Compatible</link><br />
  531. <link topic="isxfunc_ProcessorArchitecture">ProcessorArchitecture</link></p></seealso>
  532. </function>
  533. </subcategory>
  534. <subcategory>
  535. <function>
  536. <name>InstallOnThisVersion</name>
  537. <prototype>function InstallOnThisVersion(const MinVersion, OnlyBelowVersion: String): Boolean;</prototype>
  538. <description><p>This function is deprecated. Returns True if an entry with the specified MinVersion and OnlyBelowVersion parameters should be installed. If an invalid version string is passed, an exception will be raised.</p>
  539. <p>This function is provided for backward compatibility only, and may be removed in a future release. New scripts should use <link topic="isxfunc_GetWindowsVersion">GetWindowsVersion</link> or <link topic="isxfunc_GetWindowsVersionEx">GetWindowsVersionEx</link> instead.</p></description>
  540. <remarks><p>Prior to Inno Setup 5.5.0, this function returned <tt>irInstall</tt> rather than a Boolean True value. <tt>irInstall</tt> is now defined as an alias for True.</p></remarks>
  541. <example><pre>// Old method, deprecated
  542. function IsWindows8OrLater: Boolean;
  543. begin
  544. Result := InstallOnThisVersion('0,6.2', '0,0');
  545. end;
  546. // New method
  547. function IsWindows8OrLater: Boolean;
  548. begin
  549. Result := (GetWindowsVersion &gt;= $06020000);
  550. end;</pre></example>
  551. <seealso><p><link topic="isxfunc_GetWindowsVersion">GetWindowsVersion</link><br />
  552. <link topic="isxfunc_GetWindowsVersionEx">GetWindowsVersionEx</link></p></seealso>
  553. </function>
  554. <function>
  555. <name>IsDotNetInstalled</name>
  556. <prototype>function IsDotNetInstalled(const MinVersion: TDotNetVersion; const MinServicePack: Cardinal): Boolean;</prototype>
  557. <description><p>Returns True if the .NET Framework with the specified MinVersion and MinServicePack parameters is installed.</p>
  558. <p>TDotNetVersion is defined as:</p>
  559. <p><tt>TDotNetVersion = (net11, net20, net30, net35, net4Client, net4Full, net45, net451, net452, net46, net461, net462, net47, net471, net472, net48, net481);</tt></p></description>
  560. <example><pre>function InitializeSetup: Boolean;
  561. begin
  562. Result := IsDotNetInstalled(net462, 0); //Returns True if .NET Framework version 4.6.2 is installed, or a compatible version such as 4.8.1
  563. if not Result then
  564. SuppressibleMsgBox(FmtMessage(SetupMessage(msgWinVersionTooLowError), ['.NET Framework', '4.6.2']), mbCriticalError, MB_OK, IDOK);
  565. end;</pre></example>
  566. </function>
  567. <function>
  568. <name>IsMsiProductInstalled</name>
  569. <prototype>function IsMsiProductInstalled(const UpgradeCode: String; const PackedMinVersion: Int64): Boolean;</prototype>
  570. <description><p>Returns True if a MSI product with the specified UpgradeCode and PackedMinVersion is installed.</p>
  571. <p>If there are multiple products installed with the specified UpgradeCode only the version of the first product returned by the system is checked.</p>
  572. <p>An exception will be raised if an error occurs.</p></description>
  573. <example><pre>function InitializeSetup: Boolean;
  574. begin
  575. Result := IsMsiProductInstalled('{20400CF0-DE7C-327E-9AE4-F0F38D9085F8}', PackVersionComponents(12, 0, 0, 0)); //Returns True if Visual C++ 2013 Redistributable (x64) is installed
  576. if not Result then
  577. SuppressibleMsgBox(FmtMessage(SetupMessage(msgWinVersionTooLowError), ['Visual C++ 2013 Redistributable (x64)', '12.0']), mbCriticalError, MB_OK, IDOK);
  578. end;</pre></example>
  579. </function>
  580. </subcategory>
  581. <subcategory>
  582. <function>
  583. <name>GetEnv</name>
  584. <prototype>function GetEnv(const EnvVar: String): String;</prototype>
  585. <description><p>Gets the value of the specified environment variable.</p></description>
  586. </function>
  587. <function>
  588. <name>GetUserNameString</name>
  589. <prototype>function GetUserNameString: String;</prototype>
  590. <description><p>Retrieves the name of the user currently logged onto the system.</p></description>
  591. </function>
  592. <function>
  593. <name>GetComputerNameString</name>
  594. <prototype>function GetComputerNameString: String;</prototype>
  595. <description><p>Retrieves the name of the computer the Setup or Uninstall program is running on (as returned by the Windows <i>GetComputerName</i> function).</p></description>
  596. </function>
  597. </subcategory>
  598. <subcategory>
  599. <function>
  600. <name>GetUILanguage</name>
  601. <prototype>function GetUILanguage: Integer;</prototype>
  602. <description><p>Returns the language identifier (LANGID) of the current user's UI language, which is either the language of Windows itself, or in the case of a MUI edition of Windows, the user interface language chosen in Control Panel's Regional Options. Returns 0 if the function fails (unlikely).</p></description>
  603. <remarks><p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/dd318693.aspx">list of valid language identifiers on MSDN</a>.</p></remarks>
  604. <example><pre>begin
  605. if GetUILanguage = $0409 then
  606. begin
  607. // UI language is English (United States)
  608. end;
  609. // You can use "and $3FF" to extract the primary language identifier
  610. if GetUILanguage and $3FF = $09 then
  611. begin
  612. // Matches any variant of English
  613. end;
  614. end;</pre></example>
  615. </function>
  616. </subcategory>
  617. <subcategory>
  618. <function>
  619. <name>FontExists</name>
  620. <prototype>function FontExists(const FaceName: String): Boolean;</prototype>
  621. <description><p>Returns True if a font with the specified face name is installed on the system.</p></description>
  622. </function>
  623. </subcategory>
  624. <subcategory>
  625. <function>
  626. <name>FindWindowByClassName</name>
  627. <prototype>function FindWindowByClassName(const ClassName: String): HWND;</prototype>
  628. <description><p>Retrieves a handle to the top-level window whose class name matches the specified string. This function does not search child windows, and does not perform a case-sensitive search. Returns 0 if no window is found.</p></description>
  629. </function>
  630. <function>
  631. <name>FindWindowByWindowName</name>
  632. <prototype>function FindWindowByWindowName(const WindowName: String): HWND;</prototype>
  633. <description><p>Retrieves a handle to the top-level window whose window name matches the specified string. This function does not search child windows, and does not perform a case-sensitive search. Returns 0 if no window is found.</p></description>
  634. </function>
  635. <function>
  636. <name>SendMessage</name>
  637. <prototype>function SendMessage(const Wnd: HWND; const Msg, WParam, LParam: LongInt): LongInt;</prototype>
  638. <description><p>Sends the specified message to the specified window. Does not return until the window procedure has processed the message.</p></description>
  639. </function>
  640. <function>
  641. <name>PostMessage</name>
  642. <prototype>function PostMessage(const Wnd: HWND; const Msg, WParam, LParam: LongInt): Boolean;</prototype>
  643. <description><p>Posts the specified message to the specified window, returning immediately. Returns True if successful.</p></description>
  644. </function>
  645. <function>
  646. <name>SendNotifyMessage</name>
  647. <prototype>function SendNotifyMessage(const Wnd: HWND; const Msg, WParam, LParam: LongInt): Boolean;</prototype>
  648. <description><p>Sends the specified message to the specified window without waiting for the message to be processed by the destination window procedure. Returns True if successful.</p></description>
  649. </function>
  650. <function>
  651. <name>RegisterWindowMessage</name>
  652. <prototype>function RegisterWindowMessage(const Name: String): LongInt;</prototype>
  653. <description><p>The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The returned message value can be used when calling the SendBroadcastMessage or PostBroadcastMessage function.</p></description>
  654. </function>
  655. <function>
  656. <name>SendBroadcastMessage</name>
  657. <prototype>function SendBroadcastMessage(const Msg, WParam, LParam: LongInt): LongInt;</prototype>
  658. <description><p>Sends the specified message to top-level windows in the system. Does not return until all window procedure have processed the message.<br />The specified message must be unique. Use RegisterWindowMessage to get such a message.</p></description>
  659. </function>
  660. <function>
  661. <name>PostBroadcastMessage</name>
  662. <prototype>function PostBroadcastMessage(const Msg, WParam, LParam: LongInt): Boolean;</prototype>
  663. <description><p>Posts the specified message to top-level windows in the system, returning immediately.<br />The specified message must be unique. Use RegisterWindowMessage to get such a message.</p></description>
  664. </function>
  665. <function>
  666. <name>SendBroadcastNotifyMessage</name>
  667. <prototype>function SendBroadcastNotifyMessage(const Msg, WParam, LParam: LongInt): Boolean;</prototype>
  668. </function>
  669. </subcategory>
  670. <subcategory>
  671. <function>
  672. <name>CreateMutex</name>
  673. <prototype>procedure CreateMutex(const Name: String);</prototype>
  674. <description><p>Creates a mutex with the specified name.</p></description>
  675. </function>
  676. <function>
  677. <name>CheckForMutexes</name>
  678. <prototype>function CheckForMutexes(Mutexes: String): Boolean;</prototype>
  679. <description><p>Returns True if any of the mutexes in the comma-separated Mutexes string exist.</p></description>
  680. </function>
  681. </subcategory>
  682. <subcategory>
  683. <function>
  684. <name>MakePendingFileRenameOperationsChecksum</name>
  685. <prototype>procedure MakePendingFileRenameOperationsChecksum: String;</prototype>
  686. <description><p>Calculates a checksum of the current PendingFileRenameOperations registry value. The caller can use this checksum to determine if PendingFileRenameOperations or WININIT.INI was changed (perhaps by another program).</p></description>
  687. <example><pre>var
  688. ChecksumBefore, ChecksumAfter: String;
  689. begin
  690. ChecksumBefore := MakePendingFileRenameOperationsChecksum;
  691. // ...run a program...
  692. ChecksumAfter := MakePendingFileRenameOperationsChecksum;
  693. if ChecksumAfter &lt;&gt; ChecksumBefore then
  694. // PendingFileRenameOperations or WININIT.INI changed
  695. end;</pre></example>
  696. </function>
  697. </subcategory>
  698. <subcategory>
  699. <function>
  700. <name>CreateCallback</name>
  701. <prototype>function CreateCallback(Method: AnyMethod): Longword;</prototype>
  702. <description><p>Allows you to perform direct callbacks from DLL functions (like Windows API functions) to functions in your script.</p></description>
  703. <example><pre>function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: Longword): Longword;
  704. external '[email protected] stdcall';
  705. var
  706. TimerCount: Integer;
  707. procedure MyTimerProc(Arg1, Arg2, Arg3, Arg4: Longword);
  708. begin
  709. Inc(TimerCount);
  710. WizardForm.BeveledLabel.Caption := ' Timer! ' + IntToStr(TimerCount);
  711. WizardForm.BeveledLabel.Visible := True;
  712. end;
  713. procedure InitializeWizard;
  714. begin
  715. SetTimer(0, 0, 1000, CreateCallback(@MyTimerProc));
  716. end;</pre></example>
  717. </function>
  718. <function>
  719. <name>UnloadDLL</name>
  720. <prototype>procedure UnloadDLL(Filename: String);</prototype>
  721. <description><p>Unloads the specified DLL that was loaded by the [Code] section using an "external" keyword. This can be useful if you need to delete the DLL.</p>
  722. <p>The case of the filename and any path name must exactly match that of the function import. You will need to expand any constants in the filename yourself before passing it to UnloadDLL.</p>
  723. <p>If the function import used a "files:" prefix, prepend the value of the <tt>{tmp}</tt> constant to the filename (e.g. <tt>ExpandConstant('{tmp}\filename.dll')</tt>).</p></description>
  724. <remarks><p>It's not recommended that you try this, but if you attempt to call a function in a DLL that has been unloaded, the DLL will be re-loaded.</p></remarks>
  725. <example><pre>procedure DllFunc; external 'DllFunc@{app}\MyDll.dll stdcall uninstallonly';
  726. ...
  727. begin
  728. // Call DllFunc
  729. DllFunc;
  730. // Unload the DLL
  731. UnloadDLL(ExpandConstant('{app}\MyDll.dll'));
  732. // Now we can delete the DLL
  733. DeleteFile(ExpandConstant('{app}\MyDll.dll'));
  734. end;</pre></example>
  735. </function>
  736. <function>
  737. <name>DLLGetLastError</name>
  738. <prototype>function DLLGetLastError(): LongInt;</prototype>
  739. <description><p>Returns value the last error code had right after the most recent DLL function call you made. Useful after calling Windows API functions (if the function sets the last error code).</p></description>
  740. <remarks><p>It's recommended to use this function instead of directly calling the GetLastError Windows API function since Setup or Uninstall makes API calls of its own, so the last error code could be overwritten at any time.</p>
  741. <p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx">system error codes on MSDN</a>.</p></remarks>
  742. <example><pre>function MessageBox(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal): Integer; external '[email protected] stdcall';
  743. ...
  744. begin
  745. if MessageBox(-1, '', '', -1) = 0 then
  746. MsgBox(SysErrorMessage(DLLGetLastError), mbError, mb_Ok);</pre></example>
  747. </function>
  748. </subcategory>
  749. </category>
  750. <category>
  751. <description>String</description>
  752. <subcategory>
  753. <function>
  754. <name>Chr</name>
  755. <prototype>function Chr(B: Byte): Char;</prototype>
  756. <description><p>Returns the character with the specified ordinal value.</p></description>
  757. </function>
  758. <function>
  759. <name>Ord</name>
  760. <prototype>function Ord(C: Char): Byte;</prototype>
  761. <description><p>Returns the ordinal value of the specified character.</p></description>
  762. </function>
  763. <function>
  764. <name>Copy</name>
  765. <prototype>function Copy(S: AnyString; Index, Count: Integer): String;</prototype>
  766. <description><p>Returns a string containing Count characters starting at S[Index].<br />If Index is larger than the length of S, Copy returns an empty string.<br />If Count specifies more characters than are available, only the characters from S[Index] to the end of S are returned.</p></description>
  767. </function>
  768. <function>
  769. <name>Length</name>
  770. <prototype>function Length(S: AnyString): LongInt;</prototype>
  771. <description><p>Returns the length of the specified string.</p></description>
  772. </function>
  773. <function>
  774. <name>Lowercase</name>
  775. <prototype>function Lowercase(S: AnyString): String;</prototype>
  776. <description><p>Returns a copy of the string S, but with all 7-bit ASCII characters between 'A' and 'Z' converted to lowercase. To convert 8-bit international characters, use AnsiLowercase instead.</p></description>
  777. </function>
  778. <function>
  779. <name>Uppercase</name>
  780. <prototype>function Uppercase(S: AnyString): String;</prototype>
  781. <description><p>Returns a copy of the string S, but with all 7-bit ASCII characters between 'a' and 'z' converted to uppercase. To convert 8-bit international characters, use AnsiUppercase instead.</p></description>
  782. </function>
  783. <function>
  784. <name>AnsiLowercase</name>
  785. <prototype>function AnsiLowercase(S: AnyString): String;</prototype>
  786. <description><p>Returns a string that is a copy of the given string converted to lowercase. The conversion uses the current Windows locale. This function supports multi-byte character sets (MBCS).</p></description>
  787. </function>
  788. <function>
  789. <name>AnsiUppercase</name>
  790. <prototype>function AnsiUppercase(S: AnyString): String;</prototype>
  791. <description><p>Returns a string that is a copy of the given string converted to uppercase. The conversion uses the current Windows locale. This function supports multi-byte character sets (MBCS).</p></description>
  792. </function>
  793. <function>
  794. <name>StringOfChar</name>
  795. <prototype>function StringOfChar(C: Char; I : LongInt): String;</prototype>
  796. <description><p>Returns a string of length I with all characters set to character C.</p></description>
  797. </function>
  798. <function>
  799. <name>Delete</name>
  800. <prototype>procedure Delete(var S: AnyString; Index, Count: Integer);</prototype>
  801. <description><p>Removes a substring of Count characters from string S starting at S[Index].<br />If Index is larger than the length of S, no characters are deleted. If Count specifies more characters than remain starting at the S[Index], Delete removes the rest of the string.</p></description>
  802. </function>
  803. <function>
  804. <name>Insert</name>
  805. <prototype>procedure Insert(Source: AnyString; var Dest: AnyString; Index: Integer);</prototype>
  806. <description><p>Merges Source into Dest at the position Dest[Index].</p></description>
  807. </function>
  808. <function>
  809. <name>StringChange</name>
  810. <prototype>function StringChange(var S: String; const FromStr, ToStr: String): Integer;</prototype>
  811. <description><p>This function is deprecated. It is equivalent to calling <link topic="isxfunc_StringChangeEx">StringChangeEx</link> with the SupportMBCS parameter set to False.</p></description>
  812. </function>
  813. <function>
  814. <name>StringChangeEx</name>
  815. <prototype>function StringChangeEx(var S: String; const FromStr, ToStr: String; const SupportDBCS: Boolean): Integer;</prototype>
  816. <description><p>Changes all occurrences in S of FromStr to ToStr. If SupportDBCS is True (recommended unless you require binary safety), double-byte character sequences in S are recognized and handled properly. Otherwise, the function behaves in a binary-safe manner. Returns the number of times FromStr was matched and changed.</p></description>
  817. <remarks><p>When working with strings containing paths or filenames, be sure to pass True in the SupportDBCS parameter. Otherwise, paths with Chinese, Japanese, or Korean characters may be corrupted.</p></remarks>
  818. <example><pre>var
  819. S: String;
  820. begin
  821. S := ExpandConstant('{commonappdata}');
  822. // S = 'C:\Documents and Settings\All Users\Application Data'
  823. StringChangeEx(S, '\', '/', True);
  824. // S = 'C:/Documents and Settings/All Users/Application Data'
  825. end;</pre></example>
  826. </function>
  827. <function>
  828. <name>Pos</name>
  829. <prototype>function Pos(SubStr, S: AnyString): Integer;</prototype>
  830. <description><p>Searches for Substr within S and returns an integer value that is the index of the first character of Substr within S.<br />If Substr is not found, Pos returns zero. The Pos function is case-sensitive.</p></description>
  831. </function>
  832. <function>
  833. <name>AddQuotes</name>
  834. <prototype>function AddQuotes(const S: String): String;</prototype>
  835. <description><p>Adds a quote (") character to the left and right sides of the string if the string contains a space and it didn't have quotes already. This is primarily used when spawning another process with a long filename as one of the parameters.</p></description>
  836. </function>
  837. <function>
  838. <name>RemoveQuotes</name>
  839. <prototype>function RemoveQuotes(const S: String): String;</prototype>
  840. <description><p>Opposite of AddQuotes; removes any quotes around the string.</p></description>
  841. </function>
  842. <function>
  843. <name>ConvertPercentStr</name>
  844. <prototype>function ConvertPercentStr(var S: String): Boolean;</prototype>
  845. <description><p>Expands all %-encoded characters in the string (see <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>). Returns True if all were successfully expanded.</p></description>
  846. </function>
  847. </subcategory>
  848. <subcategory>
  849. <function>
  850. <name>CompareText</name>
  851. <prototype>function CompareText(const S1, S2: String): Integer;</prototype>
  852. <description><p>Compares the strings S1 and S2 and returns 0 if they are equal. If S1 is greater than S2, CompareText returns an integer greater than 0. If S1 is less than S2, CompareText returns an integer less than 0. The CompareText function is not case-sensitive.</p></description>
  853. </function>
  854. <function>
  855. <name>CompareStr</name>
  856. <prototype>function CompareStr(const S1, S2: String): Integer;</prototype>
  857. <description><p>Compares S1 to S2, with case-sensitivity. The return value is less than 0 if S1 is less than S2, 0 if S1 equals S2, or greater than 0 if S1 is greater than S2.</p></description>
  858. </function>
  859. <function>
  860. <name>SameText</name>
  861. <prototype>function SameText(const S1, S2: String): Boolean;</prototype>
  862. <description><p>Compares the strings S1 and S2 and returns True if they are equal. The SameText function is not case-sensitive.</p></description>
  863. </function>
  864. <function>
  865. <name>SameStr</name>
  866. <prototype>function SameStr(const S1, S2: String): Boolean;</prototype>
  867. <description><p>Compares S1 to S2, with case-sensitivity. The return value is True if they are equal.</p></description>
  868. </function>
  869. <function>
  870. <name>IsWildcard</name>
  871. <prototype>function IsWildcard(const Pattern: String): Boolean;</prototype>
  872. <description><p>Returns True if the specified pattern contains a wildcard.</p></description>
  873. </function>
  874. <function>
  875. <name>WildcardMatch</name>
  876. <prototype>function WildcardMatch(const Text, Pattern: String): Boolean;</prototype>
  877. <description><p>Returns True if the specified text matches the specified pattern.</p></description>
  878. </function>
  879. </subcategory>
  880. <subcategory>
  881. <function>
  882. <name>Format</name>
  883. <prototype>function Format(const Format: String; const Args: array of const): String;</prototype>
  884. <description><p>Formats the series of arguments in the open array Args. Formatting is controlled by the format string Format; the results are returned as a string.</p>
  885. <p>An exception will be raised if an invalid format string is specified, too few arguments are passed, or if any arguments are of the wrong type.</p></description>
  886. <example><pre>var
  887. S: String;
  888. I: Integer;
  889. begin
  890. S := Format('%d files found', [10]);
  891. // S = '10 files found'
  892. S := Format('Filename: %s', ['file.txt']);
  893. // S = 'Filename: file.txt'
  894. I := 64;
  895. S := Format('%d in hex, padded to 8 digits: %.8x', [I, I]);
  896. // S = '64 in hex, padded to 8 digits: 00000040'
  897. end;</pre></example>
  898. </function>
  899. </subcategory>
  900. <subcategory>
  901. <function>
  902. <name>Trim</name>
  903. <prototype>function Trim(const S: AnyString): AnyString;</prototype>
  904. <description><p>Trims leading and trailing spaces and control characters from the given string S.</p></description>
  905. </function>
  906. <function>
  907. <name>TrimLeft</name>
  908. <prototype>function TrimLeft(const S: String): String;</prototype>
  909. <description><p>Trims leading spaces and control characters from the given string S.</p></description>
  910. </function>
  911. <function>
  912. <name>TrimRight</name>
  913. <prototype>function TrimRight(const S: String): String;</prototype>
  914. <description><p>Trims trailing spaces and control characters from the given string S.</p></description>
  915. </function>
  916. <function>
  917. <name>StringJoin</name>
  918. <prototype>function StringJoin(const Separator: String; const Values: TArrayOfString): String;</prototype>
  919. <description><p>Joins two or more strings together separated by the given separator.</p></description>
  920. <example><pre>var
  921. S: String;
  922. begin
  923. S := StringJoin(',', ['1', '2']);
  924. // S = '1,2'
  925. end;
  926. </pre></example>
  927. <seealso><p><link topic="isxfunc_StringSplit">StringSplit</link></p></seealso>
  928. </function>
  929. <function>
  930. <name>StringSplit</name>
  931. <prototype>function StringSplit(const S: String; const Separators: TArrayOfString; const Typ: TSplitType): TArrayOfString;</prototype>
  932. <description><p>Splits the given string into substrings, using the given characters or strings to be used as separator. Empty substrings can be ignored.</p>
  933. <p>TSplitType is defined as:</p>
  934. <p><tt>TSplitType = (stAll, stExcludeEmpty, stExcludeLastEmpty);</tt></p></description>
  935. <example><pre>var
  936. A: array of String;
  937. begin
  938. A := StringSplit('1,,2', [','], stExcludeEmpty);
  939. // A = ['1','2']
  940. end;
  941. </pre></example>
  942. <seealso><p><link topic="isxfunc_StringJoin">StringJoin</link><br />
  943. <link topic="isxfunc_StringSplitEx">StringSplitEx</link></p></seealso>
  944. </function>
  945. <function>
  946. <name>StringSplitEx</name>
  947. <prototype>function StringSplitEx(const S: String; const Separators: TArrayOfString; const Quote: Char; const Typ: TSplitType): TArrayOfString;</prototype>
  948. <description><p>Splits the given string into substrings, using the given characters or strings to be used as separator. Empty substrings can be ignored. Use the Quote parameter to specify the start and end character of a quoted part of the string where separators are ignored.</p>
  949. <p>TSplitType is defined as:</p>
  950. <p><tt>TSplitType = (stAll, stExcludeEmpty, stExcludeLastEmpty);</tt></p></description>
  951. <example><pre>var
  952. A: array of String;
  953. begin
  954. A := StringSplitEx('1,",",2', [','], '"', stAll);
  955. // A = ['1','","','2']
  956. end;
  957. </pre></example>
  958. <seealso><p><link topic="isxfunc_StringSplit">StringSplit</link></p></seealso>
  959. </function>
  960. </subcategory>
  961. <subcategory>
  962. <function>
  963. <name>StrToIntDef</name>
  964. <prototype>function StrToIntDef(S: String; Def: LongInt): LongInt;</prototype>
  965. <description><p>The StrToInt function converts the string passed in S into a number. If S does not represent a valid number, StrToInt returns the number passed in Def.</p></description>
  966. </function>
  967. <function>
  968. <name>StrToInt</name>
  969. <prototype>function StrToInt(S: String): LongInt;</prototype>
  970. <description><p>The StrToInt function converts the string passed in S into a number.</p></description>
  971. <remarks><p>Use of <link topic="isxfunc_StrToIntDef">StrToIntDef</link> instead of StrToInt is recommended.</p></remarks>
  972. </function>
  973. <function>
  974. <name>StrToInt64Def</name>
  975. <prototype>function StrToInt64Def(S: String; Def: Int64): Int64;</prototype>
  976. <description><p>The StrToInt64Def function converts the string passed in S into a 64-bit number. If S does not represent a valid 64-bit number, StrToInt returns the 64-bit number passed in Def.</p></description>
  977. </function>
  978. <function>
  979. <name>StrToInt64</name>
  980. <prototype>function StrToInt64(S: String): Int64;</prototype>
  981. <description><p>The StrToInt64 function converts the string passed in S into a 64-bit number.</p></description>
  982. <remarks><p>Use of <link topic="isxfunc_StrToInt64Def">StrToInt64Def</link> instead of StrToInt64 is recommended.</p></remarks>
  983. </function>
  984. <function>
  985. <name>StrToFloat</name>
  986. <prototype>function StrToFloat(S: String): Extended;</prototype>
  987. <description><p>The StrToFloat function converts the string passed in S into a floating point number. The character used for the decimal point should always be a dot.</p></description>
  988. </function>
  989. <function>
  990. <name>IntToStr</name>
  991. <prototype>function IntToStr(I: Int64): String;</prototype>
  992. <description><p>The IntToStr function converts a 64-bit number into a string.</p></description>
  993. </function>
  994. <function>
  995. <name>FloatToStr</name>
  996. <prototype>function FloatToStr(E: Extended): String;</prototype>
  997. <description><p>The FloatToStr function converts a floating point number into a string.</p><p>The character used for the decimal point will always be a dot.</p></description>
  998. </function>
  999. </subcategory>
  1000. <subcategory>
  1001. <function>
  1002. <name>CharLength</name>
  1003. <prototype>function CharLength(const S: String; const Index: Integer): Integer;</prototype>
  1004. <description><p>Returns the length in bytes (1 or 2) of the character in the specified string at the specified index.</p></description>
  1005. <remarks><p>In double-byte character sets (Chinese, Japanese, Korean), most non-ASCII characters occupy two bytes. Note that the second byte of a double-byte character -- known as the "trail byte" -- can be in the same range used by ASCII characters (below 128). Thus, when stepping through a string that may contain double-byte characters, such as a path or filename, care must be taken to not mistake trail bytes for single-byte ASCII characters.</p></remarks>
  1006. <example><pre>function BackslashToSlash(const S: String): String;
  1007. var
  1008. I: Integer;
  1009. begin
  1010. Result := S;
  1011. I := 1;
  1012. while I &lt;= Length(Result) do
  1013. begin
  1014. if Result[I] = '\' then
  1015. Result[I] := '/';
  1016. // Go to the next character. But do not simply increment I by 1.
  1017. // Increment by CharLength() in case Result[I] is a double-byte character.
  1018. I := I + CharLength(Result, I);
  1019. end;
  1020. end;
  1021. ...
  1022. begin
  1023. // Show path of Common Files with backslashes changed to forward slashes
  1024. MsgBox(BackslashToSlash(ExpandConstant('{cf}')), mbInformation, MB_OK);
  1025. end;</pre></example>
  1026. </function>
  1027. </subcategory>
  1028. <subcategory>
  1029. <function>
  1030. <name>AddBackslash</name>
  1031. <prototype>function AddBackslash(const S: String): String;</prototype>
  1032. <description><p>Returns the specified string with a trailing backslash added, unless the string is empty or already ends in a slash or backslash.</p></description>
  1033. </function>
  1034. <function>
  1035. <name>RemoveBackslashUnlessRoot</name>
  1036. <prototype>function RemoveBackslashUnlessRoot(const S: String): String;</prototype>
  1037. <description><p>Returns the specified string with any trailing slashes/backslashes removed, unless the string specifies the root directory of a drive (e.g. "C:\" or "\"), in which case it leaves 1 slash.</p></description>
  1038. </function>
  1039. <function>
  1040. <name>RemoveBackslash</name>
  1041. <prototype>function RemoveBackslash(const S: String): String;</prototype>
  1042. <description><p>Returns the specified string with any trailing slashes/backslashes removed.</p></description>
  1043. <remarks><p>Use of this function is discouraged; use <link topic="isxfunc_RemoveBackslashUnlessRoot">RemoveBackslashUnlessRoot</link> instead when working with file system paths.</p></remarks>
  1044. </function>
  1045. <function>
  1046. <name>AddPeriod</name>
  1047. <prototype>function AddPeriod(const S: String): String;</prototype>
  1048. <description><p>Returns the specified string with a trailing period added, unless the string is empty or already ends in a period or other punctuation mark.</p></description>
  1049. </function>
  1050. <function>
  1051. <name>ChangeFileExt</name>
  1052. <prototype>function ChangeFileExt(const FileName, Extension: String): String;</prototype>
  1053. <description><p>Takes the file name passed in FileName and changes the extension of the file name to the extension passed in Extension.</p></description>
  1054. </function>
  1055. <function>
  1056. <name>ExtractFileExt</name>
  1057. <prototype>function ExtractFileExt(const FileName: String): String;</prototype>
  1058. <description><p>Extracts the extension part of the given file name. The resulting string includes the period character that separates the name and extension parts. The resulting string is empty if the given filename has no extension.</p></description>
  1059. </function>
  1060. <function>
  1061. <name>ExtractFileDir</name>
  1062. <prototype>function ExtractFileDir(const FileName: String): String;</prototype>
  1063. <description><p>Extracts the drive and directory parts of the given file name, excluding a trailing backslash (unless it is a root directory). The resulting string is empty if FileName contains no drive and directory parts.</p></description>
  1064. <seealso><p><link topic="isxfunc_ExtractFilePath">ExtractFilePath</link></p></seealso>
  1065. </function>
  1066. <function>
  1067. <name>ExtractFilePath</name>
  1068. <prototype>function ExtractFilePath(const FileName: String): String;</prototype>
  1069. <description><p>Extracts the drive and directory parts of the given file name, including a trailing backslash. The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.</p></description>
  1070. <seealso><p><link topic="isxfunc_ExtractFileDir">ExtractFileDir</link></p></seealso>
  1071. </function>
  1072. <function>
  1073. <name>ExtractFileName</name>
  1074. <prototype>function ExtractFileName(const FileName: String): String;</prototype>
  1075. <description><p>Extracts the name and extension parts of the given file name. The resulting string is the rightmost characters of FileName, starting with the first character after the colon or backslash that separates the path information from the name and extension. The resulting string is equal to FileName if FileName contains no drive and directory parts.</p></description>
  1076. </function>
  1077. <function>
  1078. <name>ExtractFileDrive</name>
  1079. <prototype>function ExtractFileDrive(const FileName: String): String;</prototype>
  1080. <description><p>Returns a string containing the 'drive' portion of a fully qualified path name for the file passed in the FileName. For file names with drive letters, the resulting string is in the form '&lt;drive&gt;:'. For file names with a UNC path the resulting string is in the form '\\&lt;servername&gt;\&lt;sharename&gt;'. If the given path contains neither style of path prefix, the result is an empty string.</p></description>
  1081. </function>
  1082. <function>
  1083. <name>ExtractRelativePath</name>
  1084. <prototype>function ExtractRelativePath(const BaseName, DestName: String): String;</prototype>
  1085. <description><p>Converts a fully qualified path name into a relative path name. The DestName parameter specifies the file name (including path) to be converted. BaseName is the fully qualified name of the base directory to which the returned path name should be relative. BaseName may or may not include a file name, but it must include the final path delimiter.</p>
  1086. <p>ExtractRelativePath strips out common path directories and inserts '..\' for each level up from the BaseName.</p></description>
  1087. <example><pre>var
  1088. S: String;
  1089. begin
  1090. S := ExtractRelativePath('c:\windows\system32\', 'c:\autoexec.bat');
  1091. // S = ..\..\autoexec.bat
  1092. end;</pre></example>
  1093. </function>
  1094. <function>
  1095. <name>ExpandFileName</name>
  1096. <prototype>function ExpandFileName(const FileName: String): String;</prototype>
  1097. <description><p>Returns a string containing a fully qualified path name for the file passed in the FileName. A fully qualified path name includes the drive letter and any directory and subdirectories in addition to the file name and extension.</p></description>
  1098. </function>
  1099. <function>
  1100. <name>ExpandUNCFileName</name>
  1101. <prototype>function ExpandUNCFileName(const FileName: String): String;</prototype>
  1102. <description><p>Returns a string containing a fully qualified path name for the file passed in the FileName. A fully qualified path name includes the drive portion of the filename in the UNC format '\\&lt;servername&gt;\&lt;sharename&gt;' if the drive letter is mapped to a network resource instead of a local drive and any directory and subdirectories in addition to the file name and extension.</p></description>
  1103. </function>
  1104. </subcategory>
  1105. <subcategory>
  1106. <function>
  1107. <name>GetDateTimeString</name>
  1108. <prototype>function GetDateTimeString(const DateTimeFormat: String; const DateSeparator, TimeSeparator: Char): String;</prototype>
  1109. <description><p>Returns the current date and time as a string using the specified formatting. The following format specifiers are supported:<br />
  1110. <br />
  1111. d Displays the day as a number without a leading zero (1-31).<br />
  1112. dd Displays the day as a number with a leading zero (01-31).<br />
  1113. ddd Displays the day as an abbreviation (Sun-Sat).<br />
  1114. dddd Displays the day as a full name (Sunday-Saturday).<br />
  1115. ddddd Displays the date using the system's short date format.<br />
  1116. dddddd Displays the date using the system's long date format.<br />
  1117. m Displays the month as a number without a leading zero (1-12).<br />
  1118. If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.<br />
  1119. mm Displays the month as a number with a leading zero (01-12).<br />
  1120. If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.<br />
  1121. mmm Displays the month as an abbreviation (Jan-Dec).<br />
  1122. mmmm Displays the month as a full name (January-December).<br />
  1123. yy Displays the year as a two-digit number (00-99).<br />
  1124. yyyy Displays the year as a four-digit number (0000-9999).<br />
  1125. h Displays the hour without a leading zero (0-23).<br />
  1126. hh Displays the hour with a leading zero (00-23).<br />
  1127. n Displays the minute without a leading zero (0-59).<br />
  1128. nn Displays the minute with a leading zero (00-59).<br />
  1129. s Displays the second without a leading zero (0-59).<br />
  1130. ss Displays the second with a leading zero (00-59).<br />
  1131. t Displays the time using the system's short time format.<br />
  1132. tt Displays the time using the system's long time format.<br />
  1133. am/pm Uses the 12-hour clock for the preceding h or hh specifier.<br />
  1134. Displays 'am' for any hour before noon, and 'pm' for any hour after noon.<br />
  1135. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.<br />
  1136. a/p Uses the 12-hour clock for the preceding h or hh specifier.<br />
  1137. Displays 'a' for any hour before noon, and 'p' for any hour after noon.<br />
  1138. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.<br />
  1139. / Displays the date separator character given by the DateSeparator parameter.<br />
  1140. If DateSeparator is set to #0, the system's date separator character will be used instead.<br />
  1141. : Displays the time separator character given by the TimeSeparator parameter.<br />
  1142. If TimeSeparator is set to #0, the system's time separator character will be used instead.<br />
  1143. 'xx'/"xx" Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.<br />
  1144. <br />
  1145. Format specifiers may be written in upper case as well as in lower case letters--both produce the same result.</p></description>
  1146. <example><pre>
  1147. GetDateTimeString('ddddd', #0, #0);
  1148. GetDateTimeString('ddddd tt', #0, #0);
  1149. GetDateTimeString('dd/mm/yyyy hh:nn:ss', '-', ':');
  1150. </pre></example>
  1151. </function>
  1152. </subcategory>
  1153. <subcategory>
  1154. <function>
  1155. <name>SetLength</name>
  1156. <prototype>procedure SetLength(var S: AnyString; L: LongInt);</prototype>
  1157. <description><p>Sets the length of a string.</p></description>
  1158. </function>
  1159. <function>
  1160. <name>CharToOemBuff</name>
  1161. <prototype>procedure CharToOemBuff(var S: AnsiString);</prototype>
  1162. <description><p>Translates an ANSI string to a string with characters from the OEM-defined character set.</p></description>
  1163. </function>
  1164. <function>
  1165. <name>OemToCharBuff</name>
  1166. <prototype>procedure OemToCharBuff(var S: AnsiString);</prototype>
  1167. <description><p>Translates a string with characters from the OEM-defined character set into an ANSI string.</p></description>
  1168. </function>
  1169. <function>
  1170. <name>Utf8Encode</name>
  1171. <prototype>function Utf8Encode(const S: String): AnsiString;</prototype>
  1172. <description><p>Encodes a Unicode string into a UTF-8 encoded ANSI string.</p></description>
  1173. </function>
  1174. <function>
  1175. <name>Utf8Decode</name>
  1176. <prototype>function Utf8Decode(const S: AnsiString): String;</prototype>
  1177. <description><p>Decodes a UTF-8 encoded ANSI string into a Unicode string.</p></description>
  1178. </function>
  1179. </subcategory>
  1180. <subcategory>
  1181. <function>
  1182. <name>GetMD5OfString</name>
  1183. <prototype>function GetMD5OfString(const S: AnsiString): String;</prototype>
  1184. <description><p>Gets the MD5 sum of the specified string, as a string.</p></description>
  1185. <example><pre>var
  1186. MD5: String;
  1187. begin
  1188. MD5 := GetMD5OfString('Test');
  1189. // MD5 = '0cbc6611f5540bd0809a388dc95a615b'
  1190. end;
  1191. </pre></example>
  1192. </function>
  1193. <function>
  1194. <name>GetMD5OfUnicodeString</name>
  1195. <prototype>function GetMD5OfUnicodeString(const S: String): String;</prototype>
  1196. <description><p>Gets the MD5 sum of the specified string, as a string.</p></description>
  1197. <example><pre>var
  1198. MD5: String;
  1199. begin
  1200. MD5 := GetMD5OfUnicodeString('Test');
  1201. // MD5 = '8e06915d5f5d4f8754f51892d884c477'
  1202. end;
  1203. </pre></example>
  1204. </function>
  1205. <function>
  1206. <name>GetSHA1OfString</name>
  1207. <prototype>function GetSHA1OfString(const S: AnsiString): String;</prototype>
  1208. <description><p>Gets the SHA-1 hash of the specified string, as a string.</p></description>
  1209. <example><pre>var
  1210. SHA1: String;
  1211. begin
  1212. SHA1 := GetSHA1OfString('Test');
  1213. // SHA1 = '640ab2bae07bedc4c163f679a746f7ab7fb5d1fa'
  1214. end;
  1215. </pre></example>
  1216. </function>
  1217. <function>
  1218. <name>GetSHA1OfUnicodeString</name>
  1219. <prototype>function GetSHA1OfUnicodeString(const S: String): String;</prototype>
  1220. <description><p>Gets the SHA-1 hash of the specified string, as a string.</p></description>
  1221. <example><pre>var
  1222. SHA1: String;
  1223. begin
  1224. SHA1 := GetSHA1OfUnicodeString('Test');
  1225. // SHA1 = '9ab696a37604d665dc97134dbee44cfe70451b1a'
  1226. end;
  1227. </pre></example>
  1228. </function>
  1229. <function>
  1230. <name>GetSHA256OfString</name>
  1231. <prototype>function GetSHA256OfString(const S: AnsiString): String;</prototype>
  1232. <description><p>Gets the SHA-256 hash of the specified string, as a string.</p></description>
  1233. <example><pre>var
  1234. SHA256: String;
  1235. begin
  1236. SHA256 := GetSHA256OfString('Test');
  1237. // SHA256 = '532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25'
  1238. end;
  1239. </pre></example>
  1240. </function>
  1241. <function>
  1242. <name>GetSHA256OfUnicodeString</name>
  1243. <prototype>function GetSHA256OfUnicodeString(const S: String): String;</prototype>
  1244. <description><p>Gets the SHA-256 hash of the specified string, as a string.</p></description>
  1245. <example><pre>var
  1246. SHA256: String;
  1247. begin
  1248. SHA256 := GetSHA256OfUnicodeString('Test');
  1249. // SHA256 = 'e6fa3ca87b1b641ab646d3b4933bba8d0970763f030b6578a60abdeae7366247'
  1250. end;
  1251. </pre></example>
  1252. </function>
  1253. </subcategory>
  1254. <subcategory>
  1255. <function>
  1256. <name>SysErrorMessage</name>
  1257. <prototype>function SysErrorMessage(ErrorCode: Integer): String;</prototype>
  1258. <description><p>Returns a localized error message string that corresponds to the given operating system error code.</p></description>
  1259. <remarks><p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx">system error codes on MSDN</a>.</p></remarks>
  1260. </function>
  1261. </subcategory>
  1262. <subcategory>
  1263. <function>
  1264. <name>MinimizePathName</name>
  1265. <prototype>function MinimizePathName(const Filename: String; const Font: TFont; MaxLen: Integer): String;</prototype>
  1266. <description><p>Returns a minimized filename that will not take more than MaxLen pixels to display with the given font. The minimizing is done by replacing the middle part with '...' as needed.</p></description>
  1267. <example><pre>MyLabel.Caption := MinimizePathName(MyPathName, MyLabel.Font, MyLabel.Width);</pre></example>
  1268. <seealso><p><link topic="scriptclasses" anchor="TFont">TFont</link></p></seealso>
  1269. </function>
  1270. </subcategory>
  1271. </category>
  1272. <category>
  1273. <description>Array</description>
  1274. <subcategory>
  1275. <function>
  1276. <name>GetArrayLength</name>
  1277. <prototype>function GetArrayLength(var Arr: Array): LongInt;</prototype>
  1278. <description><p>Gets the length of an array.</p></description>
  1279. </function>
  1280. <function>
  1281. <name>SetArrayLength</name>
  1282. <prototype>procedure SetArrayLength(var Arr: Array; I: LongInt);</prototype>
  1283. <description><p>Sets the length of an array. Always call SetArrayLength before accessing the elements in an array.</p></description>
  1284. </function>
  1285. </subcategory>
  1286. </category>
  1287. <category>
  1288. <description>Stream</description>
  1289. <subcategory>
  1290. <function>
  1291. <name>GetSHA256OfStream</name>
  1292. <prototype>function GetSHA256OfStream(const Stream: TStream): String;</prototype>
  1293. <description><p>Gets the SHA-256 hash of the specified stream, as a string. An exception will be raised upon failure.</p></description>
  1294. <seealso><p><link topic="isxfunc_GetSHA256OfFile">GetSHA256OfFile</link></p></seealso>
  1295. </function>
  1296. </subcategory>
  1297. </category>
  1298. <category>
  1299. <description>Variant</description>
  1300. <subcategory>
  1301. <function>
  1302. <name>Null</name>
  1303. <prototype>function Null: Variant;</prototype>
  1304. <description><p>Returns a variant with a value of Null.</p></description>
  1305. </function>
  1306. <function>
  1307. <name>Unassigned</name>
  1308. <prototype>function Unassigned: Variant;</prototype>
  1309. <description><p>Returns a variant with no value assigned.</p></description>
  1310. </function>
  1311. </subcategory>
  1312. <subcategory>
  1313. <function>
  1314. <name>VarIsEmpty</name>
  1315. <prototype>function VarIsEmpty(const V: Variant): Boolean;</prototype>
  1316. <description><p>Returns True if the specified variant is unassigned.</p></description>
  1317. <seealso><p><link topic="isxfunc_VarIsClear">VarIsClear</link></p></seealso>
  1318. </function>
  1319. <function>
  1320. <name>VarIsClear</name>
  1321. <prototype>function VarIsClear(const V: Variant): Boolean;</prototype>
  1322. <description><p>Returns True if the specified variant's value is undefined.</p></description>
  1323. <seealso><p><link topic="isxfunc_VarIsEmpty">VarIsEmpty</link></p></seealso>
  1324. </function>
  1325. <function>
  1326. <name>VarIsNull</name>
  1327. <prototype>function VarIsNull(const V: Variant): Boolean;</prototype>
  1328. <description><p>Returns True if the specified variant has a value of Null assigned.</p></description>
  1329. </function>
  1330. <function>
  1331. <name>VarType</name>
  1332. <prototype>function VarType(const V: Variant): TVarType;</prototype>
  1333. <description><p>Returns the type code of the specified variant.</p>
  1334. <p>The lower twelve bits of a variant type code (the bits defined by the varTypeMask bit mask) define the type of the variant. The varArray bit is set if the variant is an array of the given type. The varByRef bit is set if the variant is a reference to a value of the given type as opposed to an actual value.</p>
  1335. <p>The following variant type code constants are defined:</p>
  1336. <pre>
  1337. const
  1338. varEmpty = $0000;
  1339. varNull = $0001;
  1340. varSmallInt = $0002;
  1341. varInteger = $0003;
  1342. varSingle = $0004;
  1343. varDouble = $0005;
  1344. varCurrency = $0006;
  1345. varDate = $0007;
  1346. varOleStr = $0008;
  1347. varDispatch = $0009;
  1348. varError = $000A;
  1349. varBoolean = $000B;
  1350. varVariant = $000C;
  1351. varUnknown = $000D;
  1352. varByte = $0011;
  1353. varWord = $0012;
  1354. varLongWord = $0013;
  1355. varInt64 = $0014;
  1356. varStrArg = $0048;
  1357. varString = $0100;
  1358. varAny = $0101;
  1359. varUString = $0102;
  1360. varTypeMask = $0FFF;
  1361. varArray = $2000;
  1362. varByRef = $4000;
  1363. </pre>
  1364. </description>
  1365. </function>
  1366. <function>
  1367. <name>VarArrayGet</name>
  1368. <prototype>function VarArrayGet(var S: Variant; I: Integer): Variant;</prototype>
  1369. <description><p>Returns the specified element of the specified variant array.</p></description>
  1370. </function>
  1371. <function>
  1372. <name>VarArraySet</name>
  1373. <prototype>procedure VarArraySet(C: Variant; I: Integer; var S: Variant);</prototype>
  1374. <description><p>Sets the specified element of the specified variant array.</p></description>
  1375. </function>
  1376. </subcategory>
  1377. </category>
  1378. <category>
  1379. <description>File System</description>
  1380. <subcategory>
  1381. <function>
  1382. <name>DirExists</name>
  1383. <prototype>function DirExists(const Name: String): Boolean;</prototype>
  1384. <description><p>Returns True if the specified directory name exists. The specified name may include a trailing backslash.</p></description>
  1385. </function>
  1386. <function>
  1387. <name>FileExists</name>
  1388. <prototype>function FileExists(const Name: String): Boolean;</prototype>
  1389. <description><p>Returns True if the specified file exists.</p></description>
  1390. </function>
  1391. <function>
  1392. <name>FileOrDirExists</name>
  1393. <prototype>function FileOrDirExists(const Name: String): Boolean;</prototype>
  1394. <description><p>Returns True if the specified directory or file name exists. The specified name may include a trailing backslash.</p></description>
  1395. </function>
  1396. <function>
  1397. <name>FileSize</name>
  1398. <prototype>function FileSize(const Name: String; var Size: Integer): Boolean;</prototype>
  1399. <description><p>Sets Size to the size of the specified file in bytes. Returns True if the file size was set successfully and False otherwise. Only supports file sizes smaller than 2 GB. To get all 64 bits of the file size, use <link topic="isxfunc_FileSize64">FileSize64</link> instead.</p></description>
  1400. </function>
  1401. <function>
  1402. <name>FileSize64</name>
  1403. <prototype>function FileSize64(const Name: String; var Size: Int64): Boolean;</prototype>
  1404. <description><p>Sets Size to the size of the specified file in bytes. Returns True if the file size was set successfully and False otherwise.</p></description>
  1405. </function>
  1406. <function>
  1407. <name>GetSpaceOnDisk</name>
  1408. <prototype>function GetSpaceOnDisk(const Path: String; const InMegabytes: Boolean; var Free, Total: Cardinal): Boolean;</prototype>
  1409. <description><p>Returns the number of free and total bytes or megabytes on a drive. Path specifies a directory on the drive or UNC share to check; it can be either the root (e.g. <tt>C:\</tt>) or an existing subdirectory. The setting of the InMegabytes parameter determines whether it returns figures in bytes or in megabytes (2^20), rounded down. Returns True if successful, False otherwise.</p></description>
  1410. <remarks><p>The figures returned by this function are capped at 2147483647 (2^31-1). Therefore, if InMegaBytes is False, it will return no more than 2147483647 bytes. If InMegaBytes is True, it will return no more than 2147483647 megabytes.</p></remarks>
  1411. <example><pre>var
  1412. Path: String;
  1413. FreeMB, TotalMB: Cardinal;
  1414. begin
  1415. // Get and display free megabytes on the Program Files drive
  1416. Path := ExpandConstant('{autopf}');
  1417. if GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then
  1418. begin
  1419. MsgBox('There are ' + IntToStr(FreeMB) + ' megabytes free on ' +
  1420. Path, mbInformation, MB_OK);
  1421. end
  1422. else begin
  1423. // the function failed
  1424. end;
  1425. end;</pre></example>
  1426. <seealso><p><link topic="isxfunc_GetSpaceOnDisk64">GetSpaceOnDisk64</link></p></seealso>
  1427. </function>
  1428. <function>
  1429. <name>GetSpaceOnDisk64</name>
  1430. <prototype>function GetSpaceOnDisk64(const Path: String; var Free, Total: Int64): Boolean;</prototype>
  1431. <description><p>Returns the number of free and total bytes on a drive. Path specifies a directory on the drive or UNC share to check; it can be either the root (e.g. <tt>C:\</tt>) or an existing subdirectory. Returns True if successful, False otherwise.</p></description>
  1432. <example><pre>var
  1433. Path: String;
  1434. FreeBytes, TotalBytes: Int64;
  1435. begin
  1436. // Get and display free bytes on the Program Files drive
  1437. Path := ExpandConstant('{autopf}');
  1438. if GetSpaceOnDisk64(Path, FreeBytes, TotalBytes) then
  1439. begin
  1440. MsgBox('There are ' + IntToStr(FreeBytes) + ' bytes free on ' +
  1441. Path, mbInformation, MB_OK);
  1442. end
  1443. else begin
  1444. // the function failed
  1445. end;
  1446. end;</pre></example>
  1447. <seealso><p><link topic="isxfunc_GetSpaceOnDisk">GetSpaceOnDisk</link></p></seealso>
  1448. </function>
  1449. </subcategory>
  1450. <subcategory>
  1451. <function>
  1452. <name>FileSearch</name>
  1453. <prototype>function FileSearch(const Name, DirList: String): String;</prototype>
  1454. <description><p>Searches through the directories passed in DirList for a file named Name. DirList should be directory names separated by semicolons. If FileSearch locates a file matching Name, it returns a string containing a fully-qualified path name for that file. If no matching file exists, FileSearch returns an empty string.</p></description>
  1455. </function>
  1456. <function>
  1457. <name>FindFirst</name>
  1458. <prototype>function FindFirst(const FileName: String; var FindRec: TFindRec): Boolean;</prototype>
  1459. <description><p>Retrieves information about the first file matching the wildcard specified by FileName. Returns True if successful.</p>
  1460. <p>TFindRec is defined as:</p>
  1461. <pre>
  1462. TFindRec = record
  1463. Name: String; // name of the found file (no path)
  1464. Attributes: LongWord; // file attributes
  1465. SizeHigh: LongWord; // size of the file, upper 32 bits
  1466. SizeLow: LongWord; // size of the file, lower 32 bits
  1467. CreationTime: TFileTime; // time file was created
  1468. LastAccessTime: TFileTime; // time file was last accessed
  1469. LastWriteTime: TFileTime; // time file was last modified
  1470. AlternateName: String; // file's short name (empty if none)
  1471. FindHandle: THandle; // used internally
  1472. end;
  1473. </pre>
  1474. <p>TFileTime is defined as:</p>
  1475. <pre>
  1476. TFileTime = record
  1477. dwLowDateTime: DWORD;
  1478. dwHighDateTime: DWORD;
  1479. end;
  1480. </pre>
  1481. <p>Valid file attributes are:</p>
  1482. <pre>
  1483. FILE_ATTRIBUTE_READONLY
  1484. FILE_ATTRIBUTE_HIDDEN
  1485. FILE_ATTRIBUTE_SYSTEM
  1486. FILE_ATTRIBUTE_DIRECTORY
  1487. FILE_ATTRIBUTE_ARCHIVE
  1488. FILE_ATTRIBUTE_DEVICE
  1489. FILE_ATTRIBUTE_NORMAL
  1490. FILE_ATTRIBUTE_TEMPORARY
  1491. FILE_ATTRIBUTE_SPARSE_FILE
  1492. FILE_ATTRIBUTE_REPARSE_POINT
  1493. FILE_ATTRIBUTE_COMPRESSED
  1494. FILE_ATTRIBUTE_OFFLINE
  1495. FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
  1496. FILE_ATTRIBUTE_ENCRYPTED
  1497. </pre></description>
  1498. <remarks><p>If FindFirst returns True, call <link topic="isxfunc_FindNext">FindNext</link> to enumerate the rest of the files, and then <link topic="isxfunc_FindClose">FindClose</link>.</p></remarks>
  1499. <example><p>The following example counts the number of files in the Windows System directory.</p>
  1500. <pre>var
  1501. FilesFound: Integer;
  1502. FindRec: TFindRec;
  1503. begin
  1504. FilesFound := 0;
  1505. if FindFirst(ExpandConstant('{sys}\*'), FindRec) then begin
  1506. try
  1507. repeat
  1508. // Don't count directories
  1509. if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
  1510. FilesFound := FilesFound + 1;
  1511. until not FindNext(FindRec);
  1512. finally
  1513. FindClose(FindRec);
  1514. end;
  1515. end;
  1516. MsgBox(IntToStr(FilesFound) + ' files found in the System directory.',
  1517. mbInformation, MB_OK);
  1518. end;</pre></example>
  1519. <seealso><p><link topic="isxfunc_FindNext">FindNext</link><br />
  1520. <link topic="isxfunc_FindClose">FindClose</link></p></seealso>
  1521. </function>
  1522. <function>
  1523. <name>FindNext</name>
  1524. <prototype>function FindNext(var FindRec: TFindRec): Boolean;</prototype>
  1525. <description><p>Retrieves information about the next matching file after a call to <link topic="isxfunc_FindFirst">FindFirst</link>. Returns True if successful.</p></description>
  1526. <example><p>For an example, see the documentation for <link topic="isxfunc_FindFirst">FindFirst</link>.</p></example>
  1527. <seealso><p><link topic="isxfunc_FindFirst">FindFirst</link><br />
  1528. <link topic="isxfunc_FindClose">FindClose</link></p></seealso>
  1529. </function>
  1530. <function>
  1531. <name>FindClose</name>
  1532. <prototype>procedure FindClose(var FindRec: TFindRec);</prototype>
  1533. <description><p>Ends a find sequence, and frees the resources associated with it. You should always call this when <link topic="isxfunc_FindFirst">FindFirst</link> returns True.</p></description>
  1534. <example><p>For an example, see the documentation for <link topic="isxfunc_FindFirst">FindFirst</link>.</p></example>
  1535. <seealso><p><link topic="isxfunc_FindFirst">FindFirst</link><br />
  1536. <link topic="isxfunc_FindNext">FindNext</link></p></seealso>
  1537. </function>
  1538. </subcategory>
  1539. <subcategory>
  1540. <function>
  1541. <name>GetCurrentDir</name>
  1542. <prototype>function GetCurrentDir: String;</prototype>
  1543. <description><p>Returns a string containing the name of the current directory.</p></description>
  1544. </function>
  1545. <function>
  1546. <name>SetCurrentDir</name>
  1547. <prototype>function SetCurrentDir(const Dir: String): Boolean;</prototype>
  1548. <description><p>Sets the current directory. The return value is True if the current directory was successfully changed, or False if an error occurred.</p></description>
  1549. </function>
  1550. <function>
  1551. <name>GetWinDir</name>
  1552. <prototype>function GetWinDir: String;</prototype>
  1553. <description><p>Returns fully qualified path of the Windows directory. Only includes a trailing backslash if the Windows directory is the root directory.</p></description>
  1554. </function>
  1555. <function>
  1556. <name>GetSystemDir</name>
  1557. <prototype>function GetSystemDir: String;</prototype>
  1558. <description><p>Returns fully qualified path of the Windows System directory. Only includes a trailing backslash if the Windows System directory is the root directory.</p></description>
  1559. </function>
  1560. <function>
  1561. <name>GetSysWow64Dir</name>
  1562. <prototype>function GetSysWow64Dir: String;</prototype>
  1563. <description><p>64-bit Windows only: returns fully qualified path of the SysWOW64 directory. This is the actual directory in which 32-bit system files reside. An empty string is returned if this function is called on 32-bit Windows, or if for some reason it fails to retrieve the path on 64-bit Windows (unlikely).</p></description>
  1564. <example><pre>var
  1565. S: String;
  1566. begin
  1567. S := GetSysWow64Dir;
  1568. // Must check the result -- an empty string is returned
  1569. // if there is no SysWOW64 directory.
  1570. if S &lt;&gt; '' then
  1571. MsgBox('SysWOW64 directory: ' + S, mbInformation, MB_OK)
  1572. else
  1573. MsgBox('There is no SysWOW64 directory.', mbInformation, MB_OK);
  1574. end;</pre></example>
  1575. </function>
  1576. <function>
  1577. <name>GetTempDir</name>
  1578. <prototype>function GetTempDir: String;</prototype>
  1579. <description><p>Returns fully qualified path of the temporary directory, with trailing backslash. This does not use the Win32 function GetTempPath, due to platform differences.<br />Gets the temporary file path as follows:<br />1. The path specified by the TMP environment variable.<br />2. The path specified by the TEMP environment variable, if TMP is not defined or if TMP specifies a directory that does not exist.<br />3. The path specified by the USERPROFILE environment variable, if both TMP and TEMP are not defined or specify nonexistent directories.<br />4. The Windows directory, if all the above TMP, TEMP and USERPROFILE are not defined or specify nonexistent directories.</p></description>
  1580. </function>
  1581. <function>
  1582. <name>GetShellFolderByCSIDL</name>
  1583. <prototype>function GetShellFolderByCSIDL(const Folder: Integer; const Create: Boolean): String;</prototype>
  1584. <description><p>Gets the path of the specified shell folder. Folder specifies the value of a CSIDL constant (a complete list of which can be found in ShlObj.h). If Create is True, the folder will be created if it does not exist. On failure, an empty string is returned.</p></description>
  1585. <remarks><p>It is recommended that you always specify True in the Create parameter. Otherwise, the function may fail if the CSIDL value is valid but the directory does not currently exist. (This is a Windows issue.)</p></remarks>
  1586. <example><pre>const
  1587. CSIDL_MYPICTURES = $0027;
  1588. ...
  1589. var
  1590. Path: String;
  1591. begin
  1592. Path := GetShellFolderByCSIDL(CSIDL_MYPICTURES, True);
  1593. if Path &lt;&gt; '' then
  1594. begin
  1595. MsgBox('My Pictures path = ' + Path, mbInformation, MB_OK);
  1596. end
  1597. else
  1598. begin
  1599. // handle failure
  1600. end;
  1601. end;</pre></example>
  1602. </function>
  1603. </subcategory>
  1604. <subcategory>
  1605. <function>
  1606. <name>GetShortName</name>
  1607. <prototype>function GetShortName(const LongName: String): String;</prototype>
  1608. <description><p>Returns the short version of the specified long filename. If the short version of the long filename is not found, the long filename is returned.</p></description>
  1609. </function>
  1610. <function>
  1611. <name>GenerateUniqueName</name>
  1612. <prototype>function GenerateUniqueName(Path: String; const Extension: String): String;</prototype>
  1613. <description><p>Generates a unique filename for a file in the specified path with the specified extension.</p></description>
  1614. </function>
  1615. </subcategory>
  1616. <subcategory>
  1617. <function>
  1618. <name>IsProtectedSystemFile</name>
  1619. <prototype>function IsProtectedSystemFile(const Filename: String): Boolean;</prototype>
  1620. <description><p>Returns True if the specified file is protected by Windows File Protection (and therefore can't be replaced).</p></description>
  1621. </function>
  1622. </subcategory>
  1623. <subcategory>
  1624. <function>
  1625. <name>EnableFsRedirection</name>
  1626. <prototype>function EnableFsRedirection(const Enable: Boolean): Boolean;</prototype>
  1627. <description><p>Controls whether built-in support functions that access files disable WOW64 file system redirection (with <link topic="64bitlimitations">some exceptions</link>). Specify True in the Enable parameter to leave redirection enabled when those functions are called; specify False to disable it. Returns the previous redirection state (True if redirection was enabled).</p>
  1628. <p>If False is passed in the Enable parameter and the user isn't running a supported 64-bit version of Windows, an exception will be raised. To avoid the exception, call <link topic="isxfunc_IsWin64">IsWin64</link> first.</p></description>
  1629. <remarks><p>After you've performed the operation that required changing the redirection state, be sure to restore the previous state. Always use a <tt>try..finally</tt> language construct to ensure that the previous state is restored even if an exception occurs. See below for an example.</p>
  1630. <p>By default, file system redirection is enabled in <link topic="32vs64bitinstalls">32-bit install mode</link>, and disabled in 64-bit install mode.</p>
  1631. <p>This function has no effect on calls to functions in external DLLs. When invoking external functions, file system redirection is always left enabled.</p>
  1632. <p>It is legal to call this function with True in the Enable parameter if the user isn't running a 64-bit version of Windows. In such a case, the call has no effect.</p></remarks>
  1633. <example><p>The following example demonstrates how to launch an executable located in the 64-bit System directory. (Note: In <link topic="32vs64bitinstalls">64-bit install mode</link>, it isn't necessary to call EnableFsRedirection because file system redirection is already disabled by default.)</p>
  1634. <pre>var
  1635. OldState: Boolean;
  1636. ResultCode: Integer;
  1637. begin
  1638. // First verify that the user is running a supported 64-bit version
  1639. // of Windows, because calling EnableFsRedirection(False) will
  1640. // raise an exception otherwise.
  1641. if IsWin64 then
  1642. begin
  1643. // Turn off redirection, so that cmd.exe from the 64-bit System
  1644. // directory is launched.
  1645. OldState := EnableFsRedirection(False);
  1646. try
  1647. Exec(ExpandConstant('{cmd}'), '', '', SW_SHOWNORMAL,
  1648. ewWaitUntilTerminated, ResultCode);
  1649. finally
  1650. // Restore the previous redirection state.
  1651. EnableFsRedirection(OldState);
  1652. end;
  1653. end;
  1654. end;</pre></example>
  1655. </function>
  1656. </subcategory>
  1657. </category>
  1658. <category>
  1659. <description>File</description>
  1660. <subcategory>
  1661. <function>
  1662. <name>Exec</name>
  1663. <prototype>function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;</prototype>
  1664. <description><p>Executes the specified executable or batch file, using the same credentials as Setup/Uninstall. The Wait parameter specifies whether the function should return immediately or wait until the launched process has terminated or is idle. Returns True if the specified file was executed successfully, False otherwise.</p>
  1665. <p>If True is returned and Wait is ewWaitUntilTerminated then ResultCode returns the exit code of the process.</p>
  1666. <p>If False is returned then ResultCode specifies the error that occurred. Use SysErrorMessage(ResultCode) to get a description of the error.</p></description>
  1667. <remarks><p>TExecWait is defined as:</p>
  1668. <p><tt>TExecWait = (ewNoWait, ewWaitUntilTerminated, ewWaitUntilIdle);</tt></p>
  1669. <p>Use the <link topic="isxfunc_ShellExec">ShellExec</link> function instead if you need to launch a file that is not an executable or batch file.</p>
  1670. <p>Do not include quotes in the Filename parameter; the function will add them automatically.</p>
  1671. <p>The WorkingDir parameter can be an empty string, in which case it will try to extract a pathname from the Filename parameter and use that as the initial current directory for the process. If no pathname was specified in Filename, a default directory will be used.</p>
  1672. <p>If you have a single string containing both a filename and parameters (e.g. a command line obtained from an UninstallString registry value), you need not separate them yourself; just pass <tt>'>'</tt> in the Filename parameter, and the full command line in the Params parameter. (Note that when this is done, the function's special platform-independent support for .bat and .cmd files is disabled; it simply passes the specified command line to CreateProcess without any processing.)</p>
  1673. <p>By default, when Setup/Uninstall is running in <link topic="32vs64bitinstalls">64-bit install mode</link>, this function disables WOW64 file system redirection when calling CreateProcess. It is possible to override this by calling <link topic="isxfunc_EnableFsRedirection">EnableFsRedirection</link>.</p>
  1674. <p>Can't be used to execute Setup itself until the installation has started.</p>
  1675. <p><i>Note: compared to ISPP's Exec the ShowCmd and Wait parameters are swapped!</i></p></remarks>
  1676. <example><pre>var
  1677. ResultCode: Integer;
  1678. begin
  1679. // Launch Notepad and wait for it to terminate
  1680. if Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOWNORMAL,
  1681. ewWaitUntilTerminated, ResultCode) then
  1682. begin
  1683. // handle success if necessary; ResultCode contains the exit code
  1684. end
  1685. else begin
  1686. // handle failure if necessary; ResultCode contains the error code
  1687. end;
  1688. end;</pre></example>
  1689. <seealso><p><link topic="isxfunc_ExecAndCaptureOutput">ExecAndCaptureOutput</link><br />
  1690. <link topic="isxfunc_ExecAndLogOutput">ExecAndLogOutput</link><br />
  1691. <link topic="isxfunc_ExecAsOriginalUser">ExecAsOriginalUser</link></p></seealso>
  1692. </function>
  1693. <function>
  1694. <name>ExecAsOriginalUser</name>
  1695. <prototype>function ExecAsOriginalUser(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;</prototype>
  1696. <description><p>Executes the specified executable or batch file, using the (normally non-elevated) credentials of the user that started Setup initially. See <link topic="isxfunc_Exec">Exec</link> and the [Run] section flag <tt>runasoriginaluser</tt> for more information.</p></description>
  1697. <remarks><p>This function is not supported at uninstall time.</p>
  1698. <p>In very unusual failure cases (e.g. if the initial Setup process died unexpectedly), it is possible for this function to raise an exception instead of just returning False.</p></remarks>
  1699. </function>
  1700. <function>
  1701. <name>ShellExec</name>
  1702. <prototype>function ShellExec(const Verb, Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ErrorCode: Integer): Boolean;</prototype>
  1703. <description><p>Opens the specified file or performs another action specified by Verb, using the same credentials as Setup/Uninstall. The filename can be an executable file, a document file, a folder, or a URL. Verb may be an empty string, in which case the default verb for the file type is used (usually "open"). The Wait parameter specifies whether the function should return immediately or wait until the launched process has terminated or is idle. Returns True if the specified file was opened successfully, False otherwise. If False is returned then ErrorCode specifies the error that occurred. Use SysErrorMessage(ErrorCode) to get a description of the error.</p></description>
  1704. <remarks><p>TExecWait is defined as:</p>
  1705. <p><tt>TExecWait = (ewNoWait, ewWaitUntilTerminated, ewWaitUntilIdle);</tt></p>
  1706. <p>Note that passing a Wait value other than <tt>ewNoWait</tt> will have no effect if a new process isn't spawned (for example, if the file is opened inside an already-running instance of the program that handles the file type).</p>
  1707. <p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx">system error codes on MSDN</a>.</p>
  1708. <p>Can't be used to execute Setup itself until the installation has started.</p></remarks>
  1709. <example><pre>var
  1710. ErrorCode: Integer;
  1711. begin
  1712. if not ShellExec('', ExpandConstant('{app}\filename.rtf'),
  1713. '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) then
  1714. begin
  1715. // handle failure if necessary
  1716. end;
  1717. end;</pre></example>
  1718. <seealso><p><link topic="isxfunc_ShellExecAsOriginalUser">ShellExecAsOriginalUser</link></p></seealso>
  1719. </function>
  1720. <function>
  1721. <name>ShellExecAsOriginalUser</name>
  1722. <prototype>function ShellExecAsOriginalUser(const Verb, Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ErrorCode: Integer): Boolean;</prototype>
  1723. <description><p>Opens the specified file or performs another action specified by Verb, using the (normally non-elevated) credentials of the user that started Setup initially. See <link topic="isxfunc_ShellExec">ShellExec</link> and the [Run] section flag <tt>runasoriginaluser</tt> for more information.</p></description>
  1724. <remarks><p>This function is not supported at uninstall time.</p>
  1725. <p>In very unusual failure cases (e.g. if the initial Setup process died unexpectedly), it is possible for this function to raise an exception instead of just returning False.</p>
  1726. <p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx">system error codes on MSDN</a>.</p></remarks>
  1727. </function>
  1728. </subcategory>
  1729. <subcategory>
  1730. <function>
  1731. <name>ExtractTemporaryFile</name>
  1732. <prototype>procedure ExtractTemporaryFile(const FileName: String);</prototype>
  1733. <description><p>Extracts the specified file from the [Files] section to a temporary directory. To find the location of the temporary directory, use <tt>ExpandConstant('{tmp}')</tt>.</p>
  1734. <p>The extracted files are automatically deleted when Setup exits.</p>
  1735. <p>An exception will be raised if the file wasn't extracted successfully, if the file wasn't found, or if the file was found but couldn't be processed because of its MinVersion and/or OnlyBelowVersion parameters.</p></description>
  1736. <remarks><p>Use <tt>Flags: dontcopy</tt> in the [Files] section to tell Setup to skip the file during the normal file copying stage.</p>
  1737. <p>Use <tt>Flags: noencryption</tt> in the [Files] section if encryption is enabled and you call the ExtractTemporaryFile function prior to the user entering the correct password.</p>
  1738. <p>When solid compression is enabled, be sure to list your temporary files at (or near) the top of the [Files] section. In order to extract an arbitrary file in a solid-compressed installation, Setup must first decompress all prior files (to a temporary buffer in memory). This can result in a substantial delay if a number of other files are listed above the specified file in the [Files] section.</p></remarks>
  1739. <seealso><p><link topic="isxfunc_ExtractTemporaryFiles">ExtractTemporaryFiles</link><br />
  1740. <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link></p></seealso>
  1741. <example><pre>[Files]
  1742. Source: "Readme.txt"; Flags: dontcopy noencryption
  1743. [Code]
  1744. function InitializeSetup: Boolean;
  1745. var
  1746. S: AnsiString;
  1747. begin
  1748. // Show the contents of Readme.txt (non Unicode) in a message box
  1749. ExtractTemporaryFile('Readme.txt');
  1750. if LoadStringFromFile(ExpandConstant('{tmp}\Readme.txt'), S) then
  1751. begin
  1752. MsgBox(S, mbInformation, MB_OK);
  1753. end;
  1754. Result := True;
  1755. end;</pre></example>
  1756. </function>
  1757. <function>
  1758. <name>ExtractTemporaryFiles</name>
  1759. <prototype>function ExtractTemporaryFiles(const Pattern: String): Integer;</prototype>
  1760. <description><p>Extracts the files matching the wildcard specified by Pattern from the [Files] section to a temporary directory. Returns the number of extracted files. To find the location of the temporary directory, use <tt>ExpandConstant('{tmp}')</tt>.</p>
  1761. <p>The extracted files are automatically deleted when Setup exits.</p>
  1762. <p>An exception will be raised if no files were extracted successfully, no files were found, or if files were found but none could be processed because of their MinVersion and/or OnlyBelowVersion parameters.</p></description>
  1763. <remarks><p>Use <tt>Flags: dontcopy</tt> in the [Files] section to tell Setup to skip the file during the normal file copying stage.</p>
  1764. <p>When solid compression is enabled, be sure to list your temporary files at (or near) the top of the [Files] section. In order to extract an arbitrary file in a solid-compressed installation, Setup must first decompress all prior files (to a temporary buffer in memory). This can result in a substantial delay if a number of other files are listed above the specified file in the [Files] section.</p></remarks>
  1765. <seealso><p><link topic="isxfunc_ExtractTemporaryFile">ExtractTemporaryFile</link></p></seealso>
  1766. <example><pre>[Files]
  1767. Source: "Readme.txt"; Flags: dontcopy
  1768. Source: "MyProg.exe"; DestDir: "{app}"
  1769. Source: "MyProg.chm"; DestDir: "{app}"
  1770. [Code]
  1771. function InitializeSetup: Boolean;
  1772. var
  1773. S: AnsiString;
  1774. ResultCode: Integer;
  1775. begin
  1776. // Show the contents of Readme.txt (non Unicode) in a message box
  1777. ExtractTemporaryFiles('{tmp}\Readme.txt');
  1778. if LoadStringFromFile(ExpandConstant('{tmp}\Readme.txt'), S) then
  1779. begin
  1780. MsgBox(S, mbInformation, MB_OK);
  1781. end;
  1782. // Extract all MyProg files and launch it. Note how {app} is left unexpanded.
  1783. ExtractTemporaryFiles('{app}\MyProg.*');
  1784. ExecAsOriginalUser(ExpandConstant('{tmp}\')+'{app}\MyProg.exe', '', '',
  1785. SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  1786. Result := True;
  1787. end;</pre></example>
  1788. </function>
  1789. <function>
  1790. <name>DownloadTemporaryFile</name>
  1791. <prototype>function DownloadTemporaryFile(const Url, BaseName, RequiredSHA256OfFile: String; const OnDownloadProgress: TOnDownloadProgress): Int64;</prototype>
  1792. <description><p>Downloads the file from the specified URL to a temporary directory using the specified name. To find the location of the temporary directory, use <tt>ExpandConstant('{tmp}')</tt>.</p>
  1793. <p>If RequiredSHA256OfFile is set it will compare this to the SHA-256 of the downloaded file and raise an exception if the hashes don't match.</p>
  1794. <p>An exception will be raised if there was an error. Otherwise, returns the number of bytes downloaded. Returns 0 if RequiredSHA256OfFile is set and the file was already downloaded.</p>
  1795. <p>Supports HTTPS (but not expired or self-signed certificates) and HTTP. Redirects are automatically followed and proxy settings are automatically used. Safe to use from services.</p>
  1796. <p>For basic authentication use <link topic="isxfunc_SetDownloadCredentials">SetDownloadCredentials</link>.</p>
  1797. <p>Set OnDownloadProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p></description>
  1798. <remarks><p>TOnDownloadProgress is defined as:</p>
  1799. <p><tt>TOnDownloadProgress = function(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;</tt></p>
  1800. <p>ProgressMax will be 0 if the file size is still unknown. Return True to allow the download to continue, False otherwise.</p></remarks>
  1801. <example><pre>
  1802. [Code]
  1803. function OnDownloadProgress(const Url, Filename: String; const Progress, ProgressMax: Int64): Boolean;
  1804. begin
  1805. if ProgressMax &lt;&gt; 0 then
  1806. Log(Format(' %d of %d bytes done.', [Progress, ProgressMax]))
  1807. else
  1808. Log(Format(' %d bytes done.', [Progress]));
  1809. Result := True;
  1810. end;
  1811. function InitializeSetup: Boolean;
  1812. begin
  1813. try
  1814. DownloadTemporaryFile('https://jrsoftware.org/download.php/is.exe?dontcount=1', 'innosetup-latest.exe', '', @OnDownloadProgress);
  1815. DownloadTemporaryFile('https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1', 'ISCrypt.dll', '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc', @OnDownloadProgress);
  1816. Result := True;
  1817. except
  1818. Log(GetExceptionMessage);
  1819. Result := False;
  1820. end;
  1821. end;</pre>
  1822. <p>See <i>CodeDownloadFiles.iss</i> for another example which uses <link topic="isxfunc_CreateDownloadPage">CreateDownloadPage</link> instead.</p>
  1823. <p>See <i>DownloadFiles.iss</i> for an example of file download using just a [Files] entry.</p></example>
  1824. <seealso><p><link topic="isxfunc_SetDownloadCredentials">SetDownloadCredentials</link><br />
  1825. <link topic="isxfunc_DownloadTemporaryFileWithISSigVerify">DownloadTemporaryFileWithISSigVerify</link><br />
  1826. <link topic="isxfunc_DownloadTemporaryFileSize">DownloadTemporaryFileSize</link><br />
  1827. <link topic="isxfunc_DownloadTemporaryFileDate">DownloadTemporaryFileDate</link><br />
  1828. <link topic="isxfunc_CreateDownloadPage">CreateDownloadPage</link><br />
  1829. <link topic="isxfunc_ExtractTemporaryFile">ExtractTemporaryFile</link><br />
  1830. <link topic="isxfunc_ExtractArchive">ExtractArchive</link></p></seealso>
  1831. </function>
  1832. <function>
  1833. <name>DownloadTemporaryFileWithISSigVerify</name>
  1834. <prototype>function DownloadTemporaryFileWithISSigVerify(const Url, ISSigUrl, BaseName: String; const AllowedKeysRuntimeIDs: TStringList; const OnDownloadProgress: TOnDownloadProgress): Int64;</prototype>
  1835. <description><p>Like <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link>, but downloads an .issig signature file first from the specified second URL and uses it to verify the main file downloaded from the first URL.</p>
  1836. <p>If the second URL is an empty string, Setup will instead append ".issig" (without quotes) to the path portion of the first URL. It will then use the result as the URL to download the .issig signature file from.</p>
  1837. <p>Verification uses the specified allowed keys, looked up using <link topic="issigkeyssection">[ISSigKeys] section</link> parameter <tt>RuntimeID</tt>. To allow all keys set AllowedKeysRuntimeIDs to <tt>nil</tt>.</p>
  1838. <p>An exception will be raised if there was an error. Otherwise, returns the number of bytes downloaded for the main file from the first URL. Returns 0 if the main file was already downloaded and still verified.</p></description>
  1839. <seealso><p><link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link><br/>
  1840. <link topic="issig">.issig Signatures: Introduction</link><br/>
  1841. <link topic="isxfunc_ISSigVerify">ISSigVerify</link></p></seealso>
  1842. <example><pre>
  1843. [Code]
  1844. function InitializeSetup: Boolean;
  1845. begin
  1846. try
  1847. DownloadTemporaryFileWithISSigVerify(
  1848. 'https://jrsoftware.org/download.php/myprog-extrareadmes.7z', '',
  1849. 'myprog-extrareadmes.7z', nil, nil);
  1850. Result := True;
  1851. except
  1852. Log(GetExceptionMessage);
  1853. Result := False;
  1854. end;
  1855. end;</pre></example>
  1856. </function>
  1857. <function>
  1858. <name>SetDownloadCredentials</name>
  1859. <prototype>procedure SetDownloadCredentials(const User, Pass: String);</prototype>
  1860. <description><p>Sets the basic authentication username and password for all following downloads done by <tt>DownloadTemporaryFile</tt>, <tt>DownloadTemporaryFileWithISSigVerify</tt>, <tt>DownloadTemporaryFileSize</tt>, and <tt>DownloadTemporaryFileDate</tt>.</p>
  1861. <p>Specify an empty username or password to unset the username or password.</p></description>
  1862. <seealso><p><link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link><br/>
  1863. <link topic="isxfunc_DownloadTemporaryFileWithISSigVerify">DownloadTemporaryFileWithISSigVerify</link><br/>
  1864. <link topic="isxfunc_DownloadTemporaryFileSize">DownloadTemporaryFileSize</link><br/>
  1865. <link topic="isxfunc_DownloadTemporaryFileDate">DownloadTemporaryFileDate</link></p></seealso>
  1866. </function>
  1867. <function>
  1868. <name>DownloadTemporaryFileSize</name>
  1869. <prototype>function DownloadTemporaryFileSize(const Url): Int64;</prototype>
  1870. <description><p>Returns the size of the file from the specified URL, without downloading the file. If the server does not provide the size, -1 will be returned.</p>
  1871. <p>An exception will be raised if there was an error.</p>
  1872. <p>See <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link> for other considerations.</p></description>
  1873. </function>
  1874. <function>
  1875. <name>DownloadTemporaryFileDate</name>
  1876. <prototype>function DownloadTemporaryFileDate(const Url): String;</prototype>
  1877. <description><p>Returns the last modified date of the file from the specified URL, without downloading the file. If the server does not provide the last modified file date, '' will be returned.</p>
  1878. <p>An exception will be raised if there was an error.</p>
  1879. <p>See <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link> for other considerations.</p></description>
  1880. </function>
  1881. <function>
  1882. <name>ExtractArchive</name>
  1883. <prototype>procedure ExtractArchive(const ArchiveFileName, DestDir, Password: String; const FullPaths: Boolean; const OnExtractionProgress: TOnExtractionProgress);</prototype>
  1884. <description><p>Extracts the specified archive to the specified directory, with or without preserving full path names.</p>
  1885. <p>An exception will be raised if there was an error.</p>
  1886. <p>The supported archive formats, beyond .7z, and the support for password-protected and multi-volume archives, depend on the <link topic="setup_archiveextraction">ArchiveExtraction</link> [Setup] section directive.</p>
  1887. <p>To allow the extraction of archives with custom extensions, such as self-extracting archives, call <link topic="isxfunc_MapArchiveExtensions">MapArchiveExtensions</link>.</p>
  1888. <p>Set OnExtractionProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p></description>
  1889. <remarks><p>TOnExtractionProgress is defined as:</p>
  1890. <p><tt>TOnExtractionProgress = function(const ArchiveName, FileName: String; const Progress, ProgressMax: Int64): Boolean;</tt></p>
  1891. <p>Return True to allow the extraction to continue, False otherwise.</p></remarks>
  1892. <example><p>See <i>DownloadFiles.iss</i> for an example of archive extraction using just a [Files] entry.</p></example>
  1893. <seealso><p><link topic="isxfunc_CreateExtractionPage">CreateExtractionPage</link><br />
  1894. <link topic="isxfunc_MapArchiveExtensions">MapArchiveExtensions</link><br />
  1895. <link topic="isxfunc_CreateDownloadPage">CreateDownloadPage</link><br />
  1896. <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link><br />
  1897. <link topic="isxfunc_ExtractTemporaryFile">ExtractTemporaryFile</link></p></seealso>
  1898. </function>
  1899. <function>
  1900. <name>MapArchiveExtensions</name>
  1901. <prototype>procedure MapArchiveExtensions(const DestExt, SourceExt: String);</prototype>
  1902. <description><p>Allows files with a specified destination extension, such as .exe, to be treated as if they have a different source extension, such as .7z, for extraction purposes.</p>
  1903. <p>An exception will be raised if there was an error.</p></description>
  1904. <remarks><p>Calls to this function are ignored if the <link topic="setup_archiveextraction">ArchiveExtraction</link> [Setup] section directive is set to <tt>basic</tt>.</p></remarks>
  1905. <seealso><p><link topic="isxfunc_ExtractArchive">ExtractArchive</link><br/>
  1906. <link topic="isxfunc_CreateExtractionPage">CreateExtractionPage</link></p></seealso>
  1907. <example><pre>
  1908. [Files]
  1909. Source: "{src}\My7ZipSFX.exe; DestDir: "{app}"; Flags: external extractarchive recursesubdirs createallsubdirs ignoreversion
  1910. [Code]
  1911. function InitializeSetup: Boolean;
  1912. begin
  1913. MapArchiveExtensions('.exe', '.7z');
  1914. end;</pre></example>
  1915. </function>
  1916. </subcategory>
  1917. <subcategory>
  1918. <function>
  1919. <name>GetMD5OfFile</name>
  1920. <prototype>function GetMD5OfFile(const Filename: String): String;</prototype>
  1921. <description><p>Gets the MD5 sum of the specified file, as a string. An exception will be raised upon failure.</p></description>
  1922. </function>
  1923. <function>
  1924. <name>GetSHA1OfFile</name>
  1925. <prototype>function GetSHA1OfFile(const Filename: String): String;</prototype>
  1926. <description><p>Gets the SHA-1 hash of the specified file, as a string. An exception will be raised upon failure.</p></description>
  1927. </function>
  1928. <function>
  1929. <name>GetSHA256OfFile</name>
  1930. <prototype>function GetSHA256OfFile(const Filename: String): String;</prototype>
  1931. <description><p>Gets the SHA-256 hash of the specified file, as a string. An exception will be raised upon failure.</p></description>
  1932. <seealso><p><link topic="isxfunc_GetSHA256OfStream">GetSHA256OfStream</link></p></seealso>
  1933. </function>
  1934. </subcategory>
  1935. <subcategory>
  1936. <function>
  1937. <name>ISSigVerify</name>
  1938. <prototype>function ISSigVerify(const AllowedKeysRuntimeIDs: TStringList; const Filename: String; const VerifyFilename: Boolean; const KeepOpen: Boolean): TFileStream;</prototype>
  1939. <description><p>Verifies the signature of the specified file using the specified allowed keys, looked up using <link topic="issigkeyssection">[ISSigKeys] section</link> parameter <tt>RuntimeID</tt>. To allow all keys set AllowedKeysRuntimeIDs to <tt>nil</tt>. An exception will be raised upon failure.</p>
  1940. <p>If VerifyFilename is set to False the verification allows signatures for a different filename. It is recommended that you only set it to False if you don't know the name the file had when the signature was created. The size and hash of the file must always match.</p>
  1941. <p>Returns a handle to the still open file if KeepOpen is set to True, <tt>nil</tt> otherwise. It is recommended that you always set it to True if you plan to use the file for anything after verification. Otherwise, you risk creating a Time-Of-Check to Time-Of-Use (TOCTOU) problem.</p></description>
  1942. <example><pre>var
  1943. F: TFileStream;
  1944. begin
  1945. F := ISSigVerify([], Filename, True);
  1946. try
  1947. // Use file
  1948. finally
  1949. F.Free;
  1950. end;
  1951. end;</pre></example>
  1952. <seealso><p><link topic="issig">.issig Signatures: Introduction</link><br/>
  1953. <link topic="isxfunc_DownloadTemporaryFileWithISSigVerify">DownloadTemporaryFileWithISSigVerify</link></p></seealso>
  1954. </function>
  1955. </subcategory>
  1956. <subcategory>
  1957. <function>
  1958. <name>RenameFile</name>
  1959. <prototype>function RenameFile(const OldName, NewName: String): Boolean;</prototype>
  1960. <description><p>Attempts to change the name of the file or directory specified by OldFile to NewFile. If the operation succeeds, RenameFile returns True. If it cannot rename the file (for example, if a file called NewName already exists), it returns False.</p></description>
  1961. <remarks><p>Can't be used to rename Setup itself until the installation has started.</p></remarks>
  1962. </function>
  1963. <function>
  1964. <name>CopyFile</name>
  1965. <prototype>function CopyFile(const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;</prototype>
  1966. <description><p>Copies ExistingFile to NewFile, preserving time stamp and file attributes.<br />If FailIfExists is True it will fail if NewFile already exists, otherwise it will overwrite it.<br />Returns True if successful, False otherwise.</p>
  1967. <p>Files copied using <tt>CopyFile</tt> are not automatically uninstalled. Consider using a [Files] entry with the <tt>external</tt> flag set instead.</p></description>
  1968. <remarks><p>Can't be used to copy Setup itself until the installation has started.</p></remarks>
  1969. </function>
  1970. <function>
  1971. <name>DeleteFile</name>
  1972. <prototype>function DeleteFile(const FileName: String): Boolean;</prototype>
  1973. <description><p>Erases the file named by FileName from the disk.<br />If the file cannot be deleted or does not exist, the function returns False.</p></description>
  1974. </function>
  1975. <function>
  1976. <name>DelayDeleteFile</name>
  1977. <prototype>procedure DelayDeleteFile(const Filename: String; const Tries: Integer);</prototype>
  1978. <description><p>Attempts to delete Filename, retrying up to Tries times if the file is in use. It delays 250 msec between tries.</p></description>
  1979. </function>
  1980. <function>
  1981. <name>SetNTFSCompression</name>
  1982. <prototype>function SetNTFSCompression(const FileOrDir: String; Compress: Boolean): Boolean;</prototype>
  1983. <description><p>Changes the NTFS compression state of a file or directory. Returns True if successful.</p></description>
  1984. <remarks><p>If a directory is specified, the compression state of any files present in the directory will not be changed.</p></remarks>
  1985. </function>
  1986. </subcategory>
  1987. <subcategory>
  1988. <function>
  1989. <name>LoadStringFromFile</name>
  1990. <prototype>function LoadStringFromFile(const FileName: String; var S: AnsiString): Boolean;</prototype>
  1991. <description><p>Loads the specified binary or non Unicode text file into the specified string. Returns True if successful, False otherwise.</p></description>
  1992. <remarks><p>Use <link topic="isxfunc_LoadStringFromLockedFile">LoadStringFromLockedFile</link> to load even if the file is already opened for writing by another program.</p></remarks>
  1993. <seealso><p><link topic="isxfunc_LoadStringsFromFile">LoadStringsFromFile</link></p></seealso>
  1994. </function>
  1995. <function>
  1996. <name>LoadStringFromLockedFile</name>
  1997. <prototype>function LoadStringFromLockedFile(const FileName: String; var S: AnsiString): Boolean;</prototype>
  1998. <description><p>Loads the specified binary or non Unicode text file into the specified string, even if the file is already opened for writing by another program. Returns True if successful, False otherwise.</p></description>
  1999. <seealso><p><link topic="isxfunc_LoadStringFromFile">LoadStringFromFile</link></p></seealso>
  2000. </function>
  2001. <function>
  2002. <name>LoadStringsFromFile</name>
  2003. <prototype>function LoadStringsFromFile(const FileName: String; var S: TArrayOfString): Boolean;</prototype>
  2004. <description><p>Loads the specified text file into the specified string array. UTF-8 encoded files with or without a BOM are also supported. Returns True if successful, False otherwise.</p></description>
  2005. <remarks><p>Use <link topic="isxfunc_LoadStringsFromLockedFile">LoadStringsFromLockedFile</link> to load even if the file is already opened for writing by another program.</p></remarks>
  2006. <seealso><p><link topic="isxfunc_LoadStringFromFile">LoadStringFromFile</link></p></seealso>
  2007. </function>
  2008. <function>
  2009. <name>LoadStringsFromLockedFile</name>
  2010. <prototype>function LoadStringsFromLockedFile(const FileName: String; var S: TArrayOfString): Boolean;</prototype>
  2011. <description><p>Loads the specified text file into the specified string array, even if the file is already opened for writing by another program. UTF-8 encoded files with or without a BOM are also supported. Returns True if successful, False otherwise.</p></description>
  2012. <seealso><p><link topic="isxfunc_LoadStringsFromFile">LoadStringsFromFile</link></p></seealso>
  2013. </function>
  2014. <function>
  2015. <name>SaveStringToFile</name>
  2016. <prototype>function SaveStringToFile(const FileName: String; const S: AnsiString; const Append: Boolean): Boolean;</prototype>
  2017. <description><p>Saves the specified string to the specified file. If Append is True and the specified file already exists, it will be appended to instead of overwritten. Returns True if successful, False otherwise.</p></description>
  2018. <remarks><p>This function does not automatically write a line break before or after the string. If Append is True and the existing file did not end in a line break, the function will effectively append to the existing last line. To avoid this you can put line break characters before and/or after your string:</p>
  2019. <p><tt>SaveStringToFile('c:\filename.txt', #13#10 + 'the string' + #13#10, True);</tt></p></remarks>
  2020. </function>
  2021. <function>
  2022. <name>SaveStringsToFile</name>
  2023. <prototype>function SaveStringsToFile(const FileName: String; const S: TArrayOfString; const Append: Boolean): Boolean;</prototype>
  2024. <description><p>Saves the specified string array to the specified file with ASCII encoding. If Append is True and the specified file already exists, it will be appended to instead of overwritten. Returns True if successful, False otherwise.</p></description>
  2025. <seealso><p><link topic="isxfunc_SaveStringsToUTF8File">SaveStringsToUTF8File</link><br />
  2026. <link topic="isxfunc_SaveStringsToUTF8FileWithoutBOM">SaveStringsToUTF8FileWithoutBOM</link></p></seealso>
  2027. </function>
  2028. <function>
  2029. <name>SaveStringsToUTF8File</name>
  2030. <prototype>function SaveStringsToUTF8File(const FileName: String; const S: TArrayOfString; const Append: Boolean): Boolean;</prototype>
  2031. <description><p>Saves the specified string array to the specified file with UTF-8 encoding with a BOM. If Append is True and the specified file already exists, it will be appended to instead of overwritten. Returns True if successful, False otherwise.</p></description>
  2032. <seealso><p><link topic="isxfunc_SaveStringsToFile">SaveStringsToFile</link><br />
  2033. <link topic="isxfunc_SaveStringsToUTF8FileWithoutBOM">SaveStringsToUTF8FileWithoutBOM</link></p></seealso>
  2034. </function>
  2035. <function>
  2036. <name>SaveStringsToUTF8FileWithoutBOM</name>
  2037. <prototype>function SaveStringsToUTF8FileWithoutBOM(const FileName: String; const S: TArrayOfString; const Append: Boolean): Boolean;</prototype>
  2038. <description><p>Saves the specified string array to the specified file with UTF-8 encoding without a BOM. If Append is True and the specified file already exists, it will be appended to instead of overwritten. Returns True if successful, False otherwise.</p></description>
  2039. <seealso><p><link topic="isxfunc_SaveStringsToFile">SaveStringsToFile</link><br />
  2040. <link topic="isxfunc_SaveStringsToUTF8File">SaveStringsToUTF8File</link></p></seealso>
  2041. </function>
  2042. </subcategory>
  2043. <subcategory>
  2044. <function>
  2045. <name>CreateDir</name>
  2046. <prototype>function CreateDir(const Dir: String): Boolean;</prototype>
  2047. <description><p>Creates a new directory. The return value is True if a new directory was successfully created, or False if an error occurred.</p></description>
  2048. </function>
  2049. <function>
  2050. <name>ForceDirectories</name>
  2051. <prototype>function ForceDirectories(Dir: String): Boolean;</prototype>
  2052. <description><p>Creates all the directories along the specified directory path all at once. If the first directories in the path do exist, but the latter ones don't, ForceDirectories creates just the ones that don't exist. Returns True if successful, False otherwise.</p></description>
  2053. </function>
  2054. <function>
  2055. <name>RemoveDir</name>
  2056. <prototype>function RemoveDir(const Dir: String): Boolean;</prototype>
  2057. <description><p>Deletes an existing empty directory. The return value is True if the empty directory was successfully deleted, or False if an error occurred.</p></description>
  2058. </function>
  2059. <function>
  2060. <name>DelTree</name>
  2061. <prototype>function DelTree(const Path: String; const IsDir, DeleteFiles, DeleteSubdirsAlso: Boolean): Boolean;</prototype>
  2062. <description><p>Deletes the specified directory if IsDir is set to True, or files/directories matching a wildcard if IsDir is set to False. Returns True if it was able to successfully remove everything.</p>
  2063. <p>If DeleteFiles is set to True, files inside the specified directory will be deleted if IsDir is True, or files matching the specified wildcard (including those with hidden, system, and read-only attributes) will be deleted if IsDir is False.</p>
  2064. <p>If DeleteFiles and DeleteSubdirsAlso are both set to True, subdirectories (and their contents) will be deleted in addition to files.</p></description>
  2065. <remarks><p>This function will remove directories that are reparse points, but it will not recursively delete files/directories inside them.</p></remarks>
  2066. <example><pre>begin
  2067. // Delete the directory C:\Test and everything inside it
  2068. DelTree('C:\Test', True, True, True);
  2069. // Delete files matching C:\Test\*.tmp
  2070. DelTree('C:\Test\*.tmp', False, True, False);
  2071. // Delete all files and directories inside C:\Test
  2072. // but leave the directory itself
  2073. DelTree('C:\Test\*', False, True, True);
  2074. end;</pre></example>
  2075. </function>
  2076. </subcategory>
  2077. <subcategory>
  2078. <function>
  2079. <name>CreateShellLink</name>
  2080. <prototype>function CreateShellLink(const Filename, Description, ShortcutTo, Parameters, WorkingDir, IconFilename: String; const IconIndex, ShowCmd: Integer): String;</prototype>
  2081. <description><p>Creates a shortcut to a file or folder. Returns the resulting filename of the link, which may differ from <tt>Filename</tt> if it ended up creating a .pif file instead of a .lnk file. On failure, an exception will be raised.</p>
  2082. <p><b>Parameters:</b><br />
  2083. <i>Filename</i><br />Filename of the shortcut file to be created. This should be the full path and must end with ".lnk".<br />
  2084. <i>Description</i><br />Description of the link. This will be displayed on a supporting OS when the user hovers the mouse over the file or shows the properties.<br />
  2085. <i>ShortcutTo</i><br />Target file for the shortcut. This must be the full path to the file. Double quotation marks to surround the path will be added automatically.<br />
  2086. <i>Parameters</i><br />Parameters to pass to the target file of the shortcut. Parameters which may include spaces should have double quote marks surrounding them. e.g. <tt>ExpandConstant('"{app}\foo"')</tt><br />
  2087. <i>WorkingDir</i><br />Working directory for the target file. This should be set to an absolute directory.<br />
  2088. <i>IconFilename</i><br />Path to file to supply the icon. If this is left as the empty string then the system default icon for the target file will be used.<br />
  2089. <i>IconIndex</i><br />Zero-based index of the icon.<br />
  2090. <i>ShowCmd</i><br />One of the SW_* constants</p></description>
  2091. <remarks><p>You will most likely want to remove this shortcut on uninstall. Do this by adding an entry to the <tt>UninstallDelete</tt> section.</p></remarks>
  2092. <example><pre>CreateShellLink(
  2093. ExpandConstant('{app}\config\Open licence database.lnk'),
  2094. 'Opens the licence database in SQLite',
  2095. ExpandConstant('{app}\config\sqlite.exe'),
  2096. ExpandConstant('"{app}\config\licences.db"'),
  2097. ExpandConstant('{app}\config'),
  2098. '',
  2099. 0,
  2100. SW_SHOWNORMAL);</pre></example>
  2101. </function>
  2102. <function>
  2103. <name>UnpinShellLink</name>
  2104. <prototype>function UnpinShellLink(const Filename: String): Boolean;</prototype>
  2105. <description><p>Attempt to unpin the shortcut with the specified filename. Returns True if the shortcut was successfully removed from the list of pinned items and/or the taskbar, or if the shortcut was not pinned at all.</p></description>
  2106. </function>
  2107. </subcategory>
  2108. <subcategory>
  2109. <function>
  2110. <name>RegisterServer</name>
  2111. <prototype>procedure RegisterServer(const Is64Bit: Boolean; const Filename: String; const FailCriticalErrors: Boolean);</prototype>
  2112. <description><p>Registers the DLL/OCX with the specified filename. If Is64Bit is True, the DLL/OCX will be loaded as a 64-bit image and registered in a 64-bit process. If FailCriticalErrors is True, the system will not display any critical-error-handler message boxes. Raises an exception if not successful.</p></description>
  2113. <example><pre>begin
  2114. // Register hhctrl.ocx located in the System directory.
  2115. RegisterServer(Is64BitInstallMode, ExpandConstant('{sys}\hhctrl.ocx'), False);
  2116. end;</pre>
  2117. <p>Because we specify Is64BitInstallMode in the first parameter, it will register the 64-bit OCX in the 64-bit System directory when Setup is running in 64-bit install mode. Otherwise, it will register the 32-bit OCX in the 32-bit System directory.</p></example>
  2118. </function>
  2119. <function>
  2120. <name>UnregisterServer</name>
  2121. <prototype>function UnregisterServer(const Is64Bit: Boolean; const Filename: String; const FailCriticalErrors: Boolean): Boolean;</prototype>
  2122. <description><p>Unregisters the DLL/OCX with the specified filename. If Is64Bit is True, the DLL/OCX will be loaded as a 64-bit image and unregistered in a 64-bit process. If FailCriticalErrors is True, the system will not display any critical-error-handler message boxes. Returns True if successful, False otherwise.</p></description>
  2123. </function>
  2124. <function>
  2125. <name>RegisterTypeLibrary</name>
  2126. <prototype>procedure RegisterTypeLibrary(const Is64Bit: Boolean; const Filename: String);</prototype>
  2127. <description><p>Registers the type library with the specified filename. If Is64Bit is True, the type library will be registered in a 64-bit process. Raises an exception if not successful.</p></description>
  2128. <example><pre>begin
  2129. // Register stdole2.tlb located in the System directory.
  2130. RegisterTypeLibrary(Is64BitInstallMode, ExpandConstant('{sys}\stdole2.tlb'));
  2131. end;</pre>
  2132. <p>Because we specify Is64BitInstallMode in the first parameter, it will register the 64-bit type library in the 64-bit System directory when Setup is running in 64-bit install mode. Otherwise, it will register the 32-bit type library in the 32-bit System directory.</p></example>
  2133. </function>
  2134. <function>
  2135. <name>UnregisterTypeLibrary</name>
  2136. <prototype>function UnregisterTypeLibrary(const Is64Bit: Boolean; const Filename: String): Boolean</prototype>
  2137. <description><p>Unregisters the type library with the specified filename. If Is64Bit is True, the type library will be unregistered in a 64-bit process. Returns True if successful, False otherwise.</p></description>
  2138. </function>
  2139. <function>
  2140. <name>IncrementSharedCount</name>
  2141. <prototype>procedure IncrementSharedCount(const Is64Bit: Boolean; const Filename: String; const AlreadyExisted: Boolean);</prototype>
  2142. <description><p>Increments or initializes the reference count for the specified file in the following registry key:</p>
  2143. <p>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs</p>
  2144. <p>64-bit versions of Windows have two separate SharedDLLs keys, one for 64-bit files and one for 32-bit files. If Is64Bit is True, the 64-bit SharedDLLs key will be updated, otherwise the 32-bit SharedDLLs key will be updated. The setting of this parameter should correspond to the bitness of the file; for example, if it is a 32-bit DLL located in the 32-bit System directory, you should specify False. You may also specify <tt>Is64BitInstallMode</tt> in which case it will use the current install mode to determine which key to open.</p>
  2145. <p>Pass True in the AlreadyExisted parameter if the file already exists; in this case the initial reference count for the file will be 2 if the value for the file doesn't already exist in the registry. (This behavior is in line with Microsoft's requirements.)</p>
  2146. <p>An exception will be raised if the registry key cannot be opened for write access.</p></description>
  2147. </function>
  2148. <function>
  2149. <name>DecrementSharedCount</name>
  2150. <prototype>function DecrementSharedCount(const Is64Bit: Boolean; const Filename: String): Boolean;</prototype>
  2151. <description><p>Decrements the reference count for the specified file in the following registry key:</p>
  2152. <p>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs</p>
  2153. <p>64-bit versions of Windows have two separate SharedDLLs keys, one for 64-bit files and one for 32-bit files. If Is64Bit is True, the 64-bit SharedDLLs key will be updated, otherwise the 32-bit SharedDLLs key will be updated. The setting of this parameter should correspond to the bitness of the file; for example, if it is a 32-bit DLL located in the 32-bit System directory, you should specify False. You may also specify <tt>Is64BitInstallMode</tt> in which case it will use the current install mode to determine which key to open.</p>
  2154. <p>Returns True if the count reached zero (meaning it's OK to delete the file). Returns False if the new count is greater than zero, or if the value for the file doesn't exist or is in an unrecognizable format.</p>
  2155. <p>An exception will be raised if the registry key cannot be opened for write access.</p></description>
  2156. </function>
  2157. <function>
  2158. <name>RestartReplace</name>
  2159. <prototype>procedure RestartReplace(const TempFile, DestFile: String);</prototype>
  2160. <description><p>Renames TempFile to DestFile the next time Windows is started. If DestFile already existed, it will be overwritten. If DestFile is '' then TempFile will be deleted. An exception will be raised upon failure.</p></description>
  2161. </function>
  2162. <function>
  2163. <name>UnregisterFont</name>
  2164. <prototype>procedure UnregisterFont(const FontName, FontFilename: String; const PerUserFont: Boolean);</prototype>
  2165. <description><p>Unregisters the font with the specified face and filename.</p></description>
  2166. </function>
  2167. <function>
  2168. <name>ModifyPifFile</name>
  2169. <prototype>function ModifyPifFile(const Filename: String; const CloseOnExit: Boolean): Boolean;</prototype>
  2170. <description><p>Changes the "Close on exit" setting of a .pif file. Returns True if it was able to make the change.</p></description>
  2171. </function>
  2172. </subcategory>
  2173. </category>
  2174. <category>
  2175. <description>File Version</description>
  2176. <subcategory>
  2177. <function>
  2178. <name>GetVersionNumbers</name>
  2179. <prototype>function GetVersionNumbers(const Filename: String; var VersionMS, VersionLS: Cardinal): Boolean;</prototype>
  2180. <description><p>Gets the version numbers of the specified file. Returns True if successful, False otherwise.</p></description>
  2181. <seealso><p><link topic="isxfunc_PackVersionNumbers">PackVersionNumbers</link></p></seealso>
  2182. </function>
  2183. <function>
  2184. <name>GetVersionComponents</name>
  2185. <prototype>function GetVersionComponents(const Filename: String; var Major, Minor, Revision, Build: Word): Boolean;</prototype>
  2186. <description><p>Gets the individual version components of the specified file. Returns True if successful, False otherwise.</p></description>
  2187. <seealso><p><link topic="isxfunc_PackVersionComponents">PackVersionComponents</link></p></seealso>
  2188. </function>
  2189. <function>
  2190. <name>GetVersionNumbersString</name>
  2191. <prototype>function GetVersionNumbersString(const Filename: String; var Version: String): Boolean;</prototype>
  2192. <description><p>Gets the version of the specified file as a string (in "0.0.0.0" format). Returns True if successful, False otherwise.</p></description>
  2193. </function>
  2194. <function>
  2195. <name>GetPackedVersion</name>
  2196. <prototype>function GetPackedVersion(const Filename: String; var Version: Int64): Boolean;</prototype>
  2197. <description><p>Gets the packed version of the specified file. Returns True if successful, False otherwise.</p>
  2198. <p>Always use <link topic="isxfunc_ComparePackedVersion">ComparePackedVersion</link> or <link topic="isxfunc_SamePackedVersion">SamePackedVersion</link> to compare packed versions.</p></description>
  2199. <seealso><p><link topic="isxfunc_PackVersionComponents">PackVersionComponents</link></p></seealso>
  2200. </function>
  2201. </subcategory>
  2202. <subcategory>
  2203. <function>
  2204. <name>PackVersionNumbers</name>
  2205. <prototype>function PackVersionNumbers(const VersionMS, VersionLS: Cardinal): Int64;</prototype>
  2206. <description><p>Packs version numbers into a single value.</p>
  2207. <p>Always use <link topic="isxfunc_ComparePackedVersion">ComparePackedVersion</link> or <link topic="isxfunc_SamePackedVersion">SamePackedVersion</link> to compare packed versions.</p></description>
  2208. <seealso><p><link topic="isxfunc_GetVersionNumbers">GetVersionNumbers</link><br />
  2209. <link topic="isxfunc_PackVersionComponents">PackVersionComponents</link><br />
  2210. <link topic="isxfunc_UnpackVersionNumbers">UnpackVersionNumbers</link></p></seealso>
  2211. </function>
  2212. <function>
  2213. <name>PackVersionComponents</name>
  2214. <prototype>function PackVersionComponents(const Major, Minor, Revision, Build: Word): Int64;</prototype>
  2215. <description><p>Packs individual version components into a single value.</p>
  2216. <p>Always use <link topic="isxfunc_ComparePackedVersion">ComparePackedVersion</link> or <link topic="isxfunc_SamePackedVersion">SamePackedVersion</link> to compare packed versions.</p></description>
  2217. <seealso><p><link topic="isxfunc_GetVersionComponents">GetVersionComponents</link><br />
  2218. <link topic="isxfunc_PackVersionNumbers">PackVersionNumbers</link><br />
  2219. <link topic="isxfunc_UnpackVersionComponents">UnpackVersionComponents</link></p></seealso>
  2220. </function>
  2221. </subcategory>
  2222. <subcategory>
  2223. <function>
  2224. <name>ComparePackedVersion</name>
  2225. <prototype>function ComparePackedVersion(const Version1, Version2: Int64): Integer;</prototype>
  2226. <description><p>Compares Version1 to Version2. The return value is less than 0 if Version1 is less than Version2, 0 if Version1 equals Version2, or greater than 0 if Version1 is greater than Version2.</p></description>
  2227. </function>
  2228. <function>
  2229. <name>SamePackedVersion</name>
  2230. <prototype>function SamePackedVersion(const Version1, Version2: Int64): Boolean;</prototype>
  2231. <description><p>Compares the packed versions Version1 and Version2 and returns True if they are equal.</p></description>
  2232. </function>
  2233. </subcategory>
  2234. <subcategory>
  2235. <function>
  2236. <name>UnpackVersionNumbers</name>
  2237. <prototype>procedure UnpackVersionNumbers(const Version: Int64; var VersionMS, VersionLS: Cardinal);</prototype>
  2238. <description><p>Unpacks a packed version into version numbers.</p></description>
  2239. <seealso><p><link topic="isxfunc_UnpackVersionComponents">UnpackVersionComponents</link><br />
  2240. <link topic="isxfunc_PackVersionNumbers">PackVersionNumbers</link></p></seealso>
  2241. </function>
  2242. <function>
  2243. <name>UnpackVersionComponents</name>
  2244. <prototype>procedure UnpackVersionComponents(const Version: Int64; var Major, Minor, Revision, Build: Word);</prototype>
  2245. <description><p>Unpacks a packed version into individual version components.</p></description>
  2246. <seealso><p><link topic="isxfunc_UnpackVersionNumbers">UnpackVersionNumbers</link><br />
  2247. <link topic="isxfunc_PackVersionComponents">PackVersionComponents</link></p></seealso>
  2248. </function>
  2249. </subcategory>
  2250. <subcategory>
  2251. <function>
  2252. <name>VersionToStr</name>
  2253. <prototype>function VersionToStr(const Version: Int64): String;</prototype>
  2254. <description><p>Returns the specified packed version as a string (in "0.0.0.0" format).</p></description>
  2255. <seealso><p><link topic="isxfunc_StrToVersion">StrToVersion</link><br />
  2256. <link topic="isxfunc_UnpackVersionNumbers">UnpackVersionNumbers</link><br />
  2257. <link topic="isxfunc_UnpackVersionComponents">UnpackVersionComponents</link></p></seealso>
  2258. </function>
  2259. <function>
  2260. <name>StrToVersion</name>
  2261. <prototype>function StrToVersion(const Version: String; var Version: Int64): Boolean;</prototype>
  2262. <description><p>Returns the specified string (in "0.0.0.0" format) as a packed version. Returns True if successful, False otherwise.</p></description>
  2263. <seealso><p><link topic="isxfunc_VersionToStr">VersionToStr</link><br />
  2264. <link topic="isxfunc_PackVersionNumbers">PackVersionNumbers</link><br />
  2265. <link topic="isxfunc_PackVersionComponents">PackVersionComponents</link></p></seealso>
  2266. </function>
  2267. </subcategory>
  2268. </category>
  2269. <category>
  2270. <description>Registry</description>
  2271. <subcategory>
  2272. <function>
  2273. <name>RegKeyExists</name>
  2274. <prototype>function RegKeyExists(const RootKey: Integer; const SubKeyName: String): Boolean;</prototype>
  2275. <description><p>Returns True if the specified registry key exists.</p></description>
  2276. <example><pre>begin
  2277. if RegKeyExists(HKEY_AUTO, 'Software\Jordan Russell\Inno Setup') then
  2278. begin
  2279. // The key exists
  2280. end;
  2281. end;</pre></example>
  2282. </function>
  2283. <function>
  2284. <name>RegValueExists</name>
  2285. <prototype>function RegValueExists(const RootKey: Integer; const SubKeyName, ValueName: String): Boolean;</prototype>
  2286. <description><p>Returns True if the specified registry key and value exist.</p></description>
  2287. <example><pre>begin
  2288. if RegValueExists(HKEY_CURRENT_USER, 'Console', 'WindowSize') then
  2289. begin
  2290. // The value exists
  2291. end;
  2292. end;</pre></example>
  2293. </function>
  2294. </subcategory>
  2295. <subcategory>
  2296. <function>
  2297. <name>RegGetSubkeyNames</name>
  2298. <prototype>function RegGetSubkeyNames(const RootKey: Integer; const SubKeyName: String; var Names: TArrayOfString): Boolean;</prototype>
  2299. <description><p>Opens the specified registry key and reads the names of its subkeys into the specified string array Names. Returns True if successful, False otherwise.</p></description>
  2300. <example><pre>var
  2301. Names: TArrayOfString;
  2302. S: String;
  2303. begin
  2304. if RegGetSubkeyNames(HKEY_CURRENT_USER, 'Control Panel', Names) then
  2305. begin
  2306. S := StringJoin(#13#10, Names);
  2307. MsgBox('List of subkeys:'#13#10#13#10 + S, mbInformation, MB_OK);
  2308. end else
  2309. begin
  2310. // add any code to handle failure here
  2311. end;
  2312. end;</pre></example>
  2313. </function>
  2314. <function>
  2315. <name>RegGetValueNames</name>
  2316. <prototype>function RegGetValueNames(const RootKey: Integer; const SubKeyName: String; var Names: TArrayOfString): Boolean;</prototype>
  2317. <description><p>Opens the specified registry key and reads the names of its values into the specified string array Names. Returns True if successful, False otherwise.</p></description>
  2318. <example><pre>var
  2319. Names: TArrayOfString;
  2320. S: String;
  2321. begin
  2322. if RegGetValueNames(HKEY_CURRENT_USER, 'Control Panel\Mouse', Names) then
  2323. begin
  2324. S := StringJoin(#13#10, Names);
  2325. MsgBox('List of values:'#13#10#13#10 + S, mbInformation, MB_OK);
  2326. end else
  2327. begin
  2328. // add any code to handle failure here
  2329. end;
  2330. end;</pre></example>
  2331. </function>
  2332. </subcategory>
  2333. <subcategory>
  2334. <function>
  2335. <name>RegQueryStringValue</name>
  2336. <prototype>function RegQueryStringValue(const RootKey: Integer; const SubKeyName, ValueName: String; var ResultStr: String): Boolean;</prototype>
  2337. <description><p>Queries the specified REG_SZ- or REG_EXPAND_SZ-type value, and returns the data in ResultStr. Returns True if successful. When False is returned, ResultStr is unmodified.</p></description>
  2338. <example><pre>var
  2339. Country: String;
  2340. begin
  2341. if RegQueryStringValue(HKEY_CURRENT_USER, 'Control Panel\International',
  2342. 'sCountry', Country) then
  2343. begin
  2344. // Successfully read the value
  2345. MsgBox('Your country: ' + Country, mbInformation, MB_OK);
  2346. end;
  2347. end;</pre></example>
  2348. </function>
  2349. <function>
  2350. <name>RegQueryMultiStringValue</name>
  2351. <prototype>function RegQueryMultiStringValue(const RootKey: Integer; const SubKeyName, ValueName: String; var ResultStr: String): Boolean;</prototype>
  2352. <description><p>Queries the specified REG_MULTI_SZ-type registry value, and returns the data in ResultStr. Returns True if successful. When False is returned, ResultStr is unmodified.</p></description>
  2353. <remarks><p>In a REG_MULTI_SZ-type value, each string is separated by a null character (<tt>#0</tt>).</p></remarks>
  2354. </function>
  2355. <function>
  2356. <name>RegQueryDWordValue</name>
  2357. <prototype>function RegQueryDWordValue(const RootKey: Integer; const SubKeyName, ValueName: String; var ResultDWord: Cardinal): Boolean;</prototype>
  2358. <description><p>Queries the specified REG_DWORD-type registry value, and returns the data in ResultDWord. Returns True if successful. When False is returned, ResultDWord is unmodified.</p></description>
  2359. <example><pre>var
  2360. HistoryBufferSize: Cardinal;
  2361. begin
  2362. if RegQueryDWordValue(HKEY_CURRENT_USER, 'Console',
  2363. 'HistoryBufferSize', HistoryBufferSize) then
  2364. begin
  2365. // Successfully read the value
  2366. MsgBox('Console history buffer size: ' + IntToStr(HistoryBufferSize),
  2367. mbInformation, MB_OK);
  2368. end;
  2369. end;</pre></example>
  2370. </function>
  2371. <function>
  2372. <name>RegQueryBinaryValue</name>
  2373. <prototype>function RegQueryBinaryValue(const RootKey: Integer; const SubKeyName, ValueName: String; var ResultStr: AnsiString): Boolean;</prototype>
  2374. <description><p>Queries the specified registry value, and returns the data in ResultStr. Returns True if successful. When False is returned, ResultStr is unmodified.</p></description>
  2375. </function>
  2376. </subcategory>
  2377. <subcategory>
  2378. <function>
  2379. <name>RegWriteStringValue</name>
  2380. <prototype>function RegWriteStringValue(const RootKey: Integer; const SubKeyName, ValueName, Data: String): Boolean;</prototype>
  2381. <description><p>Writes the specified REG_SZ-type registry value. Returns True if successful, False otherwise.</p></description>
  2382. <remarks><p>If the value already exists and is of type REG_EXPAND_SZ, the new value will also be of type REG_EXPAND_SZ. Otherwise, a REG_SZ-type value will be created.</p></remarks>
  2383. <example><pre>begin
  2384. RegWriteStringValue(HKEY_AUTO, 'Software\My Company\My Program',
  2385. 'Language', ExpandConstant('{language}'));
  2386. end;</pre></example>
  2387. </function>
  2388. <function>
  2389. <name>RegWriteExpandStringValue</name>
  2390. <prototype>function RegWriteExpandStringValue(const RootKey: Integer; const SubKeyName, ValueName, Data: String): Boolean;</prototype>
  2391. <description><p>Writes the specified REG_EXPAND_SZ-type registry value. Returns True if successful, False otherwise.</p></description>
  2392. <example><pre>begin
  2393. RegWriteStringValue(HKEY_CURRENT_USER, 'Software\My Company\My Program',
  2394. 'UserName', '%UserName%);
  2395. end;</pre></example>
  2396. </function>
  2397. <function>
  2398. <name>RegWriteMultiStringValue</name>
  2399. <prototype>function RegWriteMultiStringValue(const RootKey: Integer; const SubKeyName, ValueName, Data: String): Boolean;</prototype>
  2400. <description><p>Writes the specified REG_MULTI_SZ-type registry value. Returns True if successful, False otherwise.</p></description>
  2401. <remarks><p>In a REG_MULTI_SZ-type value, each string is separated by a null character (<tt>#0</tt>).</p></remarks>
  2402. <example><pre>begin
  2403. RegWriteMultiStringValue(HKEY_AUTO, 'Software\My Company\My Program',
  2404. 'MultiStringTest', 'String1' + #0 + 'String2' + #0 + 'String3');
  2405. end;</pre></example>
  2406. </function>
  2407. <function>
  2408. <name>RegWriteDWordValue</name>
  2409. <prototype>function RegWriteDWordValue(const RootKey: Integer; const SubKeyName, ValueName: String; const Data: Cardinal): Boolean;</prototype>
  2410. <description><p>Writes the specified REG_DWORD-type registry value. Returns True if successful, False otherwise.</p></description>
  2411. <example><pre>begin
  2412. RegWriteDWordValue(HKEY_AUTO, 'Software\My Company\My Program',
  2413. 'ShowToolbar', 1);
  2414. end;</pre></example>
  2415. </function>
  2416. <function>
  2417. <name>RegWriteBinaryValue</name>
  2418. <prototype>function RegWriteBinaryValue(const RootKey: Integer; const SubKeyName, ValueName: String; const Data: AnsiString): Boolean;</prototype>
  2419. <description><p>Writes the specified REG_BINARY-type registry value. Returns True if successful, False otherwise.</p></description>
  2420. <example><pre>begin
  2421. RegWriteBinaryValue(HKEY_AUTO, 'Software\My Company\My Program',
  2422. 'BinaryTest', 'Whatever' + #1#2#3#4);
  2423. end;</pre></example>
  2424. </function>
  2425. </subcategory>
  2426. <subcategory>
  2427. <function>
  2428. <name>RegDeleteKeyIncludingSubkeys</name>
  2429. <prototype>function RegDeleteKeyIncludingSubkeys(const RootKey: Integer; const SubkeyName: String): Boolean;</prototype>
  2430. <description><p>Deletes the specified key and all subkeys. Returns True if successful, False otherwise.</p></description>
  2431. </function>
  2432. <function>
  2433. <name>RegDeleteKeyIfEmpty</name>
  2434. <prototype>function RegDeleteKeyIfEmpty(const RootKey: Integer; const SubkeyName: String): Boolean;</prototype>
  2435. <description><p>Deletes the specified subkey if it has no subkeys or values. Returns True if successful, False otherwise.</p></description>
  2436. </function>
  2437. <function>
  2438. <name>RegDeleteValue</name>
  2439. <prototype>function RegDeleteValue(const RootKey: Integer; const SubKeyName, ValueName: String): Boolean;</prototype>
  2440. <description><p>Deletes the specified value. Returns True if successful, False otherwise.</p></description>
  2441. </function>
  2442. </subcategory>
  2443. </category>
  2444. <category>
  2445. <description>INI File</description>
  2446. <subcategory>
  2447. <function>
  2448. <name>IniKeyExists</name>
  2449. <prototype>function IniKeyExists(const Section, Key, Filename: String): Boolean;</prototype>
  2450. <description><p>Returns True if the specified INI key exists.</p></description>
  2451. </function>
  2452. <function>
  2453. <name>IsIniSectionEmpty</name>
  2454. <prototype>function IsIniSectionEmpty(const Section, Filename: String): Boolean;</prototype>
  2455. <description><p>Returns True if the specified INI section is empty.</p></description>
  2456. </function>
  2457. </subcategory>
  2458. <subcategory>
  2459. <function>
  2460. <name>GetIniBool</name>
  2461. <prototype>function GetIniBool(const Section, Key: String; const Default: Boolean; const Filename: String): Boolean</prototype>
  2462. <description><p>Reads a Boolean from an INI file.</p></description>
  2463. </function>
  2464. <function>
  2465. <name>GetIniInt</name>
  2466. <prototype>function GetIniInt(const Section, Key: String; const Default, Min, Max: LongInt; const Filename: String): LongInt;</prototype>
  2467. <description><p>Reads a LongInt from an INI file. If the LongInt read is not between Min/Max then it returns Default. If Min=Max then Min/Max are ignored.</p></description>
  2468. </function>
  2469. <function>
  2470. <name>GetIniString</name>
  2471. <prototype>function GetIniString(const Section, Key, Default, Filename: String): String;</prototype>
  2472. <description><p>Reads a String from an INI file.</p></description>
  2473. </function>
  2474. </subcategory>
  2475. <subcategory>
  2476. <function>
  2477. <name>SetIniBool</name>
  2478. <prototype>function SetIniBool(const Section, Key: String; const Value: Boolean; const Filename: String): Boolean;</prototype>
  2479. <description><p>Writes a Boolean to an INI file.</p></description>
  2480. </function>
  2481. <function>
  2482. <name>SetIniInt</name>
  2483. <prototype>function SetIniInt(const Section, Key: String; const Value: LongInt; const Filename: String): Boolean;</prototype>
  2484. <description><p>Writes a LongInt to an INI file.</p></description>
  2485. </function>
  2486. <function>
  2487. <name>SetIniString</name>
  2488. <prototype>function SetIniString(const Section, Key, Value, Filename: String): Boolean;</prototype>
  2489. <description><p>Writes a string to an INI file.</p></description>
  2490. </function>
  2491. </subcategory>
  2492. <subcategory>
  2493. <function>
  2494. <name>DeleteIniSection</name>
  2495. <prototype>procedure DeleteIniSection(const Section, Filename: String);</prototype>
  2496. <description><p>Deletes the specified section from an INI file.</p></description>
  2497. </function>
  2498. <function>
  2499. <name>DeleteIniEntry</name>
  2500. <prototype>procedure DeleteIniEntry(const Section, Key, Filename: String);</prototype>
  2501. <description><p>Deletes the specified key from an INI file.</p></description>
  2502. </function>
  2503. </subcategory>
  2504. </category>
  2505. <category>
  2506. <description>Custom Setup Wizard Page</description>
  2507. <subcategory>
  2508. <function>
  2509. <name>CreateInputQueryPage</name>
  2510. <prototype>function CreateInputQueryPage(const AfterID: Integer; const ACaption, ADescription, ASubCaption: String): TInputQueryWizardPage;</prototype>
  2511. <description><p>Creates a wizard page containing edit boxes.</p></description>
  2512. <remarks><p>To create edit boxes on the page, call the Add method. Use the Values property to get/set the text of the edit boxes.</p></remarks>
  2513. <example><pre>var
  2514. Page: TInputQueryWizardPage;
  2515. UserName, UserCompany: String;
  2516. ...
  2517. // Create the page
  2518. Page := CreateInputQueryPage(wpWelcome,
  2519. 'Personal Information', 'Who are you?',
  2520. 'Please specify your name and the company for whom you work, then click Next.');
  2521. // Add items (False means it's not a password edit)
  2522. Page.Add('&amp;Name:', False);
  2523. Page.Add('&amp;Company:', False);
  2524. // Set initial values (optional)
  2525. Page.Values[0] := ExpandConstant('{sysuserinfoname}');
  2526. Page.Values[1] := ExpandConstant('{sysuserinfoorg}');
  2527. ...
  2528. // Read values into variables
  2529. UserName := Page.Values[0];
  2530. UserCompany := Page.Values[1];
  2531. </pre>
  2532. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2533. <seealso><p><link topic="scriptclasses" anchor="TInputQueryWizardPage">TInputQueryWizardPage</link></p></seealso>
  2534. </function>
  2535. <function>
  2536. <name>CreateInputOptionPage</name>
  2537. <prototype>function CreateInputOptionPage(const AfterID: Integer; const ACaption, ADescription, ASubCaption: String; Exclusive, ListBox: Boolean): TInputOptionWizardPage;</prototype>
  2538. <description><p>Creates a wizard page containing check boxes or radio buttons.</p>
  2539. <p>If Exclusive is True, radio buttons are displayed instead of check boxes, and only one item in the list may be selected at a time. If ListBox is True, the check boxes or radio buttons are placed inside a scrollable list box.</p></description>
  2540. <remarks><p>To create check boxes / radio buttons on the page, call the Add method. Use the Values property to get/set the checked state of items. On pages created with Exclusive=True, you can get/set the index of the one selected item via the SelectedValueIndex property.</p></remarks>
  2541. <example><pre>var
  2542. Page: TInputOptionWizardPage;
  2543. IsRegisteredUser: Boolean;
  2544. ...
  2545. // Create the page
  2546. Page := CreateInputOptionPage(wpWelcome,
  2547. 'License Information', 'Are you a registered user?',
  2548. 'If you are a registered user, please check the box below, then click Next.',
  2549. False, False);
  2550. // Add items
  2551. Page.Add('&amp;I am a registered user');
  2552. // Set initial values (optional)
  2553. Page.Values[0] := False;
  2554. ...
  2555. // Read values into variables
  2556. IsRegisteredUser := Page.Values[0];
  2557. </pre>
  2558. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2559. <seealso><p><link topic="scriptclasses" anchor="TInputOptionWizardPage">TInputOptionWizardPage</link></p></seealso>
  2560. </function>
  2561. <function>
  2562. <name>CreateInputDirPage</name>
  2563. <prototype>function CreateInputDirPage(const AfterID: Integer; const ACaption, ADescription, ASubCaption: String; AAppendDir: Boolean; ANewFolderName: String): TInputDirWizardPage;</prototype>
  2564. <description><p>Creates a wizard page that contains edit boxes and Browse buttons for selecting directories. If AAppendDir is True, the value of ANewFolderName will be appended onto any folder name the user clicks. If AAppendDir is False and ANewFolderName is not empty, a Make New Folder button will be shown that creates a new folder with the specified default name.</p></description>
  2565. <remarks><p>To create directory selection boxes on the page, call the Add method. Use the Values property to get/set the items' values.</p></remarks>
  2566. <example><pre>var
  2567. Page: TInputDirWizardPage;
  2568. DataDir: String;
  2569. ...
  2570. // Create the page
  2571. Page := CreateInputDirPage(wpWelcome,
  2572. 'Select Personal Data Location', 'Where should personal data files be stored?',
  2573. 'Personal data files will be stored in the following folder.'#13#10#13#10 +
  2574. 'To continue, click Next. If you would like to select a different folder, click Browse.',
  2575. False, SetupMessage(msgNewFolderName));
  2576. // Add item (with an empty caption)
  2577. Page.Add('');
  2578. // Set initial value (optional)
  2579. Page.Values[0] := ExpandConstant('{userappdata}\My Company\My Program');
  2580. ...
  2581. // Read value into variable
  2582. DataDir := Page.Values[0];
  2583. </pre>
  2584. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2585. <seealso><p><link topic="scriptclasses" anchor="TInputDirWizardPage">TInputDirWizardPage</link></p></seealso>
  2586. </function>
  2587. <function>
  2588. <name>CreateInputFilePage</name>
  2589. <prototype>function CreateInputFilePage(const AfterID: Integer; const ACaption, ADescription, ASubCaption: String): TInputFileWizardPage;</prototype>
  2590. <description><p>Creates a wizard page that contains edit boxes and Browse buttons for selecting files.</p></description>
  2591. <remarks><p>To create file selection boxes on the page, call the Add method. Use the Values property to get/set the items' values.</p>
  2592. <p>An example Filter: 'Text files (*.txt)|*.txt|All files (*.*)|*.*'</p></remarks>
  2593. <example><pre>var
  2594. Page: TInputFileWizardPage;
  2595. NotepadLocation: String;
  2596. ...
  2597. // Create the page
  2598. Page := CreateInputFilePage(wpWelcome,
  2599. 'Select Notepad Location', 'Where is Notepad located?',
  2600. 'Select where Notepad is located, then click Next.');
  2601. // Add item
  2602. Page.Add('&amp;Location of notepad.exe:', // caption
  2603. 'Executable files|*.exe|All files|*.*', // filters
  2604. '.exe'); // default extension
  2605. // Set initial value (optional)
  2606. Page.Values[0] := ExpandConstant('{win}\notepad.exe');
  2607. ...
  2608. // Read value into variable
  2609. NotepadLocation := Page.Values[0];
  2610. </pre>
  2611. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2612. <seealso><p><link topic="scriptclasses" anchor="TInputFileWizardPage">TInputFileWizardPage</link></p></seealso>
  2613. </function>
  2614. <function>
  2615. <name>CreateOutputMsgPage</name>
  2616. <prototype>function CreateOutputMsgPage(const AfterID: Integer; const ACaption, ADescription, AMsg: String): TOutputMsgWizardPage;</prototype>
  2617. <description><p>Creates a wizard page containing only static text. The AMsg parameter specifies the text to display.</p></description>
  2618. <example><pre>var
  2619. Page: TOutputMsgWizardPage;
  2620. ...
  2621. // Create the page
  2622. Page := CreateOutputMsgPage(wpWelcome,
  2623. 'Information', 'Please read the following important information before continuing.',
  2624. 'Blah blah blah.');
  2625. </pre>
  2626. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2627. <seealso><p><link topic="scriptclasses" anchor="TOutputMsgWizardPage">TOutputMsgWizardPage</link></p></seealso>
  2628. </function>
  2629. <function>
  2630. <name>CreateOutputMsgMemoPage</name>
  2631. <prototype>function CreateOutputMsgMemoPage(const AfterID: Integer; const ACaption, ADescription, ASubCaption: String; const AMsg: AnsiString): TOutputMsgMemoWizardPage;</prototype>
  2632. <description><p>Creates a wizard page containing static text as well as a read-only, multi-line edit control, capable of displaying RTF text. The ASubCaption parameter specifies the static text to display. AMsg specifies the text to assign to the edit control.</p></description>
  2633. <example><pre>var
  2634. Page: TOutputMsgMemoWizardPage;
  2635. ...
  2636. // Create the page
  2637. Page := CreateOutputMsgMemoPage(wpWelcome,
  2638. 'Information', 'Please read the following important information before continuing.',
  2639. 'When you are ready to continue with Setup, click Next.',
  2640. 'Blah blah blah.');
  2641. </pre>
  2642. <p>See <i>AllPagesExample.iss</i> for another example.</p></example>
  2643. <seealso><p><link topic="scriptclasses" anchor="TOutputMsgMemoWizardPage">TOutputMsgMemoWizardPage</link></p></seealso>
  2644. </function>
  2645. <function>
  2646. <name>CreateOutputProgressPage</name>
  2647. <prototype>function CreateOutputProgressPage(const ACaption, ADescription: String): TOutputProgressWizardPage;</prototype>
  2648. <description><p>Creates a wizard page containing static text as well as a progress bar (which is hidden by default).</p>
  2649. <p>Unlike the other types of wizard pages, progress pages are not displayed as part of the normal page sequence (note that there is no <tt>AfterID</tt> parameter). A progress page can only be displayed programmatically by calling its <tt>Show</tt> method.</p></description>
  2650. <remarks><p>Call the <tt>Show</tt> method to activate and show the page. When you're finished with it, call the <tt>Hide</tt> method to revert to the previous page.</p>
  2651. <p>Always put the <tt>Hide</tt> call inside the <tt>finally</tt> part of a <tt>try..finally</tt> language construct, as demonstrated in <i>CodeDlg.iss</i>. Not calling <tt>Hide</tt> will result in the wizard being permanently stuck on the progress page.</p>
  2652. <p>To set the text on the page, call the <tt>SetText</tt> method. <tt>SetText</tt> takes two string parameters: use the first to tell the user what you're doing, and the second to display a file or directory name. Either parameter may be blank.</p>
  2653. <p>To show or update the progress bar, call the <tt>SetProgress</tt> method. <tt>SetProgress</tt> takes two integer parameters: the first specifies the position of the progress bar (zero-based), and the second specifies the highest possible position. If the second parameter is 0, the progress bar will be hidden.</p></remarks>
  2654. <example><p>See <i>CodeDlg.iss</i> and <i>AllPagesExample.iss</i> example scrips in the "Examples" subdirectory in your Inno Setup directory for examples.</p></example>
  2655. <seealso><p><link topic="scriptclasses" anchor="TOutputProgressWizardPage">TOutputProgressWizardPage</link><br />
  2656. <link topic="isxfunc_CreateOutputMarqueeProgressPage">CreateOutputMarqueeProgressPage</link></p></seealso>
  2657. </function>
  2658. <function>
  2659. <name>CreateOutputMarqueeProgressPage</name>
  2660. <prototype>function CreateOutputMarqueeProgressPage(const ACaption, ADescription: String): TOutputMarqueeProgressWizardPage;</prototype>
  2661. <description><p>Creates a wizard page containing static text as well as a marquee progress bar.</p>
  2662. <p>See <link topic="isxfunc_CreateOutputProgressPage">CreateOutputProgressPage</link> for information on how to work with progress pages.</p></description>
  2663. <remarks><p>To animate the progress bar, call the <tt>Animate</tt> method. Do not call the <tt>SetProgress</tt> method, it will raise an internal error.</p></remarks>
  2664. <example><p>See <i>AllPagesExample.iss</i> for an example.</p></example>
  2665. <seealso><p><link topic="scriptclasses" anchor="TOutputMarqueeProgressWizardPage">TOutputMarqueeProgressWizardPage</link></p></seealso>
  2666. </function>
  2667. <function>
  2668. <name>CreateDownloadPage</name>
  2669. <prototype>function CreateDownloadPage(const ACaption, ADescription: String; const OnDownloadProgress: TOnDownloadProgress): TDownloadWizardPage;</prototype>
  2670. <description><p>Creates a wizard page to download files and show progress.</p>
  2671. <p>Set OnDownloadProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p>
  2672. <p>Unlike the other types of wizard pages, progress pages are not displayed as part of the normal page sequence (note that there is no <tt>AfterID</tt> parameter). A progress page can only be displayed programmatically by calling its <tt>Show</tt> method.</p></description>
  2673. <remarks><p>Call the <tt>Show</tt> method to activate and show the page. When you're finished with it, call the <tt>Hide</tt> method to revert to the previous page.</p>
  2674. <p>Always put the <tt>Hide</tt> call inside the <tt>finally</tt> part of a <tt>try..finally</tt> language construct, as demonstrated in <i>CodeDownloadFiles.iss</i>. Not calling <tt>Hide</tt> will result in the wizard being permanently stuck on the progress page.</p>
  2675. <p>To add a new file to download, call the <tt>Add</tt> method. Always call the <tt>Clear</tt> method before adding the first file.</p>
  2676. <p>To start the download, call the <tt>Download</tt> method. An exception will be raised if there was an error. Otherwise, <tt>Download</tt> returns the number of bytes downloaded.</p>
  2677. <p>Set the <tt>ShowBaseNameInsteadOfUrl</tt> property to <tt>True</tt> to show the base name of the file which is being downloaded to the user instead of the URL.</p>
  2678. <p>See <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link> for other considerations and the definition of <tt>TOnDownloadProgress</tt>.</p></remarks>
  2679. <example><p>See <i>CodeDownloadFiles.iss</i> for an example.</p>
  2680. <p>See <i>DownloadFiles.iss</i> for an example of file download using just a [Files] entry instead.</p></example>
  2681. <seealso><p><link topic="scriptclasses" anchor="TDownloadWizardPage">TDownloadWizardPage</link><br />
  2682. <link topic="isxfunc_DownloadTemporaryFile">DownloadTemporaryFile</link><br />
  2683. <link topic="isxfunc_CreateOutputProgressPage">CreateOutputProgressPage</link></p></seealso>
  2684. </function>
  2685. <function>
  2686. <name>CreateExtractionPage</name>
  2687. <prototype>function CreateExtractionPage(const ACaption, ADescription: String; const OnExtractionProgress: TOnExtractionProgress): TExtractionWizardPage;</prototype>
  2688. <description><p>Creates a wizard page to extract archives and show progress.</p>
  2689. <p>The supported archive formats, beyond .7z, and the support for password-protected and multi-volume archives, depend on the <link topic="setup_archiveextraction">ArchiveExtraction</link> [Setup] section directive.</p>
  2690. <p>To allow the extraction of archives with custom extensions, such as self-extracting archives, call <link topic="isxfunc_MapArchiveExtensions">MapArchiveExtensions</link>.</p>
  2691. <p>Set OnExtractionProgress to a function to be informed of progress, or <tt>nil</tt> otherwise.</p>
  2692. <p>Unlike the other types of wizard pages, progress pages are not displayed as part of the normal page sequence (note that there is no <tt>AfterID</tt> parameter). A progress page can only be displayed programmatically by calling its <tt>Show</tt> method.</p></description>
  2693. <remarks><p>Call the <tt>Show</tt> method to activate and show the page. When you're finished with it, call the <tt>Hide</tt> method to revert to the previous page.</p>
  2694. <p>Always put the <tt>Hide</tt> call inside the <tt>finally</tt> part of a <tt>try..finally</tt> language construct, as demonstrated in <i>CodeDownloadFiles.iss</i>. Not calling <tt>Hide</tt> will result in the wizard being permanently stuck on the progress page.</p>
  2695. <p>To add a new archive to extract, call the <tt>Add</tt> method or the <tt>AddEx</tt> method if the archive is password-protected. Always call the <tt>Clear</tt> method before adding the first file.</p>
  2696. <p>To start the extraction, call the <tt>Extract</tt> method. An exception will be raised if there was an error. Otherwise, <tt>Extract</tt> returns the number of archives extracted.</p>
  2697. <p>Set the <tt>ShowArchiveInsteadFile</tt> property to <tt>True</tt> to show the name of the archive which is being extracted to the user instead of the names of the files inside the archive.</p>
  2698. <p>See <link topic="isxfunc_ExtractArchive">ExtractArchive</link> for the definition of <tt>TOnExtractionProgress</tt>.</p></remarks>
  2699. <example><p>See <i>CodeDownloadFiles.iss</i> for an example of <tt>CreateDownloadPage</tt> which works very similar to <tt>CreateExtractionPage</tt>.</p>
  2700. <p>See <i>DownloadFiles.iss</i> for an example of archive extraction using just a [Files] entry instead.</p>
  2701. </example>
  2702. <seealso><p><link topic="scriptclasses" anchor="TExtractionWizardPage">TExtractionWizardPage</link><br />
  2703. <link topic="isxfunc_ExtractArchive">ExtractArchive</link><br />
  2704. <link topic="isxfunc_MapArchiveExtensions">MapArchiveExtensions</link><br />
  2705. <link topic="isxfunc_CreateOutputProgressPage">CreateOutputProgressPage</link></p></seealso>
  2706. </function>
  2707. <function>
  2708. <name>CreateCustomPage</name>
  2709. <prototype>function CreateCustomPage(const AfterID: Integer; const ACaption, ADescription: String): TWizardPage;</prototype>
  2710. <description><p>Creates a custom wizard page. The page is empty by default; you have to create your own controls afterward and place them on the page (by setting their Parent properties to the Surface property of the <link topic="scriptclasses" anchor="TWizardPage">TWizardPage</link> instance returned by this function).</p></description>
  2711. <example><p>See <i>CodeClasses.iss</i> and <i>AllPagesExample.iss</i> example scripts in the "Examples" subdirectory in your Inno Setup directory for examples.</p></example>
  2712. <seealso><p><link topic="scriptclasses" anchor="TWizardPage">TWizardPage</link></p></seealso>
  2713. </function>
  2714. </subcategory>
  2715. <subcategory>
  2716. <function>
  2717. <name>CreateCustomForm</name>
  2718. <prototype>function CreateCustomForm: TSetupForm;</prototype>
  2719. <description><p>Creates a form. The form is empty by default; you have to create your own controls afterward and place them on the form (by setting their Parent properties to the <link topic="scriptclasses" anchor="TSetupForm">TSetupForm</link> instance returned by this function).</p></description>
  2720. <remarks><p>You should call this function instead of creating <link topic="scriptclasses" anchor="TForm">TForm</link> or <link topic="scriptclasses" anchor="TSetupForm">TSetupForm</link> instances directly. This function automatically initializes the font and other properties of the created form to be like Setup's other dialogs.</p>
  2721. <p>The <tt>[LangOptions]</tt> section's <tt>DialogFontName</tt> and <tt>DialogFontSize</tt> directives determine the font used by the form and, by default, any child controls created on the form.</p></remarks>
  2722. <example><p>See <i>CodeClasses.iss</i> for an example.</p></example>
  2723. <seealso><p><link topic="scriptclasses" anchor="TForm">TForm</link><br />
  2724. <link topic="scriptclasses" anchor="TSetupForm">TSetupForm</link></p></seealso>
  2725. </function>
  2726. </subcategory>
  2727. <subcategory>
  2728. <function>
  2729. <name>PageFromID</name>
  2730. <prototype>function PageFromID(const ID: Integer): TWizardPage;</prototype>
  2731. <description><p>Given a page ID, returns a <link topic="scriptclasses" anchor="TWizardPage">TWizardPage</link> instance. Call this if, for example, you need to get at the surface of a page and only know its ID.</p>
  2732. <p>An exception will be raised if an invalid page ID is specified.</p></description>
  2733. <example><pre>var
  2734. Page: TWizardPage;
  2735. begin
  2736. Page := PageFromID(wpWelcome);
  2737. Page.Surface.Color := clBlue;
  2738. end;</pre></example>
  2739. <seealso><p><link topic="scriptclasses" anchor="TWizardPage">TWizardPage</link></p></seealso>
  2740. </function>
  2741. <function>
  2742. <name>PageIndexFromID</name>
  2743. <prototype>function PageIndexFromID(const ID: Integer): Integer;</prototype>
  2744. <description><p>Given a page ID, returns an position index. Call this if, for example, you want to check whether a page is positioned before a certain other page.</p></description>
  2745. <example><pre>function ShouldSkipPage(PageID: Integer): Boolean;
  2746. begin
  2747. Result := PageIndexFromID(PageID) &lt; PageIndexFromID(wpReady);
  2748. end;</pre></example>
  2749. </function>
  2750. <function>
  2751. <name>ScaleX</name>
  2752. <prototype>function ScaleX(X: Integer): Integer;</prototype>
  2753. <description><p>Takes an X coordinate or width and returns it scaled to fit the size of the current dialog font. If the dialog font is 8-point MS Sans Serif and the user is running Windows in 100% DPI (96 dpi), then X is returned unchanged.</p></description>
  2754. </function>
  2755. <function>
  2756. <name>ScaleY</name>
  2757. <prototype>function ScaleY(Y: Integer): Integer;</prototype>
  2758. <description><p>Takes a Y coordinate or height and returns it scaled to fit the size of the current dialog font. If the dialog font is 8-point MS Sans Serif and the user is running Windows in 100% DPI (96 dpi), then Y is returned unchanged.</p></description>
  2759. </function>
  2760. <function>
  2761. <name>InitializeBitmapImageFromIcon</name>
  2762. <prototype>function InitializeBitmapImageFromIcon(const BitmapImage: TBitmapImage; const IconFilename: String; const BkColor: TColor; const AscendingTrySizes: TArrayOfInteger): Boolean;</prototype>
  2763. <description><p>Initializes the given bitmap image with an icon from the given icon file using the given background color for transparent parts.</p>
  2764. <p>The bitmap image should be scaled already and the function will load the largest fitting icon which has a size from the given array of sizes. After loading the function will set the size of the bitmap image to the loaded size.</p>
  2765. <p>The array must be sorted already from smallest to highest size.</p>
  2766. <p>Returns True if the icon could be loaded, False otherwise.</p></description>
  2767. <example><pre>procedure InitializeWizard;
  2768. var
  2769. Page: TWizardPage;
  2770. BitmapImage: TBitmapImage;
  2771. begin
  2772. Page := CreateCustomPage(wpWelcome, 'Test', 'Test');
  2773. BitmapImage := TBitmapImage.Create(Page);
  2774. with BitmapImage do begin
  2775. Width := ScaleX(32);
  2776. Height := ScaleY(32);
  2777. Parent := Page.Surface;
  2778. end;
  2779. InitializeBitmapImageFromIcon(BitmapImage, 'MyProg.ico', Page.SurfaceColor, [32, 48, 64]);
  2780. end;</pre></example>
  2781. </function>
  2782. </subcategory>
  2783. </category>
  2784. <category>
  2785. <description>Dialog</description>
  2786. <subcategory>
  2787. <function>
  2788. <name>MsgBox</name>
  2789. <prototype>function MsgBox(const Text: String; const Typ: TMsgBoxType; const Buttons: Integer): Integer;</prototype>
  2790. <description><p>Displays a message box. <tt>Text</tt> specifies the message to display. <tt>Typ</tt> specifies which icon to display in the message box. <tt>Buttons</tt> specifies which buttons to include in the message box. Returns an ID* constant indicating the button the user clicked, or 0 if the function fails (which shouldn't happen unless an invalid parameter is specified or system resources are exhausted).</p></description>
  2791. <remarks><p>TMsgBoxType is defined as:</p>
  2792. <p><tt>TMsgBoxType = (mbInformation, mbConfirmation, mbError, mbCriticalError);</tt></p>
  2793. <p>Supported flags for <tt>Buttons</tt> are:</p>
  2794. <p><tt>MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_SETFOREGROUND</tt></p>
  2795. <p>Possible return values are:</p>
  2796. <p><tt>IDOK, IDCANCEL, IDABORT, IDRETRY, IDIGNORE, IDYES, IDNO</tt></p></remarks>
  2797. <example><pre>begin
  2798. // Display a simple message box with an OK button
  2799. MsgBox('Hello.', mbInformation, MB_OK);
  2800. // Ask the user a Yes/No question
  2801. if MsgBox('Are you sure?', mbConfirmation, MB_YESNO) = IDYES then
  2802. begin
  2803. // user clicked Yes
  2804. end;
  2805. // Ask the user a Yes/No question, defaulting to No
  2806. if MsgBox('Are you sure?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
  2807. begin
  2808. // user clicked Yes
  2809. end;
  2810. end;</pre></example>
  2811. <seealso><p><link topic="isxfunc_SuppressibleMsgBox">SuppressibleMsgBox</link><br />
  2812. <link topic="isxfunc_TaskDialogMsgBox">TaskDialogMsgBox</link></p></seealso>
  2813. </function>
  2814. <function>
  2815. <name>SuppressibleMsgBox</name>
  2816. <prototype>function SuppressibleMsgBox(const Text: String; const Typ: TMsgBoxType; const Buttons, Default: Integer): Integer;</prototype>
  2817. <description><p>Displays a suppressible message box. If message boxes are being suppressed (see <link topic="setupcmdline" window="main">Setup Command Line Parameters</link>), <tt>Default</tt> is returned. Otherwise, SuppressibleMsgBox acts the same as the regular <link topic="isxfunc_MsgBox">MsgBox</link>.</p></description>
  2818. </function>
  2819. <function>
  2820. <name>TaskDialogMsgBox</name>
  2821. <prototype>function TaskDialogMsgBox(const Instruction, Text: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: TArrayOfString; const ShieldButton: Integer): Integer;</prototype>
  2822. <description><p>Displays a message box using a task dialog:<br />
  2823. <tt>Instruction</tt> specifies the instruction to display.<br />
  2824. <tt>Text</tt> specifies the message to display.<br />
  2825. <tt>Typ</tt> specifies which icon to display in the task dialog. If set to <tt>mbConfirmation</tt>, no icon will be displayed.<br />
  2826. <tt>Buttons</tt> specifies which buttons to include in the task dialog.<br />
  2827. <tt>ButtonLabels</tt> specifies which custom button labels to use. If set to an empty array, the system's default button labels will be used. If a label consists of two strings separated by a newline, then the first string specifies the button label and the second string specifies the button note. If <tt>Buttons</tt> is set to <tt>MB_OKCANCEL</tt>, <tt>MB_YESNOCANCEL</tt>, or <tt>MB_RETRYCANCEL</tt>, specifying a label for the Cancel button as the last element in the array is optional.<br />
  2828. <tt>ShieldButton</tt> specifies which button to display a shield icon on. If set to 0, no shield icon will be displayed.</p>
  2829. <p>Returns an ID* constant indicating the button the user clicked, or 0 if the function fails (which shouldn't happen unless an invalid parameter is specified or system resources are exhausted).</p></description>
  2830. <remarks><p>TMsgBoxType is defined as:</p>
  2831. <p><tt>TMsgBoxType = (mbInformation, mbConfirmation, mbError, mbCriticalError);</tt></p>
  2832. <p>Supported values for <tt>Buttons</tt> are:</p>
  2833. <p><tt>MB_OK, MB_OKCANCEL, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_ABORTRETRYIGNORE</tt></p>
  2834. <p>If <tt>MB_ABORTRETRYIGNORE</tt> is used, <tt>ButtonLabels</tt> may not be an empty array and the button labels must be specified in the following special order: Retry, Ignore, Abort.</p>
  2835. <p>Supported values for <tt>ShieldButton</tt> and possible return values are:</p>
  2836. <p><tt>IDOK, IDCANCEL, IDRETRY, IDYES, IDNO, IDABORT, IDIGNORE</tt></p></remarks>
  2837. <example><pre>begin
  2838. case TaskDialogMsgBox('Choose A or B',
  2839. 'You can choose A or B.',
  2840. mbInformation,
  2841. MB_YESNOCANCEL, ['I choose &amp;A'#13#10'A will be chosen.', 'I choose &amp;B'#13#10'B will be chosen.'],
  2842. IDYES) of
  2843. IDYES: MsgBox('You chose A.', mbInformation, MB_OK);
  2844. IDNO: MsgBox('You chose B.', mbInformation, MB_OK);
  2845. end;
  2846. end;</pre></example>
  2847. <seealso><p><link topic="isxfunc_SuppressibleTaskDialogMsgBox">SuppressibleTaskDialogMsgBox</link><br />
  2848. <link topic="isxfunc_MsgBox">MsgBox</link></p></seealso>
  2849. </function>
  2850. <function>
  2851. <name>SuppressibleTaskDialogMsgBox</name>
  2852. <prototype>function SuppressibleTaskDialogMsgBox(const Instruction, Text: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: TArrayOfString; const ShieldButton: Integer; const Default: Integer): Integer;</prototype>
  2853. <description><p>Displays a suppressible message box using a task dialog. If message boxes are being suppressed (see <link topic="setupcmdline" window="main">Setup Command Line Parameters</link>), <tt>Default</tt> is returned. Otherwise, SuppressibleTaskDialogMsgBox acts the same as the regular <link topic="isxfunc_TaskDialogMsgBox">TaskDialogMsgBox</link>.</p></description>
  2854. </function>
  2855. <function>
  2856. <name>GetOpenFileName</name>
  2857. <prototype>function GetOpenFileName(const Prompt: String; var FileName: String; const InitialDirectory, Filter, DefaultExtension: String): Boolean;</prototype>
  2858. <description><p>Displays a dialog box that enables the user to select an existing file. Returns True if the user selected a file, False otherwise. The name of the selected file is returned in the FileName string.</p></description>
  2859. <remarks><p>An example Filter: 'Text files (*.txt)|*.txt|All files (*.*)|*.*'</p></remarks>
  2860. <example><pre>var
  2861. FileName: String;
  2862. begin
  2863. // Set the initial filename
  2864. FileName := '';
  2865. if GetOpenFileName('', FileName, '',
  2866. 'Text Documents (*.txt)|*.txt|All Files|*.*', 'txt') then
  2867. begin
  2868. // Successful; user clicked OK
  2869. // FileName contains the selected filename
  2870. end;
  2871. end;</pre></example>
  2872. </function>
  2873. <function>
  2874. <name>GetOpenFileNameMulti</name>
  2875. <prototype>function GetOpenFileNameMulti(const Prompt: String; var FileNameList: TStrings; const InitialDirectory, Filter, DefaultExtension: String): Boolean;</prototype>
  2876. <description><p>Displays a dialog box that enables the user to select one or more existing file(s). Returns True if the user selected a file, False otherwise. The name of the selected file(s) is returned in the FileNameList list.</p></description>
  2877. <remarks><p>An example Filter: 'Text files (*.txt)|*.txt|All files (*.*)|*.*'</p></remarks>
  2878. <example><pre>var
  2879. FileNameList: TStrings;
  2880. begin
  2881. // Create the list
  2882. FileNameList := TStringList.Create;
  2883. try
  2884. if GetOpenFileNameMulti('', FileNameList, '',
  2885. 'Text Documents (*.txt)|*.txt|All Files|*.*', 'txt') then
  2886. begin
  2887. // Successful; user clicked OK
  2888. // FileNameList contains the selected filename(s)
  2889. end;
  2890. finally
  2891. FileNameList.Free;
  2892. end;
  2893. end;</pre></example>
  2894. </function>
  2895. <function>
  2896. <name>GetSaveFileName</name>
  2897. <prototype>function GetSaveFileName(const Prompt: String; var FileName: String; const InitialDirectory, Filter, DefaultExtension: String): Boolean;</prototype>
  2898. <description><p>Displays a dialog box that enables the user to select a new file. Returns True if the user selected a file, False otherwise. The name of the selected file is returned in the FileName string.</p></description>
  2899. <remarks><p>An example Filter: 'Text files (*.txt)|*.txt|All files (*.*)|*.*'</p></remarks>
  2900. <example><pre>var
  2901. Filename: String;
  2902. begin
  2903. // Set the initial filename
  2904. Filename := '';
  2905. if GetSaveFileName('', Filename, '',
  2906. 'Text Documents (*.txt)|*.txt|All Files|*.*', 'txt') then
  2907. begin
  2908. // Successful; user clicked OK
  2909. // Filename contains the selected filename
  2910. end;
  2911. end;</pre></example>
  2912. </function>
  2913. <function>
  2914. <name>BrowseForFolder</name>
  2915. <prototype>function BrowseForFolder(const Prompt: String; var Directory: String; const NewFolderButton: Boolean): Boolean;</prototype>
  2916. <description><p>Displays a dialog box that enables the user to select a directory. The current value of Directory is used as the initially selected directory. If NewFolderButton is True, a <i>New Folder</i> button will be shown, allowing the user to create new folders. Returns True if the user selected a directory and clicked OK, False otherwise. The selected directory is returned in the Directory string.</p></description>
  2917. </function>
  2918. <function>
  2919. <name>ExitSetupMsgBox</name>
  2920. <prototype>function ExitSetupMsgBox: Boolean;</prototype>
  2921. <description><p>Displays the "Exit Setup?" message box, and returns True if the user selects Yes. Does not terminate Setup or Uninstall.</p></description>
  2922. </function>
  2923. <function>
  2924. <name>SelectDisk</name>
  2925. <prototype>function SelectDisk(const DiskNumber: Integer; const AFilename: String; var Path: String): Boolean;</prototype>
  2926. <description><p>Displays the "Setup Needs the Next Disk" message box, and returns True if the user enters a path containing the file specified by AFileName and selects OK. The selected path is returned in the Path string. The current value of Path is used as the initially selected path and DiskNumber is used only as information to the user.</p></description>
  2927. </function>
  2928. </subcategory>
  2929. </category>
  2930. <category>
  2931. <description>COM Automation objects support</description>
  2932. <subcategory>
  2933. <function>
  2934. <name>CreateOleObject</name>
  2935. <prototype>function CreateOleObject(const ClassName: String): Variant;</prototype>
  2936. <description><p>See the <link topic="scriptautomation" window="main">Using COM Automation objects</link> topic.</p></description>
  2937. </function>
  2938. <function>
  2939. <name>GetActiveOleObject</name>
  2940. <prototype>function GetActiveOleObject(const ClassName: String): Variant;</prototype>
  2941. <description><p>See the <link topic="scriptautomation" window="main">Using COM Automation objects</link> topic.</p></description>
  2942. </function>
  2943. <function>
  2944. <name>IDispatchInvoke</name>
  2945. <prototype>function IDispatchInvoke(Self: IDispatch; PropertySet: Boolean; const Name: String; Par: array of Variant): Variant;</prototype>
  2946. <description><p>Use <tt>IDispatchInvoke</tt> to access a COM Automation property or method whose name is a reserved word.</p></description>
  2947. <example><pre>var
  2948. AObject: Variant;
  2949. AType: String;
  2950. begin
  2951. AObject := CreateOleObject('MyObject');
  2952. // Set a property named 'Type'
  2953. // Cannot use "AObject.Type := 'MyType';" because Type is a reserved word
  2954. IDispatchInvoke(AObject, True, 'Type', ['MyType']);
  2955. // Get a property or call a method named 'Type'
  2956. AType := IDispatchInvoke(AObject, False, 'Type', ['']);
  2957. end;</pre></example>
  2958. <seealso><p><link topic="scriptautomation" window="main">Using COM Automation objects</link></p></seealso>
  2959. </function>
  2960. <function>
  2961. <name>CreateComObject</name>
  2962. <prototype>function CreateComObject(const ClassID: TGUID): IUnknown;</prototype>
  2963. <description><p>See the <link topic="scriptautomation" window="main">Using COM Automation objects</link> topic.</p></description>
  2964. </function>
  2965. <function>
  2966. <name>StringToGUID</name>
  2967. <prototype>function StringToGUID(const S: String): TGUID;</prototype>
  2968. <description><p>StringToGUID converts the string representation of a GUID into a 'real' GUID. An exception will be raised upon failure.</p></description>
  2969. <seealso><p><link topic="scriptautomation" window="main">Using COM Automation objects</link></p></seealso>
  2970. </function>
  2971. <function>
  2972. <name>OleCheck</name>
  2973. <prototype>procedure OleCheck(Result: HResult);</prototype>
  2974. <description><p>Use OleCheck to wrap any IUnknown based COM methods you call, so that if that method fails, an exception will be raised.</p></description>
  2975. <seealso><p><link topic="scriptautomation" window="main">Using COM Automation objects</link></p></seealso>
  2976. </function>
  2977. <function>
  2978. <name>CoFreeUnusedLibraries</name>
  2979. <prototype>procedure CoFreeUnusedLibraries;</prototype>
  2980. <description><p>See the <link topic="scriptautomation" window="main">Using COM Automation objects</link> topic.</p></description>
  2981. </function>
  2982. </subcategory>
  2983. </category>
  2984. <category>
  2985. <description>Setup Logging</description>
  2986. <subcategory>
  2987. <function>
  2988. <name>Log</name>
  2989. <prototype>procedure Log(const S: String);</prototype>
  2990. <description><p>Logs the specified string in Setup's or Uninstall's log file and/or in the Compiler IDE's "Debug Output" view.</p></description>
  2991. <remarks><p>Calls to this function are ignored if logging is not enabled (via the <link topic="setupcmdline">/LOG</link> command line parameter or the <link topic="setup_setuplogging">SetupLogging</link> [Setup] section directive or the <link topic="setup_uninstalllogging">UninstallLogging</link> [Setup] section directive or debugging from the Compiler IDE).</p></remarks>
  2992. </function>
  2993. <function>
  2994. <name>ExecAndCaptureOutput</name>
  2995. <prototype>function ExecAndCaptureOutput(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer; var Output: TExecOutput): Boolean;</prototype>
  2996. <description><p>Identical to <link topic="isxfunc_Exec">Exec</link> except:</p>
  2997. <p>Program output from the stdout and stderr streams is captured. This is different from <link topic="isxfunc_ExecAndLogOutput">ExecAndLogOutput</link> which merges the streams.</p>
  2998. <p>Console programs are always hidden and the ShowCmd parameter only affects GUI programs, so always using <tt>SW_SHOWNORMAL</tt> instead of <tt>SW_HIDE</tt> is recommended.</p>
  2999. <p>An exception will be raised if there was an error setting up output redirection (which should be very rare).</p></description>
  3000. <remarks><p>Parameter <tt>Wait</tt> must always be set to <tt>ewWaitUntilTerminated</tt> when calling this function.</p>
  3001. <p>TExecOutput is defined as:</p>
  3002. <pre>
  3003. TExecOutput = record
  3004. StdOut: TArrayOfString;
  3005. StdErr: TArrayOfString;
  3006. Error: Boolean;
  3007. end;
  3008. </pre>
  3009. <p>Error will be True if there was an error reading the output (which should be very rare) or if the output is too big. The error is logged in Setup's or Uninstall's log file and/or in the Compiler IDE's "Debug Output" view. There is no further output after an error.</p>
  3010. <p>Output is limited to a total size of 10 million bytes or a maximum of 1 million lines.</p></remarks>
  3011. <example><pre>var
  3012. ResultCode: Integer;
  3013. Output: TExecOutput;
  3014. begin
  3015. try
  3016. // Get the system configuration
  3017. Result := ExecAndCaptureOutput(ExpandConstant('{cmd}'), '/c systeminfo', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode, Output);
  3018. except
  3019. Result := False;
  3020. Log(GetExceptionMessage);
  3021. end;
  3022. if Result then begin
  3023. // Do something with the Output.StdOut array of string
  3024. end;
  3025. end;</pre></example>
  3026. <seealso><p><link topic="isxfunc_Exec">Exec</link><br />
  3027. <link topic="isxfunc_ExecAndLogOutput">ExecAndLogOutput</link></p></seealso>
  3028. </function>
  3029. <function>
  3030. <name>ExecAndLogOutput</name>
  3031. <prototype>function ExecAndLogOutput(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer; const OnLog: TOnLog): Boolean;</prototype>
  3032. <description><p>Identical to <link topic="isxfunc_Exec">Exec</link> except:</p>
  3033. <p>Console programs are always hidden and the ShowCmd parameter only affects GUI programs, so always using <tt>SW_SHOWNORMAL</tt> instead of <tt>SW_HIDE</tt> is recommended.</p>
  3034. <p>If OnLog is set to <tt>nil</tt> then the output of the executed executable or batch file is logged in Setup's or Uninstall's log file and/or in the Compiler IDE's "Debug Output" view.</p>
  3035. <p>If OnLog is not set to <tt>nil</tt> then the output is sent to the specified function, line by line.</p>
  3036. <p>An exception will be raised if there was an error setting up output redirection (which should be very rare).</p></description>
  3037. <remarks><p>Parameter <tt>Wait</tt> must always be set to <tt>ewWaitUntilTerminated</tt> when calling this function.</p>
  3038. <p>TOnLog is defined as:</p>
  3039. <p><tt>TOnLog = procedure(const S: String; const Error, FirstLine: Boolean);</tt></p>
  3040. <p>Parameter S is the output line when Error is False, otherwise an error message. FirstLine is True if this is the first line of output from the program, otherwise False.</p>
  3041. <p>Error will be True if reading the output failed (which should be very rare), or if the output is too big. There is no further output after an error.</p>
  3042. <p>Output is limited to a total size of 10 million bytes or a maximum of 1 million lines.</p></remarks>
  3043. <example><pre>var
  3044. Line: String;
  3045. procedure ExecAndGetFirstLineLog(const S: String; const Error, FirstLine: Boolean);
  3046. begin
  3047. if not Error and (Line = '') and (Trim(S) &lt;&gt; '') then
  3048. Line := S; { First non-empty line found, store it }
  3049. if FirstLine then
  3050. Log('Output:');
  3051. Log(S);
  3052. end;
  3053. function ExecAndGetFirstLine(const Filename, Params, WorkingDir: String; var ResultCode: Integer): String;
  3054. begin
  3055. Line := '';
  3056. try
  3057. ExecAndLogOutput(Filename, Params, WorkingDir, SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode, @ExecAndGetFirstLineLog);
  3058. except
  3059. Log(GetExceptionMessage);
  3060. end;
  3061. Result := Line;
  3062. end;</pre></example>
  3063. <seealso><p><link topic="isxfunc_Exec">Exec</link><br />
  3064. <link topic="isxfunc_ExecAndCaptureOutput">ExecAndCaptureOutput</link></p></seealso>
  3065. </function>
  3066. </subcategory>
  3067. </category>
  3068. <category>
  3069. <description>Other</description>
  3070. <subcategory>
  3071. <function>
  3072. <name>Sleep</name>
  3073. <prototype>procedure Sleep(const Milliseconds: LongInt);</prototype>
  3074. <description><p>Suspends the execution of Setup or Uninstall for a specified interval.</p></description>
  3075. </function>
  3076. <function>
  3077. <name>Random</name>
  3078. <prototype>function Random(const Range: Integer): Integer;</prototype>
  3079. <description><p>Returns a random number within the range 0 &lt;= X &lt; Range.</p></description>
  3080. </function>
  3081. <function>
  3082. <name>Beep</name>
  3083. <prototype>procedure Beep;</prototype>
  3084. <description><p>Beeps.</p></description>
  3085. <example><pre>Beep; //Beeps</pre></example>
  3086. </function>
  3087. <function>
  3088. <name>Set8087CW</name>
  3089. <prototype>procedure Set8087CW(NewCW: Word);</prototype>
  3090. <description><p>Sets the FPU control word.</p></description>
  3091. <example><pre>Set8087CW($133f); //Disables all fpu exceptions }</pre></example>
  3092. </function>
  3093. <function>
  3094. <name>Get8087CW</name>
  3095. <prototype>function Get8087CW: Word;</prototype>
  3096. <description><p>Returns the current value of the FPU control word.</p></description>
  3097. </function>
  3098. </subcategory>
  3099. <subcategory>
  3100. <function>
  3101. <name>BringToFrontAndRestore</name>
  3102. <prototype>procedure BringToFrontAndRestore;</prototype>
  3103. <description><p>Makes sure that Setup or Uninstall is visible and the foreground window.</p></description>
  3104. </function>
  3105. </subcategory>
  3106. </category>
  3107. <category>
  3108. <description>Deprecated</description>
  3109. <subcategory>
  3110. <function>
  3111. <name>LoadDLL</name>
  3112. <prototype>function LoadDLL(const DLLName: String; var ErrorCode: Integer): LongInt;</prototype>
  3113. <description><p>Loads the specified DLL. Returns the DLL handle if the DLL was loaded successfully, zero otherwise. If zero is returned then ErrorCode specifies the error that occurred. Use SysErrorMessage(ErrorCode) to get a description of the error.</p></description>
  3114. <remarks><p>This function is deprecated. See the <link topic="scriptdll" window="main">Using DLLs</link> topic.</p>
  3115. <p>Refer to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx">system error codes on MSDN</a>.</p></remarks>
  3116. </function>
  3117. <function>
  3118. <name>CallDLLProc</name>
  3119. <prototype>function CallDLLProc(const DLLHandle: LongInt; const ProcName: String; const Param1, Param2: LongInt; var Result: LongInt): Boolean;</prototype>
  3120. <description><p>Calls the specified function in a DLL specified using the DLL handle returned by LoadDLL. Returns True is the procedure was called successfully, False otherwise.<br />The function must use the standard calling convention, accept two 4 byte integer parameters and return a 4 byte integer result.</p></description>
  3121. <remarks><p>This function is deprecated. See the <link topic="scriptdll" window="main">Using DLLs</link> topic.</p></remarks>
  3122. </function>
  3123. <function>
  3124. <name>FreeDLL</name>
  3125. <prototype>function FreeDLL(const DLLHandle: LongInt): Boolean;</prototype>
  3126. <description><p>Unloads a DLL specified using the DLL handle returned by LoadDLL.</p></description>
  3127. <remarks><p>This function is deprecated. See the <link topic="scriptdll" window="main">Using DLLs</link> topic.</p></remarks>
  3128. </function>
  3129. </subcategory>
  3130. <subcategory>
  3131. <function>
  3132. <name>CastStringToInteger</name>
  3133. <prototype>function CastStringToInteger(var S: String): LongInt;</prototype>
  3134. <description><p>Casts a string to an integer so that a string can be passed to a DLL using CallDllProc.</p></description>
  3135. <remarks><p>This function is deprecated. See the <link topic="scriptdll" window="main">Using DLLs</link> topic.</p></remarks>
  3136. </function>
  3137. <function>
  3138. <name>CastIntegerToString</name>
  3139. <prototype>function CastIntegerToString(const L: LongInt): String;</prototype>
  3140. <description><p>Casts an integer to a string so that a string can be received from a DLL using CallDllProc.</p></description>
  3141. <remarks><p>This function is deprecated. See the <link topic="scriptdll" window="main">Using DLLs</link> topic.</p></remarks>
  3142. </function>
  3143. </subcategory>
  3144. </category>
  3145. </isxfunc>
  3146. <isxenum>
  3147. <enum>
  3148. <description>Exec and ShellExec - ShowCmd values</description>
  3149. <values>SW_SHOW, SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, SW_SHOWMINNOACTIVE, SW_HIDE</values>
  3150. </enum>
  3151. <enum>
  3152. <description>MsgBox - Buttons flags</description>
  3153. <values>MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_SETFOREGROUND</values>
  3154. </enum>
  3155. <enum>
  3156. <description>MsgBox - return values</description>
  3157. <values>IDOK, IDCANCEL, IDABORT, IDRETRY, IDIGNORE, IDYES, IDNO</values>
  3158. </enum>
  3159. <enum>
  3160. <description>Reg* - RootKey values (also see the <link topic="registrysection" window="main">[Registry]</link> section documentation)</description>
  3161. <values>HKEY_AUTO, HKEY_AUTO_32, HKEY_AUTO_64,<br />HKEY_CLASSES_ROOT, HKEY_CLASSES_ROOT_32, HKEY_CLASSES_ROOT_64,<br />HKEY_CURRENT_USER, HKEY_CURRENT_USER_32, HKEY_CURRENT_USER_64,<br />HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE_32, HKEY_LOCAL_MACHINE_64,<br />HKEY_USERS, HKEY_USERS_32, HKEY_USERS_64,<br />HKEY_PERFORMANCE_DATA,<br />HKEY_CURRENT_CONFIG, HKEY_CURRENT_CONFIG_32, HKEY_CURRENT_CONFIG_64,<br />HKEY_DYN_DATA,<br />HKA, HKA32, HKA64, HKCR, HKCR32, HKCR64, HKCU, HKCU32, HKCU64, HKLM, HKLM32, HKLM64, HKU, HKU32, HKU64, HKCC, HKCC32, HKCC64</values>
  3162. </enum>
  3163. </isxenum>
  3164. </isxhelp>