﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Mumoo-随笔分类-NSIS</title><link>http://www.cppblog.com/Mumoo/category/19315.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 03 Oct 2012 03:52:20 GMT</lastBuildDate><pubDate>Wed, 03 Oct 2012 03:52:20 GMT</pubDate><ttl>60</ttl><item><title>NSIS随笔</title><link>http://www.cppblog.com/Mumoo/archive/2012/09/27/192180.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Thu, 27 Sep 2012 09:48:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/09/27/192180.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/192180.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/09/27/192180.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/192180.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/192180.html</trackback:ping><description><![CDATA[SilentInstall silent &#8212;&#8212; 设置静默安装 此状态下可使用 MessageBox&nbsp;的 /SD 参数来指定静默安装时默认的返回值<br /><br />HKLM&#8212;&#8212;Local Machine<br />HKCU&#8212;&#8212;Current User<br /><img src ="http://www.cppblog.com/Mumoo/aggbug/192180.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-09-27 17:48 <a href="http://www.cppblog.com/Mumoo/archive/2012/09/27/192180.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS文件函数头文件介绍</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/15/174967.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Tue, 15 May 2012 06:00:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/15/174967.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174967.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/15/174967.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174967.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174967.html</trackback:ping><description><![CDATA[<p>文件函数，顾名思义就是处理文件用的函数。使用这些文件处理函数前，必须先包含头文件FileFunc.nsh。该头文件目前包含如下一些函数：Locate、GetSize、DriveSpace、GetDrives、GetTime、GetFileAttributes、GetFileVersion、GetExeName、GetExePath、GetParameters、GetOptions、GetRoot、GetParent、GetFileName、GetBaseName、GetFileExt。文件处理函数的主要作用有文件搜索、获取路径、获取驱动器信息、获取命令行参数等等，应用甚广。下面我们就将该头文件中的函数作用作以简单介绍。</p>
<ul><li>Locate - 搜索指定文件夹中符合指定过滤文件大小或指定文件过滤名的文件，并根据选项返回查找的文件路径、文件夹和名称 </li></ul>
<ul><li>GetSize - 搜索文件、指定文件过滤名的文件或文件夹的大小或数量 </li></ul>
<ul><li>DriveSpace - 获取驱动器的全部、已用和可用空间 </li></ul>
<ul><li>GetDrives - 查找系统中所有可用驱动器 </li></ul>
<ul><li>GetTime - 获取本地或系统时间；获取文件访问、创建和修改时间 </li></ul>
<ul><li>GetFileAttributes - 获取文件或文件夹属性 </li></ul>
<ul><li>GetFileVersion - 获取可执行文件的版本信息 </li></ul>
<ul><li>GetExeName - 获取安装程序运行完整路径 </li></ul>
<ul><li>GetExePath - 获取安装程序运行所在文件夹 </li></ul>
<ul><li>GetParameters - 获取安装程序运行命令行参数 </li></ul>
<ul><li>GetOptions - 获取安装程序运行命令行选项的值 </li></ul>
<ul><li>GetRoot - 获取给定路径所属的根目录 </li></ul>
<ul><li>GetParent - 获取给定路径的上层目录 </li></ul>
<ul><li>GetFileName - 获取文件路径中的文件名称 </li></ul>
<ul><li>GetBaseName - 获取文件路径中的文件基本名 </li></ul>
<ul><li>GetFileExt - 获取文件路径中的文件扩展名 </li></ul><img src ="http://www.cppblog.com/Mumoo/aggbug/174967.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-15 14:00 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/15/174967.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS文本函数头文件介绍</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/15/174944.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Tue, 15 May 2012 01:59:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/15/174944.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174944.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/15/174944.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174944.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174944.html</trackback:ping><description><![CDATA[<h1 style="margin-top: 20px; font-size: 20px"><a href="http://hi.csdn.net/jinglidong"><span style="font-family: Courier; font-size: 14pt">转自：http://hi.csdn.net/jinglidong</span></a></h1>
<div style="line-height: 25px; height: auto; color: rgb(136,136,136); font-size: 13px" class="homeseparator">
<div class="content">
<p><span style="color: #000000">文本函数，顾名思义就是处理文本文件的函数。使用这些文本函数前，必须先包含头文件TextFunc.nsh。有些函数需要预声明，这个在帮助中有详细介绍，具体可查阅帮助。该头文件目前包含如下一些函数：LineFind、LineRead、FileReadFromEnd、LineSum、FileJoin、TextCompare、TextCompareS、ConfigRead、ConfigReadS、ConfigWrite、ConfigWriteS、FileRecode、TrimNewLines。下面我们就常用函数用法做以简单介绍。</span></p>
<ul><li><span style="color: #000000">LineFind </span></li></ul>
<p><span style="color: #000000">查找文本文件中的指定行并在回调函数中编辑或者查看该行。语法：</span><br /><span style="color: #000000">${LineFind} "[文件1]" "[文件2|/NUL]" "[行号]" "函数"</span></p>
<ul><li><span style="color: #000000">LineRead </span></li></ul>
<p><span style="color: #000000">读取指定文本文件中指定行号的内容。语法：</span><br /><span style="color: #000000">${LineRead} "[文件]" "[行号]" $输出变量</span></p>
<ul><li><span style="color: #000000">FileReadFromEnd </span></li></ul>
<p><span style="color: #000000">从末尾起逐行读取文本文件。语法：</span><br /><span style="color: #000000">${FileReadFromEnd} "[文件]" "函数"</span></p>
<ul><li><span style="color: #000000">LineSum </span></li></ul>
<p><span style="color: #000000">获取文本文件的行数。语法：</span><br /><span style="color: #000000">${LineSum} "[文件]" $输出变量</span></p>
<ul><li><span style="color: #000000">FileJoin </span></li></ul>
<p><span style="color: #000000">将两个文件合并为一个。语法：</span><br /><span style="color: #000000">${FileJoin} "[文件1]" "[文件2]" "[文件3]"</span></p>
<ul><li><span style="color: #000000">TextCompare </span></li></ul>
<p><span style="color: #000000">比较两个文本文件。语法：</span><br /><span style="color: #000000">${TextCompare} "[文件1]" "[文件2]" "[选项]" "函数"</span></p>
<ul><li><span style="color: #000000">FileRecode </span></li></ul>
<p><span style="color: #000000">将文本文件从 DOS 重新编码为 Windows 格式，反之亦然。语法：</span><br /><span style="color: #000000">${FileRecode} "[文件]" "[格式]"</span></p>
<ul><li><span style="color: #000000">TrimNewLines </span></li></ul>
<p><span style="color: #000000">修剪字符串中的新行。语法：</span><br /><span style="color: #000000">${TrimNewLines} "[字符串]" $输出变量</span></p>
<p><span style="color: #000000">该头文件中的ConfigRead/ConfigWrite函数与NSIS内置的ReadINIStr及WriteINIStr命令用法类似，故在此不再赘述。</span></p></div></div><img src ="http://www.cppblog.com/Mumoo/aggbug/174944.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-15 09:59 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/15/174944.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS文字及字符串函数与头文件介绍</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/15/174942.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Tue, 15 May 2012 01:55:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/15/174942.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174942.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/15/174942.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174942.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174942.html</trackback:ping><description><![CDATA[<div>转自 http://hi.csdn.net/jinglidong<br /><br />
<p>文字函数，顾名思义就是处理字符串的函数。使用这些字符串函数前，必须先包含头文件WordFunc.nsh。该头文件目前包含如下一些函数：WordFind、WordFind2X、WordFind3X、WordReplace、WordAdd、WordInsert、StrFilter、VersionCompare、VersionConvert等。这些函数的主要作用都是查找字符串。下面我们就常用函数用法做以简单介绍。</p>
<ul><li>WordFind</li></ul>
<p>用于在给定字符串中查找使用指定的分隔符分隔的字符串。由于功能众多，其语法与参数在此不再赘述。举例说明：假如我们要从字符串&#8220;first;second;third;forth&#8221;中查找第二个字符串，就必须使用这样的代码：<br />${WordFind} "first;second;third;forth" ";" +2 $R0<br />输出的结果$R0为second。其中的+2中的&#8220;+&#8221;代表从左查找，2代表第二个字符串。</p>
<ul><li>WordFind2X</li></ul>
<p>用于在给定字符串中查找使用指定的两个分隔符包围的字符串。功能强大，语法与参数亦不赘述。举例说明其用法：假如我们要从字符串&#8220;&lt;System&gt;|&lt;Guest&gt;|&lt;User&gt;&#8221;中查找第三个字符串，也就是倒数第一个，即User，用第一个就比较麻烦了。这是我们需要借助WordFind2X查找。代码如下：<br />${WordFind2X} "&lt;System&gt;|&lt;Guest&gt;|&lt;User&gt;" "&lt;" "&gt;" -1 $R0<br />输出的结果$R0为User。其中的-1中的&#8220;-&#8221;代表从右计算，1代表第二个字符串。</p>
<ul><li>WordFind3X</li></ul>
<p>与WordFind2X比较相似，用于在给定字符串中查找使用指定的两个分隔符包围且含有指定字符串的字符串。使用方法将不做介绍，用户可以参考中文版本的帮助文件。</p>
<ul><li>WordReplace</li></ul>WordReplace的作用是从字符串中替换或删除词语。语法：<br />${WordReplace} "[字符串]" "[词语1]" "[词语2]" "[E][选项]" $输出变量 
<p>&nbsp;</p>
<ul><li>WordAdd</li></ul>
<p>从选项中指定的字符串2添加词语到字符串1(如果不存在)，或删除词语(如果存在)。语法：<br />${WordAdd} "[字符串1]" "[分隔符]" "[E][选项]]" $输出变量</p>
<p>&nbsp;</p>
<ul><li>WordInsert</li></ul>在字符串中插入词语。语法：<br />${WordInsert} "[字符串]" "[分隔符]" "[词语]" "[E][选项]]" $输出变量 
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<ul><li>StrFilter</li></ul>
<p>转换字符串为大写或小写；设置符号过滤。语法：<br />${StrFilter} "[字符串]" "[选项]" "[符号1]" "[符号2]" $输出变量</p>
<p>&nbsp;</p>
<ul><li>VersionCompare</li></ul>用来比较版本号的大小。例如，比较1.1.0.1和1.1.1.0的大小。语法：<br />${VersionCompare} "[版本1]" "[版本2]" $输出变量 
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<ul><li>VersionConvert</li></ul>
<p>将带字母的版本转换为可用于比较的十进制数版本号。语法：<br />${VersionConvert} "[版本]" "[字符列表]" $输出变量<br />用法示例：${VersionConvert} "9.0c" "" $R0<br />结果变量$R0的值为9.0.03。这样转换后可以用于和别的版本如9.0a比较。</p></div><img src ="http://www.cppblog.com/Mumoo/aggbug/174942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-15 09:55 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/15/174942.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS逻辑函数头文件介绍 </title><link>http://www.cppblog.com/Mumoo/archive/2012/05/15/174938.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Tue, 15 May 2012 01:43:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/15/174938.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174938.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/15/174938.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174938.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174938.html</trackback:ping><description><![CDATA[<div><span style="color: #000000">转自 http://hi.csdn.net/jinglidong</span><br /><br />
<div class="clearer"><span style="color: #000000">!include "LogicLib.nsh"</span><br /><span style="color: #000000">使用 NSIS 的宏来提供各种逻辑基本语句，不需要预先添加函数。</span></div>
<div style="line-height: 25px; height: auto; color: rgb(136,136,136); font-size: 13px" class="homeseparator">
<div class="content">
<ul><li><span style="color: #000000">基本语句 </span></li></ul>
<p><span style="color: #000000">If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless</span><br /><span style="color: #000000">- 有条件的执行一个语句区块，取决于表达式。</span></p>
<p><span style="color: #000000">AndIf|AndUnless|OrIf|OrUnless</span><br /><span style="color: #000000">- 给 If、Unless、ElseIf 和 ElseUnless 增加额外的条件语句。</span></p>
<p><span style="color: #000000">IfThen..|..|</span><br /><span style="color: #000000">- 有条件的执行一个内联语句，取决于表达式。</span></p>
<p><span style="color: #000000">IfCmd..||..|</span><br /><span style="color: #000000">- 条件的执行一个内联语句，取决于 NSIS 函数提供的真值。</span></p>
<p><span style="color: #000000">Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect</span><br /><span style="color: #000000">- 执行多个语句区块之一，取决于表达式的值。</span></p>
<p><span style="color: #000000">Switch..{Case|CaseElse|Default}..EndSwitch</span><br /><span style="color: #000000">- 跳转到多个标记之一，取决于表达式的值。</span></p>
<p><span style="color: #000000">Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]</span><br /><span style="color: #000000">- 重复一个语句区块直到停止 取决于表达式的值。</span></p>
<p><span style="color: #000000">While..{ExitWhile|Continue|Break}..EndWhile</span><br /><span style="color: #000000">- DoWhile..Loop的别名(向后兼容)</span></p>
<p><span style="color: #000000">For[Each]..{ExitFor|Continue|Break}..Next</span><br /><span style="color: #000000">- 重复语句区块来连续改变变量的值。</span></p>
<ul><li><span style="color: #000000">表达式 </span></li></ul>
<p><span style="color: #000000">标准(内建的)字串判断(不区分大小写)：</span><br /><span style="color: #000000">a == b; a != b</span></p>
<p><span style="color: #000000">另外的不区分大小写的字串判断(使用 System.dll)：</span><br /><span style="color: #000000">a S&lt; b; a S&gt;= b; a S&gt; b; a S&lt;= b</span><br /><span style="color: #000000">- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP</span></p>
<p><span style="color: #000000">区分大小写字串判断(使用 System.dll)：</span><br /><span style="color: #000000">a S== b; a S!= b</span><br /><span style="color: #000000">- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP</span></p>
<p><span style="color: #000000">标准(内建的)有符号整数判断：</span><br /><span style="color: #000000">a = b; a &lt;&gt; b; a &lt; b; a &gt;= b; a &gt; b; a &lt;= b</span></p>
<p><span style="color: #000000">标准(内建的)无符号整数判断：</span><br /><span style="color: #000000">a U&lt; b; a U&gt;= b; a U&gt; b; a U&lt;= b</span></p>
<p><span style="color: #000000">64位整数判断(使用System.dll)：</span><br /><span style="color: #000000">a L= b; a L&lt;&gt; b; a L&lt; b; a L&gt;= b; a L&gt; b; a L&lt;= b</span><br /><span style="color: #000000">- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_INT64CMP</span></p>
<p><span style="color: #000000">内建的NSIS标记判断：</span><br /><span style="color: #000000">${Abort};</span><br /><span style="color: #000000">${Errors};</span><br /><span style="color: #000000">${RebootFlag};</span><br /><span style="color: #000000">${Silent}</span></p>
<p><span style="color: #000000">内建的 NSIS 其它判断：</span><br /><span style="color: #000000">${FileExists} a;</span></p>
<p><span style="color: #000000">任何有条件的 NSIS 指令判断：</span><br /><span style="color: #000000">${Cmd} a;</span></p>
<p><span style="color: #000000">区段标记判断：</span><br /><span style="color: #000000">${SectionIsSelected} a;</span><br /><span style="color: #000000">${SectionIsSectionGroup} a;</span><br /><span style="color: #000000">${SectionIsSectionGroupEnd} a;</span><br /><span style="color: #000000">${SectionIsBold} a;</span><br /><span style="color: #000000">${SectionIsReadOnly} a;</span><br /><span style="color: #000000">${SectionIsExpanded} a;</span><br /><span style="color: #000000">${SectionIsPartiallySelected} a;</span></p></div></div></div><img src ="http://www.cppblog.com/Mumoo/aggbug/174938.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-15 09:43 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/15/174938.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS 条件判断及循环语句的使用</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/14/174834.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Mon, 14 May 2012 02:30:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/14/174834.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174834.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/14/174834.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174834.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174834.html</trackback:ping><description><![CDATA[头文件引用:<br />!include "LogicLib.nsh"<br /><br />&nbsp;基本语句<br /><br />If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless<br />- 有条件的执行一个语句区块，取决于表达式。<br /><br />AndIf|AndUnless|OrIf|OrUnless<br />- 给 If, Unless, ElseIf 和 ElseUnless 增加额外的条件语句。<br /><br />IfThen..|..|<br />- 有条件的执行一个内联语句，取决于表达式。<br /><br />IfCmd..||..|<br />- 条件的执行一个内联语句，取决于 NSIS 函数提供的真值。<br /><br />Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect<br />- 执行多个语句区块之一，取决于表达式的值。<br /><br />Switch..{Case|CaseElse|Default}..EndSwitch<br />- 跳转到多个标记之一，取决于表达式的值。<br /><br />Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]<br />- 重复一个语句区块直到停止 取决于表达式的值。<br /><br />While..{ExitWhile|Continue|Break}..EndWhile<br />- DoWhile..Loop 的别名 (向后兼容)<br /><br />For[Each]..{ExitFor|Continue|Break}..Next<br />- 重复语句区块来连续改变变量的值。<br /><br />Goto<br />要跳转的标记 | +偏移| -偏移| 用户变量(目标地址)<br />如果指定了标记，则跳转到 &#8220;要跳转的标记:&#8221;。<br /><br />如果指定了 +偏移 或 -偏移 ，跳转会根据偏移指令相对的跳转。Goto +1 跳转到下一条指令，Goto -1 跳转到上一条指令，等等。<br /><br />Goto label<br />Goto +2<br />Goto -2<br />Goto $0<br /><br />这是原生支持的跳转，利用跳转可以写循环。<br />  <img src ="http://www.cppblog.com/Mumoo/aggbug/174834.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-14 10:30 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/14/174834.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS if与while的使用</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/11/174542.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Fri, 11 May 2012 02:25:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/11/174542.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174542.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/11/174542.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174542.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174542.html</trackback:ping><description><![CDATA[<p align="left"><font face="Verdana">逻辑语句的宏文件： !include logiclib.nsh<br />IF语句：<br />&nbsp;&nbsp;&nbsp;${If} $0 == 'some value'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox MB_OK '$$0 is some value'<br />&nbsp;&nbsp;&nbsp;${ElseIf} $0 == 'some other value'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox MB_OK '$$0 is some other value'<br />&nbsp;&nbsp;&nbsp;${Else}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox MB_OK '$$0 is "$0"'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${EndIf}<br /><br />while循环：</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;StrCpy $R1 0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;字符串赋值为整型<br />&nbsp;&nbsp;&nbsp;${While} $R1 &lt; 5<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IntOp $R1 $R1 + 1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DetailPrint $R1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;打印字符串<br />${EndWhile}</font></p>
<p>&nbsp;</p>  <img src ="http://www.cppblog.com/Mumoo/aggbug/174542.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-11 10:25 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/11/174542.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>判断NSIS变量是否为空</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/11/174541.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Fri, 11 May 2012 02:12:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/11/174541.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174541.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/11/174541.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174541.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174541.html</trackback:ping><description><![CDATA[!include logiclib.nsh<br /><br />Var tmpInst<br />ReadRegStr $0 HKLM ${PRODUCT_INST_KEY} "InstallDir"<br />MessageBox MB_OK "tmpInst 有没有值: $0"<br /><br />${If} $0 == ""<br />MessageBox MB_OK "没值"<br />${Else}<br />MessageBox MB_OK "有值"<br />${EndIf}<br /> <img src ="http://www.cppblog.com/Mumoo/aggbug/174541.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-11 10:12 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/11/174541.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NSIS 注册表中键值是否存在~</title><link>http://www.cppblog.com/Mumoo/archive/2012/05/09/174119.html</link><dc:creator>Mumoo</dc:creator><author>Mumoo</author><pubDate>Wed, 09 May 2012 08:12:00 GMT</pubDate><guid>http://www.cppblog.com/Mumoo/archive/2012/05/09/174119.html</guid><wfw:comment>http://www.cppblog.com/Mumoo/comments/174119.html</wfw:comment><comments>http://www.cppblog.com/Mumoo/archive/2012/05/09/174119.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Mumoo/comments/commentRss/174119.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Mumoo/services/trackbacks/174119.html</trackback:ping><description><![CDATA[<pre style="font-family: monospace" class="nsis"><strong><span style="font-style: italic; color: #666666">; OpenReg.nsi</span>
<span style="font-style: italic; color: #666666">; 检查某注册表键是否存在的NSIS例子</span>
<span style="font-style: italic; color: #666666">; 编写：zhfi &lt;zhfi1022@tom.com&gt;</span>
 
