﻿<?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; 二次开发</title>
	<atom:link href="https://www.softwareace.cn/?cat=91&#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>设置默认程序  MAPI Thunderbird</title>
		<link>https://www.softwareace.cn/?p=1349</link>
		<comments>https://www.softwareace.cn/?p=1349#comments</comments>
		<pubDate>Wed, 10 Jun 2015 11:13:30 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1349</guid>
		<description><![CDATA[HKEY_CURRENT_USER\Software\Clients\Mail 根据这个值 找MAPI的默认关 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>HKEY_CURRENT_USER\Software\Clients\Mail<br />
根据这个值 找MAPI的默认关联<br />
从<br />
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail<br />
里面找到对应项<br />
然后通过<br />
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird<br />
DLLPath 中的 mozMapi32_InUse.dll 找到 注册的{29F458BE-8866-11D5-A3DD-00B0D0F3BAA7} 主程序，运行 LocalServer32</p>
<p>主程序 thunderbird.exe&#8221; /MAPIStartup<br />
获取 HKEY_CLASSES_ROOT\CLSID\{6EDCD38E-8861-11D5-A3DD-00B0D0F3BAA7}<br />
D:\Program Files\Mozilla Thunderbird\MapiProxy_InUse.dll<br />
注册</p>
<p>MapiProxy_InUse.dll 从系统MAPI 中获取信息 返回主程序</p>
<p>测试代码</p><pre class="crayon-plain-tag">#include "stdafx.h"
#include &lt;Windows.h&gt;
//#define NEW_TEST

#ifdef NEW_TEST
const CLSID CLSID_CMapiImp = {0xa57e1ac6, 0x1c0e, 0x400c,
                               {0x83, 0x7, 0x37, 0x32, 0xfb, 0x28, 0x78, 0x39}};
const IID IID_nsIMapi = {0x713b7751, 0xff23, 0x4b9d,
                        {0xac, 0x34, 0xcc, 0x29, 0x44, 0x6, 0x4, 0x85}};
#else
const CLSID CLSID_CMapiImp = {0x29f458be, 0x8866, 0x11d5,
                              {0xa3, 0xdd, 0x0, 0xb0, 0xd0, 0xf3, 0xba, 0xa7}};
const IID IID_nsIMapi = {0x6EDCD38E,0x8861,0x11d5,
                        {0xA3,0xDD,0x00,0xB0,0xD0,0xF3,0xBA,0xA7}};
#endif

int _tmain(int argc, _TCHAR* argv[])
{
	IDispatch* pDispatch;
	HRESULT hRes = ::CoInitialize(NULL) ;

    hRes = ::CoCreateInstance(CLSID_CMapiImp, NULL, CLSCTX_LOCAL_SERVER,
                                         IID_nsIMapi, (void **)&amp;pDispatch);
	if (hRes != S_OK)
	{
		MessageBox(NULL,L"哎呦进来了",L"Come on baby",MB_OK);
		DWORD error = GetLastError();
	}
	return 0;
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1349</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>修改 thundbird 签名</title>
		<link>https://www.softwareace.cn/?p=1323</link>
		<comments>https://www.softwareace.cn/?p=1323#comments</comments>
		<pubDate>Tue, 12 May 2015 08:02:42 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1323</guid>
		<description><![CDATA[thundbird 签名分为 html 和非 html 1.修改非html 需要修改源代码，重新编译 mail [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>thundbird 签名分为 html 和非 html</p>
<p>1.修改非html</p>
<p>需要修改源代码，重新编译</p>
<p>mailnews\compose\src\nsMsgCompose.cpp</p>
<p>line 4247</p><pre class="crayon-plain-tag">static const char      htmlBreak[] = "&lt;br&gt;";
  static const char      dashes[] = "-- ";
  static const char      htmlsigopen[] = "&lt;div class=\"moz-signature\"&gt;";
  static const char      htmlsigclose[] = "&lt;/div&gt;";    /* XXX: Due to a bug in
                             4.x' HTML editor, it will not be able to
                             break this HTML sig, if quoted (for the user to
                             interleave a comment). */
  static const char      _preopen[] = "&lt;pre class=\"moz-signature\" cols=%d&gt;";
  char*                  preopen;
  static const char      preclose[] = "&lt;/pre&gt;";

  int32_t wrapLength = 72; // setup default value in case GetWrapLength failed
  GetWrapLength(&amp;wrapLength);
  preopen = PR_smprintf(_preopen, wrapLength);
  if (!preopen)
    return NS_ERROR_OUT_OF_MEMORY;</pre><p>2. html</p>
<p>直接修改设置。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1323</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make a Thunderbird Add-on compatible with Postbox</title>
		<link>https://www.softwareace.cn/?p=898</link>
		<comments>https://www.softwareace.cn/?p=898#comments</comments>
		<pubDate>Mon, 11 Aug 2014 01:27:03 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[xul]]></category>
		<category><![CDATA[二次开发]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=898</guid>
		<description><![CDATA[Back in my Windows times I used to use Postbox email cl [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Back in my Windows times I used to use Postbox email client which by far had the best Gmail support. One of the minor obstacles, however, was the fact that not every Thunderbird Add-ons was also available for Postbox since it differs slightly from the former. Therefore Add-ons have to be adapted before they could be used in Postbox.</p>
<p>Many especially smaller Add-ons can be easily adapted by oneself and checked for any compatibility problems.</p>
<p>The following guide briefly explains how to do it.</p>
<ol>
<li>Get the Thunderbird Add-on that you want to adopt to Postbox. Normally it should be a Zip-Archive with the file extension <code>.xpi</code>.</li>
<li>Rename the xpi file to a zip file and extract the Add-on.</li>
<li>Go into the new extracted folder and edit the file <code>install.rdf</code>. Look for the target application tag for Thunderbird which should look similar to the following:<br />
<pre class="crayon-plain-tag">&lt;!-- Thunderbird --&gt;
  &lt;em:targetApplication&gt;
    &lt;Description&gt;
        &lt;em:id&gt;{3550f703-e582-4d05-9a08-453d09bdfdc6}&lt;/em:id&gt;
        &lt;em:minVersion&gt;1.0&lt;/em:minVersion&gt;
        &lt;em:maxVersion&gt;5.*&lt;/em:maxVersion&gt;
    &lt;/Description&gt;
  &lt;/em:targetApplication&gt;</pre><br />
&nbsp;</p>
<div></div>
</li>
<li>After this please add the following target application tag for Postbox.<br />
<pre class="crayon-plain-tag">&lt;!-- Postbox --&gt;
  &lt;em:targetApplication&gt;
    &lt;Description&gt;
        &lt;em:id&gt;postbox@postbox-inc.com&lt;/em:id&gt;
        &lt;em:minVersion&gt;2.0b1&lt;/em:minVersion&gt;
        &lt;em:maxVersion&gt;3.*&lt;/em:maxVersion&gt;
    &lt;/Description&gt;
  &lt;/em:targetApplication&gt;</pre></p>
<div></div>
</li>
</ol>
<p>Now save the file and add all files to a new zip archive. Then change the file extension of the archive back to <code>.xpi</code> instead of <code>.zip</code>. You should be done. Try to install the Add-on in Postbox now.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=898</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>基于.net开发chrome核心浏览器</title>
		<link>https://www.softwareace.cn/?p=838</link>
		<comments>https://www.softwareace.cn/?p=838#comments</comments>
		<pubDate>Wed, 25 Jun 2014 06:00:58 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[cef]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=838</guid>
		<description><![CDATA[本篇我们讲解怎么用CefGlue开发一个最简单的浏览器 一： CefGlue是建立在Cef项目之上的， Cef [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>本篇我们讲解怎么用CefGlue开发一个最简单的浏览器</p>
<p><strong>一：</strong></p>
<p>CefGlue是建立在Cef项目之上的，<br />
Cef项目是C/C++的项目；<br />
CefGlue只不过是通过PInvoke来访问Cef项目生成的一些dll<br />
下面我们来看看Cef项目生成的一些dll和资源都是做什么用的<br />
打开这个目录\cef_binary_3.1453.1236_windows_xilium\Release<br />
libcef.dll&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&gt;Cef的核心类库<br />
icudt.dll&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&gt;支持unicode的类库<br />
ffmpegsumo.dll&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;支持音频和视频的类库<br />
d3dcompiler_43.dll&#8212;&#8212;&#8212;&#8212;&#8212;&gt;WinXP下支持3D的类库<br />
d3dcompiler_46.dll&#8212;&#8212;&#8212;&#8212;&#8212;&gt;Win7和之后的Win支持3D的类库<br />
libEGL.dll&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&gt;用于支持3D<br />
libGLESv2.dll&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;用于支持3D</p>
<p>打开目录：\cef_binary_3.1453.1236_windows_xilium\Resources<br />
locales&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;此文件夹存放了各种国家的语言资源<br />
cef.pak&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&gt;为WebKit相关的资源（谷歌浏览器的核心是webkit）<br />
devtools_resources.pak&#8212;&#8212;&#8212;&gt;调试器的相关资源（我们做的项目是可以使用谷歌浏览器的调试器的）</p>
<p><strong>二：</strong></p>
<p>建立一个winform工程，取名加CefDemo<br />
在程序集中创建一个文件夹取名dll<br />
在程序集的属性里设置此程序集的预先生成事件的命令</p>
<div>
<pre class="crayon-plain-tag">xcopy $(ProjectDir)dll $(TargetDir) /e /i /y</pre>
</div>
<p>这个命令的目的是：每次编译的时候把dll文件夹中的文件拷贝的输出目录中</p>
<p>把\cef_binary_3.1453.1236_windows_xilium\Release此目录下的所有文件都拷贝到CefDemo的dll目录中去<br />
把\cef_binary_3.1453.1236_windows_xilium\Resources此目录下的所有文件和文件夹拷贝到dll目录中去<br />
<strong>注意：</strong>locales子目录下的文件大部分都没有用，你可以把所有的文件都删掉，只留下zh-CN.pak文件。<br />
打开Xilium.CefGlue工程，release编译CefGlue程序集，把生成的Xilium.CefGlue.dll也拷贝到CefDemo的dll目录中去<br />
在CefDemo项目中添加Xilium.CefGlue.dll的引用</p>
<p><strong>三：</strong></p>
<p>修改Program.cs的代码：</p>
<div>
<div><a title="复制代码"><img alt="复制代码" src="http://common.cnblogs.com/images/copycode.gif" /></a></div>
<p></p><pre class="crayon-plain-tag">static void Main()
        {
            CefRuntime.Load();
            var mainArgs = new CefMainArgs(new string[] { });
            var exitCode = CefRuntime.ExecuteProcess(mainArgs, null);
            if (exitCode != -1)
                return;
            var settings = new CefSettings
            {
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Disable,
                Locale = &quot;zh-CN&quot;
            };
            CefRuntime.Initialize(mainArgs, settings, null);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!settings.MultiThreadedMessageLoop)
            {
                Application.Idle += (sender, e) =&amp;gt; { CefRuntime.DoMessageLoopWork(); };
            }
            Application.Run(new CefBrowser());
            CefRuntime.Shutdown();
        }</pre><p></p>
<div><a title="复制代码"><img alt="复制代码" src="http://common.cnblogs.com/images/copycode.gif" /></a></div>
</div>
<p>我们来一点一点解释这些代码：</p>
<p>CefRuntime.Load();<br />
此行代码用于加载CEF的运行时<br />
————————————————————————<br />
var mainArgs = new CefMainArgs(new string[] { });<br />
此行代码可以收集命令行参数，用于传递给CEF浏览器<br />
————————————————————————<br />
var exitCode = CefRuntime.ExecuteProcess(mainArgs, null);<br />
if (exitCode != -1)<br />
return;<br />
以上代码用于启动第二个进程，至于用第二个进程做什么，我没有深入研究过（可以是浏览器的第二个进程、也可以是一个可执行文件的）<br />
<strong>注意：</strong>CefRuntime.ExecuteProcess方法必须在程序的入口处调用；<br />
——————————————————————————<br />
var settings = new CefSettings<br />
{<br />
SingleProcess = false,<br />
MultiThreadedMessageLoop = true,<br />
LogSeverity = CefLogSeverity.Disable,<br />
Locale = &#8220;zh-CN&#8221;<br />
};<br />
CEF的配置参数，有很多参数，我们这里挑几个解释一下：<br />
SingleProcess = false：此处目的是使用多进程。<br />
<strong>注意：</strong>强烈不建议使用单进程，单进程不稳定，而且Chromium内核不支持<br />
MultiThreadedMessageLoop = true：此处的目的是让浏览器的消息循环在一个单独的线程中执行<br />
<strong>注意：</strong>强烈建议设置成true,要不然你得在你的程序中自己处理消息循环；自己调用CefDoMessageLoopWork()<br />
Locale = &#8220;zh-CN&#8221;：webkit用到的语言资源，如果不设置，默认将为en-US<br />
<strong>注意：</strong>可执行文件所在的目录一定要有locals目录，而且这个目录下要有相应的资源文件<br />
——————————————————————————————<br />
CefRuntime.Initialize(mainArgs, settings, null);<br />
这句代码把创建的配置信息和命令行信息传递个cef的运行时<br />
此函数必须在应用程序的主线程中调用<br />
——————————————————————————————<br />
if (!settings.MultiThreadedMessageLoop)<br />
{<br />
Application.Idle += (sender, e) =&gt; { CefRuntime.DoMessageLoopWork(); };<br />
}<br />
如果你在前面设置的MultiThreadedMessageLoop为false，<br />
那么你可以加入如上代码，自行调用CefRuntime.DoMessageLoopWork();<br />
——————————————————————————————<br />
CefRuntime.Shutdown();<br />
主进程结束时，要释放CEF的资源，并结束浏览器的进程。</p>
<p><strong>四：</strong></p>
<p>在工程中创建一个窗体，<br />
在设计视图中，把窗口调整到合适的大小<br />
（你想让浏览器变成多大，就调整到多大）<br />
然后我们调整一下这个窗体的一些属性</p>
<div>
<pre class="crayon-plain-tag">this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = &quot;CefBrowser&quot;;
            this.Text = &quot;最简单的实现&quot;;</pre>
</div>
<p>在这篇文章提供的例子，还没有实现浏览器随着容器窗体的大小变化而变化<br />
所以：我们在这里禁用了窗口的最大化功能，也禁用了拖动改变窗口大小的功能。</p>
<p><strong>五：</strong></p>
<p>在窗口的构造函数中加入如下代码：</p>
<div>
<pre class="crayon-plain-tag">var cwi = CefWindowInfo.Create();
cwi.SetAsChild(this.Handle, new CefRectangle(0, 0, this.Width, this.Height));
var bc = new BrowserClient();
var bs = new CefBrowserSettings() { };
CefBrowserHost.CreateBrowser(cwi,bc, bs,&quot;http://www.cnblogs.com/liulun&quot;);</pre>
</div>
<p>然后运行程序，你就看到了一个浏览器，如下图：<br />
<img alt="" src="http://images.cnitblog.com/blog/28932/201305/11123818-f6e3ee63473f48b5b9851c32615d781b.png" /><br />
虽然没有滚动条，窗口也不能拖动改变大小<br />
但是当你把鼠标移动到网页上之后，滚动鼠标滚轮，网页还是会跟着滚动的。</p>
<p><strong>六：</strong></p>
<p>下面我们来详细解释一下上面几句代码的意义</p>
<p>CefWindowInfo是CEF浏览器窗口实现的类，其中包含了在windows、linux、MAC下的具体实现<br />
此类中的Create静态方法负责创建这个类的实例，<br />
我在windows下执行这一句，将得到windows下CEF浏览器的实现方式<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
cwi.SetAsChild(this.Handle, new CefRectangle(0, 0, this.Width, this.Height));<br />
此行代码负责把创建的CEF浏览器窗口与我们创建的winform窗口结合起来<br />
this.Handle就是我们创建的winform窗口的句柄<br />
SetAsChild函数使CEF浏览器窗口作为winform窗口的子窗口呈现<br />
CefRectangle标志着CEF浏览器窗口将出现在父窗口中的位置和大小<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
var bc = new BrowserClient();<br />
BrowserClient是我在工程中新建的一个类<br />
这个类没有任何逻辑和属性，只是继承了CefClient类<br />
CefClient类有很多虚方法以供重写，<br />
比如GetDisplayHandler、GetDownloadHandler、GetJSDialogHandler等等<br />
<strong>注意：</strong>此类很重要，我们将在接下来的章节中为这个类添加很多内容<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
var bs = new CefBrowserSettings() { };<br />
之前我们在Program中设置的是CefSettings<br />
那是针对CEF环境的一些全局设置<br />
这里是CefBrowserSettings<br />
这是针对CEF浏览器环境的一些全局设置<br />
可以在这里配置的参数有很多<br />
比如：<br />
DefaultEncoding（用于所有网页内容的编码方式，默认为ISO-8859-1）<br />
UserStyleSheetLocation（用于所有网页的样式，应该按照这样的格式设置这个字段：data:text/css;charset=utf-8;base64,[csscontent]）<br />
RemoteFonts（用于所有网页的字体）<br />
JavaScript（用于所有网页是否可以执行JS脚本）<br />
JavaScriptOpenWindows（用于所有网页是否可以通过JS来打开窗口）<br />
（还有很多类似的设置，读者可以自己去研究）<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
CefBrowserHost.CreateBrowser(cwi,bc, bs,&#8221;http://www.cnblogs.com/liulun&#8221;);<br />
代码执行到这一行即开始创建浏览器子窗口<br />
CreateBrowser前面三个参数不用多说了<br />
最后一个参数就是你想让浏览器访问的页面<br />
<strong>注意：</strong>这个方法是异步执行的（非阻塞的），也就是说你无法知道什么时候窗口被创建出来，（通过其他方式可以注册窗口创建成功的事件，以后再讲。）</p>
<p><strong>源码下载：</strong></p>
<p>http://files.cnblogs.com/liulun/CefDemo.zip</p>
<p>注意：为了下载方便，我已经去掉了dll文件夹中的资源和需要引用的类库</p>
<p><strong>修改记录：</strong><br />
2013-4-22：创建文章，并完成了一部分内容<br />
2013-4-29：添加了文章的一部分内容，碰到问题停滞不前。<br />
2013-5-02：解决掉问题，更新并添加了大部分内容，修改了文章的排版<br />
2013-5-11：增加了最后一部分内容，修改了排版，通读文章，纠正错别字</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=838</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让CEF支持FLASH(非安装插件的形式)</title>
		<link>https://www.softwareace.cn/?p=837</link>
		<comments>https://www.softwareace.cn/?p=837#comments</comments>
		<pubDate>Wed, 25 Jun 2014 05:43:32 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[cef]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=837</guid>
		<description><![CDATA[测试环境: CEF3 + CefGlue 下载FLASH的NPAPI DLL文件 , 在CEF目录下新建文件夹 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>测试环境:</p>
<p>CEF3 + CefGlue</p>
<p>下载FLASH的NPAPI DLL文件 ,</p>
<p>在CEF目录下新建文件夹plugins,然后把DLL文件放进去即可.</p>
<p><img alt="" src="http://images.cnitblog.com/blog/515842/201311/05094417-16236ebc379d4ff3b1967f770e30ac87.png" /></p>
<p>&nbsp;</p>
<p>据说下面是PPAPI的方式,未测试</p>
<p>&nbsp;</p>
<div>启动的时候加个命令行</div>
<div>
<div>&#8220;E:\XiliumCefGlueDemo\Bin\Xilium.CefGlue.Demo.WinForms.exe&#8221; &#8211;ppapi-out-of-process &#8211;register-pepper-plugins=&#8221;E:\XiliumCefGlueDemo\Bin\PepperFlash\pepflashplayer.dll;application/x-shockwave-flash&#8221;</div>
</div>
<div>后边的值要自己改  application/x-ppapi也要改成对应的</div>
<div>如果是在程序中注册 前面的程序路径就不需要，把后面的放在Main函数的Args里  是数组 多个就放多个</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=837</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a C++ XPCOM Component in Windows</title>
		<link>https://www.softwareace.cn/?p=832</link>
		<comments>https://www.softwareace.cn/?p=832#comments</comments>
		<pubDate>Fri, 20 Jun 2014 07:36:17 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=832</guid>
		<description><![CDATA[http://briankrausz.com/building-a-c-xpcom-component-in  [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>http://briankrausz.com/building-a-c-xpcom-component-in</p>
<p>-windows/Jason was kind enough to translate this post to Belorussian.</p>
<p>I’ve been teaching myself to write Firefox extensions for the last few weeks, and became interested in XPCOM components. Unfortunately, I couldn’t find a good (and recent) summary of them, and had to spend 3 or 4 days cobbling together various tutorials, so I figured it’s time to write one.</p>
<p>What is XPCOM?<br />
XPCOM is a language-agnostic communication platform used in Mozilla products (and some other random pieces of software) to allow code (specifically extensions) to be written in a wide variety of languages.</p>
<p>Why would I want to use XPCOM?<br />
There are two ways to “use” XPCOM. First, you can call functions through XPCOM. For example, the Firefox bookmarks service uses an XPCOM interface. So in order to interact with this service from Javascript you would do something like:</p>
<p>var bmarks = Components.classes["@mozilla.org/browser/bookmarks-service;1"].getService();<br />
bmarks.QueryInterface(Components.interfaces.nsIBookmarksService);<br />
bmarks.addBookmarkImmediately(&#8220;http://www.mozilla.org&#8221;,&#8221;Mozilla&#8221;,0,null);<br />
There are plenty of tutorials on doing this as it is the more common use for XPCOM, so I won’t go into any detail on it here.</p>
<p>The second way is to write an XPCOM service. That is what this tutorial covers. Sometimes you need extra functionality, speed, or just want to tie into some library that requires a different language. Most commonly this is C++, but there is also JavaXPCOM and PyXPCOM (and probably a few others). I’ll be talking about C++, since it’s what I needed for my project.</p>
<p>Warnings<br />
Before you trudge through this: you most likely are in the wrong place. Firefox extensions are usually all Javascript. If you can use JS to do what you want, stop now. There is no need to go through the complexity of an XPCOM component when you can just use JS. Go read a tutorial about writing extensions and get to work.<br />
There is something called ctypes coming to FF 3.7 that may make doing this a lot easier. I haven’t touched this at all, but it may be worth considering if you can wait for the functionality and only need to tie into a particular DLL for some functionality. Long story short, XPCOM may become the more difficult way to call C++ functions from FF extensions.<br />
My Setup<br />
Windows 7<br />
Visual C++ Express 2008 (free from Microsoft’s website)<br />
Firefox 3.6 (Gecko 1.9.2)<br />
A UUID or GUID generator. This is a unique (read: random) ID that identifies your app to the world. Windows and Linux have tools to generate this (guidgen &#038; uuidgen, respectively), or you can find various online generators (Mozilla links to several). I recommend this one since it gives you the C++ encoded form too, which you will need. You need two different UUIDs: one for your interface and one for your component.<br />
Ability to read and understand C++<br />
Sample Code<br />
If you don’t want to go through the tutorial and just want everything to work, then download this sample code. Just follow step #1 of the tutorial, then make sure your Gecko SDK directory is set right in the build step, and you can breeze on by most of this article.</p>
<p>The Tutorial<br />
This is mostly paraphrased from Alex Sirota’s great tutorial, but it hasn’t been updated since 2005 and is a bit outdated. This new one should work out of the box for FF 3.6.</p>
<p>This tutorial will create a component called MyComponent with one function: Add, which will take 2 numbers and, surprisingly, return the sum.</p>
<p>Download the Gecko SDK for your version of Firefox. I used 1.9.2 for FF 3.6.<br />
Create an idl file – IMyComponent.idl, with the following (replacing ***IUID*** with your interface UUID):<br />
#include &#8220;nsISupports.idl&#8221;</p>
<p>[scriptable, uuid(***IUID***)]<br />
interface IMyComponent : nsISupports<br />
{<br />
  long Add(in long a, in long b);<br />
};<br />
This file is a language-agnostic interface definition which you can read more about here.</p>
<p>Generate the interface header and typelib files out of the interface definition file. Assuming you extracted the Gecko SDK to C:\xulrunner-sdk\, run the following commands (from the directory you saved IMyComponent.idl to):<br />
C:\xulrunner-sdk\sdk\bin\xpidl.exe -m header -I C:\xulrunner-sdk\idl .\IMyComponent.idl<br />
C:\xulrunner-sdk\sdk\bin\xpidl.exe -m typelib -I C:\xulrunner-sdk\idl .\IMyComponent.idl<br />
These will create IMyComponent.h and IMyComponent.xpt, respectively.</p>
<p>IMyComponent.h has two snippits of code that you can use for the next two files. Everything between /* Header file */ and /* Implementation file */ can be used for MyComponent.h:<br />
Start by inserting double inclusion protection code and the right include:<br />
#ifndef _MY_COMPONENT_H_<br />
#define _MY_COMPONENT_H_</p>
<p>#include &#8220;IMyComponent.h&#8221;<br />
Add the following lines, which define your component name, contract ID, and CUID (where ***CUID*** is the C++-style component UUID, of the form { 0×12345678, 0x9abc, 0xdef0, { 0×12, 0×34, 0×56, 0×78, 0x9a, 0xbc, 0xde, 0xf0 } }):<br />
#define MY_COMPONENT_CONTRACTID &#8220;@example.com/XPCOMSample/MyComponent;1&#8243;<br />
#define MY_COMPONENT_CLASSNAME &#8220;A Simple XPCOM Sample&#8221;<br />
#define MY_COMPONENT_CID ***CUID***<br />
Copy in the snippet from IMyComponent.h, replacing all the instances of _MYCLASS_ with the name of your component (MyComponent).<br />
Finish off the double inclusion protection code with #endif //_MY_COMPONENT_H_<br />
Everything between /* Implementation file */ and /* End of implementation class template. */ can be used for MyComponent.cpp:<br />
Start by inserting the right include:<br />
#include &#8220;MyComponent.h&#8221;<br />
Copy in the snippet from IMyComponent.h, replacing all the instances of _MYCLASS_ with the name of your component (MyComponent).<br />
Add some implementation to the Add method. I replaced return NS_ERROR_NOT_IMPLEMENTED; with<br />
	*_retval = a + b;<br />
return NS_OK;<br />
Create your module definitions files:<br />
#include &#8220;nsIGenericFactory.h&#8221;<br />
#include &#8220;MyComponent.h&#8221;</p>
<p>NS_GENERIC_FACTORY_CONSTRUCTOR(MyComponent)</p>
<p>static nsModuleComponentInfo components[] =<br />
{<br />
    {<br />
       MY_COMPONENT_CLASSNAME,<br />
       MY_COMPONENT_CID,<br />
       MY_COMPONENT_CONTRACTID,<br />
       MyComponentConstructor,<br />
    }<br />
};</p>
<p>NS_IMPL_NSGETMODULE(&#8220;MyComponentsModule&#8221;, components)<br />
You now have all of the files needed to build an XPCOM component:</p>
<p>IMyComponent.h<br />
IMyComponent.idl<br />
IMyComponent.xpt<br />
MyComponent.cpp<br />
MyComponent.h<br />
MyComponentModule.cpp<br />
Now comes the hard part: getting the damn thing to build.</p>
<p>Building the code<br />
Ok, it’s actually not hard since I’ve done most of the legwork for you. Assuming you’re using Visual C++ 2008 here are the settings you need (again assuming C:\xulrunner-sdk is where your Gecko SDK is). In Project->Properties:</p>
<p>Configuration Properties<br />
  General<br />
    Configuration Type: .dll<br />
  C/C++<br />
    General<br />
      Additional Include Directories: C:\xulrunner-sdk\include<br />
    Preprocessor<br />
      Preprocessor Definitions: XP_WIN;XP_WIN32;XPCOM_GLUE_USE_NSPR<br />
  Linker<br />
    General<br />
      Additional Library Directories: C:\xulrunner-sdk\lib<br />
    Input<br />
      Additional Dependencies: nspr4.lib xpcom.lib xpcomglue_s.lib<br />
If you put the idl file into your project, be sure to mark it “Excluded from Build” in its properties…we don’t want VS touching it.</p>
<p>Cross your fingers, pray to whatever deity you believe in, and hit the build button. If it didn’t work let me know why in the comments and I’ll try to build a troubleshooting section.</p>
<p>Installing/Testing the Code<br />
Copy two files to C:\Program Files\Mozilla Firefox\components:<br />
The DLL the build generated<br />
IMyComponent.xpt<br />
Normally, if this was installed as part of an extension, it would automatically search this directory and find these files. But now we have to force a refresh. Delete xpti.dat. and compreg.dat from your profile directory (FF will regenerate them on next restart)<br />
Close Firefox and open it with this test file (MyComponentTest.html in the sample code):<br />
<html><br />
<script type="text/javascript">
function MyComponentTestGo() {
	try {
		// normally Firefox extensions implicitly have XPCOM privileges, but since this is a file we have to request it.
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		const cid = "@example.com/XPCOMSample/MyComponent;1";
		obj = Components.classes[cid].createInstance();
		// bind the instance we just created to our interface
		obj = obj.QueryInterface(Components.interfaces.IMyComponent);
	} catch (err) {
		alert(err);
		return;
	}
	var res = obj.Add(3, 4);
	alert('Performing 3+4. Returned ' + res + '.');
}
</script><br />
<body><br />
<button onclick="MyComponentTestGo();">Go</button><br />
</body><br />
</html><br />
One last time: cross your fingers, pray to whatever deity you believe in, and hit the Go button. If it didn’t work let me know why in the comments and I’ll try to build a troubleshooting section.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=832</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Davmail+ThunderBird 连接MS Exchange Server</title>
		<link>https://www.softwareace.cn/?p=831</link>
		<comments>https://www.softwareace.cn/?p=831#comments</comments>
		<pubDate>Fri, 20 Jun 2014 07:27:15 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=831</guid>
		<description><![CDATA[为了方便，来公司之后直接安装了Ubuntu10.04的64bit版本，但是在连接公司的exchange邮箱的时 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>为了方便，来公司之后直接安装了Ubuntu10.04的64bit版本，但是在连接公司的exchange邮箱的时候前短时间一直使用web access，速度慢，ckeck邮件也不方便，所以查阅了很多资料，综合很多朋友的意见，准备试一下 Davmail ＋ ThunderBird 试一下。</p>
<p>之所以选用以上的组合，给予下面的survey and test.<br />
（1）Ubuntu 原装版本的Evolution. 还算好用，不过配置后，会出现这个错误：<br />
引用<br />
The Exchange server is not compatible with Exchange Connector.</p>
<p>The server is running Exchange 5.5. Exchange Connector<br />
supports Microsoft Exchange 2000 and 2003 only.</p>
<p>无奈，不能使用他，我的gmail都是设置在这里的，无奈，试试其他的。</p>
<p>（2）kmail.  实验后，结论和evolution是一样的，没办法使用他连接exchage。</p>
<p>（3）ThunderBird  同上。</p>
<p>ThunberBird ＋ Davmail </p>
<p>First, Davmail is a gateway software for other mail-clients. more info see: http://davmail.sourceforge.net/index.html<br />
Download from  http://davmail.sourceforge.net/download.html, I choose the davmail_version-1_all.deb. You can choose one which is suitable for yourself.</p>
<p>Second, Install Davmail step by step.<br />
see http://davmail.sourceforge.net/linuxsetup.html<br />
do some settings:</p>
<p>OWA URL: https://red001.mail.microsoftonline.com/owa/</p>
<p>After that, I recommend turning on the following:</p>
<p>Local IMAP Port: 1143<br />
Local SMTP Port: 1025<br />
Local LDAP Port: 1389</p>
<p>You should just turn off the POP support.</p>
<p>-> save and close the window.</p>
<p>Third, install the ThunderBird.<br />
Java代码  收藏代码<br />
aptitude thunderbird<br />
install automaticly.</p>
<p>then, create an account like this:<br />
引用</p>
<p>name: ***<br />
email address: ***@**<br />
password: ***</p>
<p>引用</p>
<p>server setting:<br />
sever name: localhost<br />
IMAP port:1143<br />
user name: ***@** (this is your email account.)</p>
<p>引用</p>
<p>Outgoing server<br />
description: whatever<br />
server name: localhost<br />
SMTP port 1025<br />
username and password :  ***@**  (this is your email account)<br />
do not select &#8216;use secure authentication&#8217;</p>
<p>okay.<br />
Now, you can try it.<br />
Good luck!</p>
<p>http://blog.csdn.net/tody_guo/article/details/7926381</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=831</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Thunderbird using Firefox Developer Tools</title>
		<link>https://www.softwareace.cn/?p=830</link>
		<comments>https://www.softwareace.cn/?p=830#comments</comments>
		<pubDate>Fri, 20 Jun 2014 07:16:49 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=830</guid>
		<description><![CDATA[http://flailingmonkey.com/debugging-thunderbird-using-f [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>http://flailingmonkey.com/debugging-thunderbird-using-firefox-developer-tools</p>
<p>I recently discovered that it is possible to use Firefox Developer Tools with Thunderbird. Philipp Kewisch has done a fantastic job of his Google Summer of Code 2013 Project to bring Firefox Developer Tools to Thunderbird.</p>
<p>Starting with Thunderbird 24.0a1 and a matching version of Firefox, it is possible to debug Thunderbird code using Firefox Developer Tools. If your version of Thunderbird is 14.x then please go to &#8220;Help&#8221; > &#8220;About Thunderbird&#8221; and allow it to update.</p>
<p>For best results you should use the latest nightly versions of both Thunderbird and Firefox. At the very least the version numbers should match. Here is how to get things up and running using the latest nightlies:</p>
<p>Download the latest Thunderbird Nightly.<br />
Start Thunderbird.<br />
Select &#8220;Tools&#8221; > &#8220;Allow Remote Debugging.&#8221;<br />
Thunderbird > Allow remote debugging<br />
&#8220;Thunderbird&#8221; > &#8220;Allow remote debugging&#8221;<br />
Download the same version of Firefox Nightly as you did Thunderbird.<br />
Start Firefox.<br />
Press Ctrl > Shift > K to open the toolbox.<br />
Click the gear icon to open the developer tools options panel.<br />
Check &#8220;Enable Chrome Debugging&#8221; and &#8220;Enable Remote Debugging&#8221; then click &#8220;Restart Now&#8221; if it appears.<br />
Enable Chrome Debugging and Enable Remote Debugging options<br />
Enable Chrome Debugging and Enable Remote Debugging options<br />
Select &#8220;Web Developer&#8221; > &#8220;Connect…&#8221;<br />
Choose localhost port 6000 and click &#8220;Connect.&#8221;<br />
You will be presented with a set of available remote tabs and processes. For me they appeared as follows:</p>
<p>Available remote tabs and processes<br />
Available remote tabs and processes<br />
&#8220;Your Kobo Order Receipt&#8221; &#8211; the area in which the selected email is displayed. In this view the following did / did not work:<br />
The console tab may work but was empty when I tested.<br />
The inspector, debugger, style editor and profiler work just fine.<br />
The network tab was empty.<br />
&#8220;Message Summary&#8221; is the area in which email summaries are displayed when multiple messages are selected.<br />
The console tab may work but was empty when I tested.<br />
The inspector, debugger, style editor and profiler work just fine.<br />
The network tab was empty.<br />
&#8220;Main Process&#8221; &#8211; the main Thunderbird process. In this view the following did / did not work:<br />
The console, debugger and profiler work fine.<br />
The inspector and style editor and network tabs were empty.<br />
Although not all of the tools work perfectly in all contexts at least you can now use the DevTools for extension development and to fix bugs.</p>
<p>Philipp says that the same code packaged as an extension could be used to enable the debug server from other XUL apps but it doesn&#8217;t look like he has uploaded the extension yet.</p>
<p>Something has been needed since Venkman development halted so now we have something there is no excuse, whether it is Thunderbird itself or an extension &#8230; go, get hacking!</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=830</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging XULRunner applications</title>
		<link>https://www.softwareace.cn/?p=829</link>
		<comments>https://www.softwareace.cn/?p=829#comments</comments>
		<pubDate>Fri, 20 Jun 2014 07:14:44 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[二次开发]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=829</guid>
		<description><![CDATA[https://developer.mozilla.org/en-US/docs/Mozilla/Projec [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner/Debugging_XULRunner_applications</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=829</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CEF1和CEF3两个版本的区别</title>
		<link>https://www.softwareace.cn/?p=825</link>
		<comments>https://www.softwareace.cn/?p=825#comments</comments>
		<pubDate>Wed, 18 Jun 2014 01:02:55 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[二次开发]]></category>
		<category><![CDATA[cef]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=825</guid>
		<description><![CDATA[早在content API出现之前，CEF便已出现，其目的是提供嵌入式的框架，可以让渲染网页的功能方便地嵌入到 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>早在content API出现之前，CEF便已出现，其目的是提供嵌入式的框架，可以让渲染网页的功能方便地嵌入到应用程序之中。CEF依赖于chromium浏览器，所以chromium对HTML5的支持和性能上的优势，都得以继续在CEF中体现出来。但是，根据实际测试的结果来看，情况可能并非如此。首先，其对GPU硬件加速的支持不是很好，这时因为它会把GPU内存读回到CPU内存，速度非常慢；再次，因为基于chromium的内部结构，而它们经常变化，所以CEF经常需要发生变化，这对维护来说是件很头痛的事。<br />
得益于content API的出现，CEF的作者也基于它开发了CEF3。CEF3在保持其提供的接口基本不变的情况下，借助content API的能力，其对HTML5和GPU硬件加速提供了较好的支持。它的核心变为调用content API的接口和实现content API的回调接口，来组织和包装成CEF3自己的接口以被其他开发者所使用。其好处是，CEF3的接口相对比较简单，使用起来方便，同时不需要实现很多content API的回调接口，但是缺点就是，如果需要使用content API的很多功能，CEF3的接口可能做不到，或者说只能通过直接调用content API接口来完成。<br />
下面简单介绍一下CEF3的接口。<br />
CefClient：回调管理类，包含5个接口用于创建其它的回调类的对象<br />
CefLifeSpanHandler: 回调类，用于控制popup对话框的创建和关闭等操作<br />
CefLoadHandler: 回调类，可以用来监听frame的加载开始，完成，错误等信息<br />
CefRequestHandler: 回调类，用于监听资源加载，重定向等信息<br />
CefDisplayHandler: 回调类，用于监听页面加载状态，地址变化，标题等得信息<br />
CefGeolocationHandler: 回调类，用于CEF3向嵌入者申请geolocation的权限<br />
CefApp: 与进程，命令行参数，代理，资源管理相关的回调类，用于让CEF3的调用者们定制自己的逻辑<br />
CefBrowser: renderer进程中执行浏览相关的类，例如前进，后退等<br />
CefBrowserHost: browser进程中的执行浏览相关的类，其会把请求发送给CefBrowser<br />
CefFrame: 表示的是页面中的一个Frame，可以加载特定url，在该运行环境下执行JavaScript代码等得。<br />
V8：CEF3提供支持V8extension的接口，但是这有两个限制，第一，v8 extension仅在Renderer进程使用；第二，仅在沙箱模型关闭时使用。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=825</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
