﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; xul</title>
	<atom:link href="https://www.softwareace.cn/?cat=102&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>thunderbird 二次开发 xpcom 获取 pref 配置</title>
		<link>https://www.softwareace.cn/?p=1093</link>
		<comments>https://www.softwareace.cn/?p=1093#comments</comments>
		<pubDate>Tue, 06 Jan 2015 02:56:46 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[firefox 插件]]></category>
		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1093</guid>
		<description><![CDATA[[crayon-6a08303304295526312798/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">bool showProgress = false;
nsCOMPtr&lt;nsIPrefBranch&gt; prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefBranch)
prefBranch-&gt;GetBoolPref("mailnews.show_send_progress", &amp;showProgress);</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1093</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>js ctypes  操作注册表</title>
		<link>https://www.softwareace.cn/?p=1047</link>
		<comments>https://www.softwareace.cn/?p=1047#comments</comments>
		<pubDate>Fri, 28 Nov 2014 11:19:47 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[firefox 插件]]></category>
		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1047</guid>
		<description><![CDATA[[crayon-6a08303304f82803665871/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">function getLocalVersion(){
  //::RegSetValueExA(m_hkey, key.c_str(), 0, REG_SZ, (BYTE*)val.c_str(), (DWORD)val.size());
  //if (::RegOpenKeyExA(hkey, subKey.c_str(), 0, KEY_ALL_ACCESS, &amp;m_hkey) != ERROR_SUCCESS)
  var lib = ctypes.open("Advapi32.dll");
  var RegQueryValueExW = lib.declare("RegQueryValueExW", ctypes.winapi_abi, ctypes.int32_t, HKEY, ctypes.jschar.ptr, LPDWORD, LPDWORD, ctypes.jschar.ptr, LPDWORD);
  var RegOpenKeyExW = lib.declare("RegOpenKeyExW", ctypes.winapi_abi, ctypes.int32_t, HKEY, ctypes.jschar.ptr, LPDWORD, LPDWORD, HKEY.ptr);
  var m_hkey = HKEY();
  var version = ctypes.jschar.array(1024)("");;
  if (RegOpenKeyExW(HKEY(HKEY_LOCAL_MACHINE), ctypes.jschar.array()("SOFTWARE\\Wow6432Node\\xxx\\appname"),
    LPDWORD(0), LPDWORD(KEY_QUERY_VALUE), m_hkey.address()) == ERROR_SUCCESS)
  {
    var len = DWORD(1024 * 2);
    var ret = RegQueryValueExW(m_hkey,
      ctypes.jschar.array()("UpdateVersion"),
      LPDWORD(0),
      LPDWORD(0),
      version,
      len.address());
  }

  lib.close();
  var resutVersion = version.readString();
  return "["+resutVersion+"]";
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1047</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xulrunner 判断系统版本</title>
		<link>https://www.softwareace.cn/?p=993</link>
		<comments>https://www.softwareace.cn/?p=993#comments</comments>
		<pubDate>Thu, 23 Oct 2014 09:03:56 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=993</guid>
		<description><![CDATA[[crayon-6a0830330521a730290868/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">function GetOS()
{
  if (gOS)
    return gOS;

  var platform = navigator.platform.toLowerCase();

  if (platform.contains("win"))
    gOS = gWin;
  else if (platform.contains("mac"))
    gOS = gMac;
  else if (platform.contains("unix") || platform.contains("linux") || platform.contains("sun"))
    gOS = gUNIX;
  else
    gOS = "";
  // Add other tests?

  return gOS;
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=993</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用nsIHelperAppLauncher.SaveToDisk保存文件时,会弹窗firefox的下载窗口</title>
		<link>https://www.softwareace.cn/?p=990</link>
		<comments>https://www.softwareace.cn/?p=990#comments</comments>
		<pubDate>Wed, 22 Oct 2014 09:01:04 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=990</guid>
		<description><![CDATA[[crayon-6a0830330546f551609944/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">使用nsIHelperAppLauncher.SaveToDisk保存文件时,会弹窗firefox的下载窗口, 当任务完成时关闭窗口或者是禁止这个窗口

用 Xpcom.GetService&lt;nsIWindowWatcher&gt;("@mozilla.org/embedcomp/window-watcher;1") .OpenWindow(null,chrome://mozapps/content/downloads/downloads.xul) 可以打开这个窗体,我尝试过,调用nsIHelperAppLauncher.SaveToDisk之后在调用Xpcom.GetService&lt;nsIWindowWatcher&gt;("@mozilla.org/embedcomp/window-watcher;1") .OpenWindow(null,chrome://mozapps/content/downloads/downloads.xul)还是会重新打开一个窗体



https://developer.mozilla.org/en-US/docs/Download_Manager_preferences

browser.download.manager.showWhenStarting ==false

 文件下载完成 不会重命名删除.part
browser.helperApps.deleteTempFileOnExit =true
搞定</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=990</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox下完整读写本地文件的方法</title>
		<link>https://www.softwareace.cn/?p=985</link>
		<comments>https://www.softwareace.cn/?p=985#comments</comments>
		<pubDate>Thu, 16 Oct 2014 07:51:41 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=985</guid>
		<description><![CDATA[[crayon-6a08303305a55410622699/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">//保存为本地文件
            function save(path,content) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } catch (e) {
                    alert("Permission to save file was denied.");
                }
                var file = Components.classes["@mozilla.org/file/local;1"]
                    .createInstance(Components.interfaces.nsILocalFile);
                file.initWithPath( path );
                if ( file.exists() == false ) {
                    //alert( "Creating file... " );
                    file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 );
                }
                var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
                    .createInstance( Components.interfaces.nsIFileOutputStream );
              
              
                outputStream.init( file, 0x04 | 0x08 | 0x20, 420, 0 );
            
                 var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
                                .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
                converter.charset = 'UTF-8';
            
                var convSource = converter.ConvertFromUnicode(content);
                var result = outputStream.write( convSource, convSource.length );
                outputStream.close();
            }
           
            //读取本地文件
            function read(path) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } catch (e) {
                    alert("Permission to read file was denied.");
                }
                var file = Components.classes["@mozilla.org/file/local;1"]
                    .createInstance(Components.interfaces.nsILocalFile);
                file.initWithPath( path );
                if ( file.exists() == false ) {
                    alert("File does not exist");
                }
                var is = Components.classes["@mozilla.org/network/file-input-stream;1"]
                    .createInstance( Components.interfaces.nsIFileInputStream );
                is.init( file,0x01, 00004, null);
                var sis = Components.classes["@mozilla.org/scriptableinputstream;1"]
                    .createInstance( Components.interfaces.nsIScriptableInputStream );
                sis.init( is );
                var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
                                      .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
               converter.charset = "UTF-8";
                var output = converter.ConvertToUnicode(sis.read( sis.available() ));
                return output;
            }
                  save("d://Yes.txt","这下ok了吧");
     alert(read("d://Yes.txt"));</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=985</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xpcom js 获取 文件路径</title>
		<link>https://www.softwareace.cn/?p=983</link>
		<comments>https://www.softwareace.cn/?p=983#comments</comments>
		<pubDate>Thu, 16 Oct 2014 07:44:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=983</guid>
		<description><![CDATA[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/X [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDirectoryServiceProvider/getFile</p>
<p>&nbsp;</p><pre class="crayon-plain-tag">var localFile = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("CurProcD", Ci.nsIFile);
  localFile.append("123.txt");</pre><p>获取程序运行目录下的123.txt</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=983</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>不通过xpcom技术，使用js-ctypes在addon中直接调用dll中的函数</title>
		<link>https://www.softwareace.cn/?p=962</link>
		<comments>https://www.softwareace.cn/?p=962#comments</comments>
		<pubDate>Wed, 24 Sep 2014 10:03:17 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=962</guid>
		<description><![CDATA[js-ctypes 非常强大，是我们可以摆脱xpcom技术带来的版本兼容性束缚！这里我们先提供一个最简单的例子 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>js-ctypes 非常强大，是我们可以摆脱xpcom技术带来的版本兼容性束缚！这里我们先提供一个最简单的例子来说明如何使用ctypes：</p>
<p>更多信息请参考MDN相关文献</p>
<p><a title="https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes" href="https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes" target="_blank">https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes</a></p>
<p>欢迎有兴趣和疑问的同学请回帖。</p>
<div>
<div id="highlighter_153098" class="syntaxhighlighter  js">
<pre class="crayon-plain-tag">Components.utils.import("resource://gre/modules/ctypes.jsm");
  var lib = ctypes.open("C:\\WINDOWS\\system32\\user32.dll");
  /* Declare the signature of the function we are going to call */
  var msgBox = lib.declare("MessageBoxW",
                           ctypes.winapi_abi,
                           ctypes.int32_t,
                           ctypes.int32_t,
                           ctypes.jschar.ptr,
                           ctypes.jschar.ptr,
                           ctypes.int32_t);
  var MB_OK = 0;
  var ret = msgBox(0, "Hello world", "title", MB_OK);
  lib.close();</pre><br />
&nbsp;</p>
</div>
</div>
<p>&nbsp;</p>
<p>另外，也可以用javascript直接编写XPCOM同样可以避免火狐版本不兼容的问题。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=962</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xulrunner js sqlite Storage</title>
		<link>https://www.softwareace.cn/?p=959</link>
		<comments>https://www.softwareace.cn/?p=959#comments</comments>
		<pubDate>Mon, 22 Sep 2014 03:15:43 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=959</guid>
		<description><![CDATA[https://developer.mozilla.org/cn/docs/Storage]]></description>
				<content:encoded><![CDATA[<p>https://developer.mozilla.org/cn/docs/Storage</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=959</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XUL controls</title>
		<link>https://www.softwareace.cn/?p=951</link>
		<comments>https://www.softwareace.cn/?p=951#comments</comments>
		<pubDate>Mon, 15 Sep 2014 06:07:38 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=951</guid>
		<description><![CDATA[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/X [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/XUL_controls" target="_blank">https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/XUL_controls</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=951</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>html 通过css设置 图片层叠</title>
		<link>https://www.softwareace.cn/?p=946</link>
		<comments>https://www.softwareace.cn/?p=946#comments</comments>
		<pubDate>Thu, 11 Sep 2014 06:08:51 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=946</guid>
		<description><![CDATA[[crayon-6a08303306214140657548/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">.父节点类{
  position:relative;
}

.子节点类{
  position:absolute;
  left:4px;
  right: 4px;
  top:36px;
  z-index:10;
｝</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=946</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