<span style="font-style: italic; color: #666666">;--------------------------------</span>
<span style="font-style: italic; color: #666666">;定义注册表主键</span>
<span style="color: #000066; font-weight: bold">!define</span> <span style="color: #ff6600">HKEY_CLASSES_ROOT</span>           0x80000000
<span style="color: #000066; font-weight: bold">!define</span> <span style="color: #ff6600">HKEY_CURRENT_USER</span>           0x80000001
<span style="color: #000066; font-weight: bold">!define</span> <span style="color: #ff6600">HKEY_LOCAL_MACHINE</span>          0x80000002
<span style="color: #000066; font-weight: bold">!define</span> <span style="color: #ff6600">HKEY_USERS</span>                  0x80000003
 
<span style="color: #000066">OutFile</span> OpenReg.exe
 
<span style="color: #000066">XPStyle</span> <span style="color: #ff6600">on</span>
 
<span style="color: #000066; font-weight: bold">!include</span> <span style="color: #006600">LogicLib.nsh</span>
 
<span style="font-style: italic; color: #666666">;--------------------------------</span>
<span style="color: #000066">Name</span> OpenReg
 
<span style="color: #000066">Section</span> Nil
<span style="color: #000066">SectionEnd</span>
 
<span style="color: #000066">Function</span> <span style="color: #006600">.onInit</span>
<span style="font-style: italic; color: #666666">;为键的句柄创建一个缓存</span>
<span style="color: #ff6600">System</span>::<span style="color: #000099">Call</span> <span style="color: #660066">"*(i 0) i .R0"</span>
<span style="font-style: italic; color: #666666">;将要检测的键放入内存中</span>
<span style="color: #000099">Push</span> <span style="color: #660066">"SOFTWARE\TENCENT\QQPinYin"</span>
<span style="font-style: italic; color: #666666">;调用API进行检查，返回值在$R1中</span>
<span style="color: #ff6600">system</span>::<span style="color: #000099">call</span> <span style="color: #660066">'Advapi32::RegOpenKey(i ${HKEY_LOCAL_MACHINE}, t s, i R0) .iR1'</span>
<span style="font-style: italic; color: #666666">;关闭该键的句柄</span>
<span style="color: #ff6600">system</span>::<span style="color: #000099">call</span> <span style="color: #660066">'Advapi32::RegCloseKey(i R0)'</span>
<span style="font-style: italic; color: #666666">;释放内存</span>
<span style="color: #ff6600">system</span>::</strong><span style="color: #003399">free
</span><span style="font-style: italic; color: #666666">;返回值：</span>
<span style="font-style: italic; color: #666666">;0代表键存在</span>
<span style="font-style: italic; color: #666666">;2代表键不存在</span>
<span style="font-style: italic; color: #666666">;其它值表示出错</span>
<span style="color: #006600"><span style="color: #660000">$<span>{</span>If<span>}</span></span></span> <span style="color: #660000">$R1</span> == <span>0</span>
<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#117;&#112;&#112;&#111;&#114;&#116;&#64;&#67;&#117;&#116;&#101;&#83;&#111;&#102;&#116;&#46;&#78;&#101;&#116;">Contact us</a>this is my email signatureMessagebox <span style="color: #ff6600">mb_ok</span> <span style="color: #660066">"Key Exists!"</span>
<span style="color: #006600"><span style="color: #660000">$<span>{</span>ElseIf<span>}</span></span></span> <span style="color: #660000">$R1</span> == <span>2</span>
<span style="color: #000099">Messagebox</span> <span style="color: #ff6600">mb_ok</span> <span style="color: #660066">"Key doesn't Exists!"</span>
<span style="color: #006600"><span style="color: #660000">$<span>{</span>Else<span>}</span></span></span>
<span style="color: #000099">Messagebox</span> <span style="color: #ff6600">mb_ok</span> <span style="color: #660066">"Error!"</span>
<span style="color: #006600"><span style="color: #660000">$<span>{</span>EndIf<span>}</span></span></span>
<span style="color: #000099">Pop</span> <span style="color: #660000">$R1</span>
<span style="color: #000099">Pop</span> <span style="color: #660000">$R0</span>
<span style="color: #000099">Quit</span>
<span style="color: #000066">FunctionEnd</span></pre><br /> <img src ="http://www.cppblog.com/Mumoo/aggbug/174119.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Mumoo/" target="_blank">Mumoo</a> 2012-05-09 16:12 <a href="http://www.cppblog.com/Mumoo/archive/2012/05/09/174119.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>