<?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"
	>

<channel>
	<title>恶猫的博客</title>
	<atom:link href="http://www.apc001.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.apc001.com</link>
	<description>恶猫的传奇旅程,再次开始.....(上次是什么时候来着....不管了) 来的朋友留个脚印吧,常来看看! 　　　　My love is warmer than a smile! Let our love shine throughout the world!</description>
	<pubDate>Tue, 11 Nov 2008 13:47:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>在C#中使用热键隐含窗口</title>
		<link>http://www.apc001.com/2008-11/258/%e5%9c%a8c%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%83%ad%e9%94%ae%e9%9a%90%e5%90%ab%e7%aa%97%e5%8f%a3/</link>
		<comments>http://www.apc001.com/2008-11/258/%e5%9c%a8c%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%83%ad%e9%94%ae%e9%9a%90%e5%90%ab%e7%aa%97%e5%8f%a3/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 13:47:18 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[Program Life]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[热键]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=258</guid>
		<description><![CDATA[在C#中使用热键隐含窗口
Author:unknown&#38;;nbspFrom:Internet我们曾经想过能够在我们的计算机上将窗口隐蔽起来，不想被从身边走过的老板看见。尝试便捷的Windows隐藏并定义热键来控制它们。下面我... ]]></description>
			<content:encoded><![CDATA[<p>在C#中使用热键隐含窗口</p>
<p>Author:unknown&amp;;nbspFrom:Internet我们曾经想过能够在我们的计算机上将窗口隐蔽起来，不想被从身边走过的老板看见。尝试便捷的Windows隐藏并定义热键来控制它们。下面我们将演示如何通过热键，我们将会用到DllImports of Win32 API、CallBacks/Delegates，定制事件与事件的句柄。</p>
<p>using System;</p>
<p>using System.Text;</p>
<p>using System.Collections;</p>
<p>using System.Runtime.InteropServices;</p>
<p>namespace WindowHider</p>
<p>{</p>
<p>    /// &lt;summary&gt;</p>
<p>    /// Object used to control a Windows Form.</p>
<p>    /// &lt;/summary&gt;</p>
<p>    public class Window</p>
<p>    {</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Win32 API Imports</p>
<p>        /// &lt;/summary&gt;</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            bool SetForegroundWindow(IntPtr hWnd);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            bool IsIconic(IntPtr hWnd);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            bool IsZoomed(IntPtr hWnd);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            IntPtr GetForegroundWindow();</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            IntPtr GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>            IntPtr AttachThreadInput(IntPtr idAttach, IntPtr idAttachTo, int fAttach);</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Win32 API Constants for ShowWindowAsync()</p>
<p>        /// &lt;/summary&gt;</p>
<p>        private const int SW_HIDE = 0;</p>
<p>        private const int SW_SHOWNORMAL = 1;</p>
<p>        private const int SW_SHOWMINIMIZED = 2;</p>
<p>        private const int SW_SHOWMAXIMIZED = 3;</p>
<p>        private const int SW_SHOWNOACTIVATE = 4;</p>
<p>        private const int SW_RESTORE = 9;</p>
<p>        private const int SW_SHOWDEFAULT = 10;</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Private Fields</p>
<p>        /// &lt;/summary&gt;</p>
<p>        private IntPtr m_hWnd;</p>
<p>        private string m_Title;</p>
<p>        private bool m_Visible = true;</p>
<p>        private string m_Process;</p>
<p>        private bool m_WasMax = false;</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Window Object&#8217;s Public Properties</p>
<p>        /// &lt;/summary&gt;</p>
<p>        public IntPtr hWnd</p>
<p>        {</p>
<p>            get{return m_hWnd;}</p>
<p>        }</p>
<p>        public string Title</p>
<p>        {</p>
<p>            get{return m_Title;}</p>
<p>        }</p>
<p>        public string Process</p>
<p>        {</p>
<p>            get{return m_Process;}</p>
<p>        }</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Sets this Window Object&#8217;s visibility</p>
<p>        /// &lt;/summary&gt;</p>
<p>        public bool Visible</p>
<p>        {</p>
<p>            get{return m_Visible;}</p>
<p>            set</p>
<p>            {</p>
<p>                //show the window</p>
<p>                if(value == true)</p>
<p>                {</p>
<p>                    if(m_WasMax)</p>
<p>                    {</p>
<p>                        if(ShowWindowAsync(m_hWnd,SW_SHOWMAXIMIZED))</p>
<p>                            m_Visible = true;</p>
<p>                    }</p>
<p>                    else</p>
<p>                    {</p>
<p>                        if(ShowWindowAsync(m_hWnd,SW_SHOWNORMAL))</p>
<p>                            m_Visible = true;</p>
<p>                    }</p>
<p>                }</p>
<p>                //hide the window</p>
<p>                if(value == false)</p>
<p>                {</p>
<p>                    m_WasMax = IsZoomed(m_hWnd);</p>
<p>                    if(ShowWindowAsync(m_hWnd,SW_HIDE))</p>
<p>                        m_Visible = false;</p>
<p>                }</p>
<p>            }</p>
<p>        }</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Constructs a Window Object</p>
<p>        /// &lt;/summary&gt;</p>
<p>        /// &lt;param name=&#8221;Title&#8221;&gt;Title Caption&lt;/param&gt;</p>
<p>        /// &lt;param name=&#8221;hWnd&#8221;&gt;Handle&lt;/param&gt;</p>
<p>        /// &lt;param name=&#8221;Process&#8221;&gt;Owning Process&lt;/param&gt;</p>
<p>        public Window(string Title, IntPtr hWnd, string Process)</p>
<p>        {</p>
<p>            m_Title = Title;</p>
<p>            m_hWnd = hWnd;</p>
<p>            m_Process = Process;</p>
<p>        }</p>
<p>        //Override ToString() </p>
<p>        public override string ToString()</p>
<p>        {</p>
<p>            //return the title if it has one, if not return the process name</p>
<p>            if (m_Title.Length &gt; 0)</p>
<p>            {</p>
<p>                return m_Title;</p>
<p>            }</p>
<p>            else</p>
<p>            {</p>
<p>                return m_Process;</p>
<p>            }</p>
<p>        }</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Sets focus to this Window Object</p>
<p>        /// &lt;/summary&gt;</p>
<p>        public void Activate()</p>
<p>        {</p>
<p>            if(m_hWnd == GetForegroundWindow())</p>
<p>                return;</p>
<p>            IntPtr ThreadID1 = GetWindowThreadProcessId(GetForegroundWindow(),</p>
<p>                                                        IntPtr.Zero);</p>
<p>            IntPtr ThreadID2 = GetWindowThreadProcessId(m_hWnd,IntPtr.Zero);</p>
<p>           </p>
<p>            if (ThreadID1 != ThreadID2)</p>
<p>            {</p>
<p>                AttachThreadInput(ThreadID1,ThreadID2,1);</p>
<p>                SetForegroundWindow(m_hWnd);</p>
<p>                AttachThreadInput(ThreadID1,ThreadID2,0);</p>
<p>            }</p>
<p>            else</p>
<p>            {</p>
<p>                SetForegroundWindow(m_hWnd);</p>
<p>            }</p>
<p>            if (IsIconic(m_hWnd))</p>
<p>            {</p>
<p>                ShowWindowAsync(m_hWnd,SW_RESTORE);</p>
<p>            }</p>
<p>            else</p>
<p>            {</p>
<p>                ShowWindowAsync(m_hWnd,SW_SHOWNORMAL);</p>
<p>            }</p>
<p>        }</p>
<p>    }</p>
<p>    /// &lt;summary&gt;</p>
<p>    /// Collection used to enumerate Window Objects</p>
<p>    /// &lt;/summary&gt;</p>
<p>    public class Windows : IEnumerable, IEnumerator</p>
<p>    {</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Win32 API Imports</p>
<p>        /// &lt;/summary&gt;</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>              int GetWindowText(int hWnd, StringBuilder title, int size);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>              int GetWindowModuleFileName(int hWnd, StringBuilder title, int size);</p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>              int EnumWindows(EnumWindowsProc ewp, int lParam); </p>
<p>        [DllImport("user32.dll")] private static extern </p>
<p>              bool IsWindowVisible(int hWnd);</p>
<p>        //delegate used for EnumWindows() callback function</p>
<p>        public delegate bool EnumWindowsProc(int hWnd, int lParam);</p>
<p>        private int m_Position = -1; // holds current index of wndArray, </p>
<p>                                    // necessary for IEnumerable</p>
<p>       </p>
<p>        ArrayList wndArray = new ArrayList(); //array of windows</p>
<p>       </p>
<p>        //Object&#8217;s private fields</p>
<p>        private bool m_invisible = false;</p>
<p>        private bool m_notitle = false;</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Collection Constructor with additional options</p>
<p>        /// &lt;/summary&gt;</p>
<p>        /// &lt;param name=&#8221;Invisible&#8221;&gt;Include invisible Windows&lt;/param&gt;</p>
<p>        /// &lt;param name=&#8221;Untitled&#8221;&gt;Include untitled Windows&lt;/param&gt;</p>
<p>        public Windows(bool Invisible, bool Untitled)</p>
<p>        {</p>
<p>            m_invisible = Invisible;</p>
<p>            m_notitle = Untitled;</p>
<p>            //Declare a callback delegate for EnumWindows() API call</p>
<p>            EnumWindowsProc ewp = new EnumWindowsProc(EvalWindow);</p>
<p>            //Enumerate all Windows</p>
<p>            EnumWindows(ewp, 0);</p>
<p>        }</p>
<p>        /// &lt;summary&gt;</p>
<p>        /// Collection Constructor</p>
<p>        /// &lt;/summary&gt;</p>
<p>        public Windows()</p>
<p>        {</p>
<p>            //Declare a callback delegate for EnumWindows() API call</p>
<p>            EnumWindowsProc ewp = new EnumWindowsProc(EvalWindow);</p>
<p>            //Enumerate all Windows</p>
<p>            EnumWindows(ewp, 0);</p>
<p>        }</p>
<p>        //EnumWindows CALLBACK function</p>
<p>        private bool EvalWindow(int hWnd, int lParam)</p>
<p>        {</p>
<p>            if (m_invisible == false &amp;;amp;&amp;;amp; !IsWindowVisible(hWnd))</p>
<p>                return(true);</p>
<p>            StringBuilder title = new StringBuilder(256);</p>
<p>            StringBuilder module = new StringBuilder(256);</p>
<p>            GetWindowModuleFileName(hWnd, module, 256);</p>
<p>            GetWindowText(hWnd, title, 256);</p>
<p>            if (m_notitle == false &amp;;amp;&amp;;amp; title.Length == 0)</p>
<p>                return(true);</p>
<p>            wndArray.Add(new Window(title.ToString(), (IntPtr)hWnd, </p>
<p>                                    module.ToString()));</p>
<p>            return(true);</p>
<p>        }</p>
<p>       </p>
<p>        //implement IEnumerable</p>
<p>        public IEnumerator GetEnumerator()</p>
<p>        {</p>
<p>            return (IEnumerator)this;</p>
<p>        }</p>
<p>        //implement IEnumerator</p>
<p>        public bool MoveNext()</p>
<p>        {</p>
<p>            m_Position  ;</p>
<p>            if (m_Position &lt; wndArray.Count)</p>
<p>{</p>
<p>return true;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>return false;</p>
<p>}</p>
<p>}</p>
<p>public void Reset()</p>
<p>{</p>
<p>m_Position = -1;</p>
<p>}</p>
<p>public object Current</p>
<p>{</p>
<p>get</p>
<p>{</p>
<p>return wndArray[m_Position];</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}<br />
<h3>相关日志</h3>
<ul class="related_post">
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/255/%e5%9c%a8c%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%b3%bb%e7%bb%9f%e7%83%ad%e9%94%ae/" title="在C#程序中使用系统热键">在C#程序中使用系统热键 (0)</a></li>
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/251/c-%e5%88%b6%e4%bd%9c%e8%b6%85%e9%85%b7%e5%9b%be%e5%83%8f%e6%95%88%e6%9e%9c/" title="C# 制作超酷图像效果">C# 制作超酷图像效果 (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/28/caxwebbrowseriframeframes20%e4%ba%8c/" title="C#,AxWebBrowser,Iframe,Frames,2.0(二) ">C#,AxWebBrowser,Iframe,Frames,2.0(二)  (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/27/caxwebbrowseriframeframes20%e4%b8%80/" title="C#,AxWebBrowser,Iframe,Frames,2.0(一)">C#,AxWebBrowser,Iframe,Frames,2.0(一) (0)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/23/cwebbrowseronnavigate%e8%a7%a6%e5%8f%91%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a0%81/" title="C#,WebBrowser,OnNavigate,触发,示例,代码">C#,WebBrowser,OnNavigate,触发,示例,代码 (0)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=258&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_258" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-11/258/%e5%9c%a8c%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%83%ad%e9%94%ae%e9%9a%90%e5%90%ab%e7%aa%97%e5%8f%a3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>在C#程序中使用系统热键</title>
		<link>http://www.apc001.com/2008-11/255/%e5%9c%a8c%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%b3%bb%e7%bb%9f%e7%83%ad%e9%94%ae/</link>
		<comments>http://www.apc001.com/2008-11/255/%e5%9c%a8c%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%b3%bb%e7%bb%9f%e7%83%ad%e9%94%ae/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 13:45:26 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[Program Life]]></category>

		<category><![CDATA[api]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[热键]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=255</guid>
		<description><![CDATA[1.首先引入System.Runtime.InteropServices
using System.Runtime.InteropServices;
2.在类内部声明两个API函数,它们的位置和类的成员变量等同.
[System.Runtime.InteropServices.DllImport("user32.dll")] //申明API函数
public static ex... ]]></description>
			<content:encoded><![CDATA[<p>1.首先引入System.Runtime.InteropServices</p>
<p>using System.Runtime.InteropServices;</p>
<p>2.在类内部声明两个API函数,它们的位置和类的成员变量等同.</p>
<p>[System.Runtime.InteropServices.DllImport("user32.dll")] //申明API函数<br />
public static extern bool RegisterHotKey(<br />
IntPtr hWnd, // handle to window<br />
int id, // hot key identifier<br />
uint fsModifiers, // key-modifier options<br />
Keys vk // virtual-key code<br />
);</p>
<p>[System.Runtime.InteropServices.DllImport("user32.dll")] //申明API函数<br />
public static extern bool UnregisterHotKey(<br />
IntPtr hWnd, // handle to window<br />
int id // hot key identifier<br />
);</p>
<p>3.定义一个KeyModifiers的枚举,以便出现组合键</p>
<p>public enum KeyModifiers<br />
{<br />
None = 0,<br />
Alt = 1,<br />
Control = 2,<br />
Shift = 4,<br />
Windows = 8<br />
}</p>
<p>4.在类的构造函数出注册系统热键</p>
<p>示例,下例注册了四个热键:</p>
<p>public MainForm()<br />
{<br />
InitializeComponent();</p>
<p>RegisterHotKey(Handle, 100, 2, Keys.Left); // 热键一:Control +光标左箭头<br />
RegisterHotKey(Handle, 200, 2, Keys.Right); / /热键一:Control +光标右箭头<br />
RegisterHotKey(Handle, 300, 2, Keys.Up); // 热键一:Control +光标上箭头<br />
RegisterHotKey(Handle, 400, 2, Keys.Down); // 热键一:Control +光标下箭头</p>
<p>&#8230;.;<br />
}</p>
<p>5.重写WndProc()方法，通过监视系统消息，来调用过程</p>
<p>示例:</p>
<p>protected override void WndProc(ref Message m)//监视Windows消息<br />
{<br />
const int WM_HOTKEY = 0&#215;0312; //如果m.Msg的值为0&#215;0312那么表示用户按下了热键<br />
switch (m.Msg)<br />
{<br />
case WM_HOTKEY:<br />
ProcessHotkey(m); //按下热键时调用ProcessHotkey()函数<br />
break;<br />
}</p>
<p>base.WndProc(ref m); //将系统消息传递自父类的WndProc<br />
}</p>
<p>5.不用说,我们接下来需要实现ProcessHotkey函数:</p>
<p>//按下设定的键时调用该函数</p>
<p>private void ProcessHotkey(Message m)<br />
{<br />
IntPtr id = m.WParam; //IntPtr用于表示指针或句柄的平台特定类型<br />
//MessageBox.Show(id.ToString());<br />
string sid = id.ToString();<br />
switch (sid)<br />
{<br />
case &#8220;100&#8243;: DecreseVolumnb(); break; // 按下Control +光标左箭头,调用函数DecreseVolumnb();<br />
case &#8220;200&#8243;: AddVolumnb(); break; // 按下Control +光标右箭头,调用函数AddVolumnb()<br />
case &#8220;300&#8243;:// 按下Control +光标上箭头,显示窗体<br />
this.Visible = true;<br />
break;<br />
case &#8220;400&#8243;:// 按下Control +光标下箭头,隐藏窗体<br />
this.Visible = false;<br />
break;<br />
}<br />
}</p>
<p>很明显接下来分别实现函数DecreseVolumnb(); 和AddVolumnb(); 即可.</p>
<p>6.最后别忘了在程序退出时取消热键的注册</p>
<p>private void MainForm_FormClosing(object sender, FormClosingEventArgs e)<br />
{<br />
UnregisterHotKey(Handle, 100); //卸载第1个快捷键<br />
UnregisterHotKey(Handle, 200); //缷载第2个快捷键<br />
UnregisterHotKey(Handle, 300); //卸载第3个快捷键<br />
UnregisterHotKey(Handle, 400); //缷载第4个快捷键<br />
}</p>
<p>以上就是在程序中使用系统热键的整个过程<br />
<h3>相关日志</h3>
<ul class="related_post">
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/258/%e5%9c%a8c%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%83%ad%e9%94%ae%e9%9a%90%e5%90%ab%e7%aa%97%e5%8f%a3/" title="在C#中使用热键隐含窗口">在C#中使用热键隐含窗口 (0)</a></li>
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/251/c-%e5%88%b6%e4%bd%9c%e8%b6%85%e9%85%b7%e5%9b%be%e5%83%8f%e6%95%88%e6%9e%9c/" title="C# 制作超酷图像效果">C# 制作超酷图像效果 (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/28/caxwebbrowseriframeframes20%e4%ba%8c/" title="C#,AxWebBrowser,Iframe,Frames,2.0(二) ">C#,AxWebBrowser,Iframe,Frames,2.0(二)  (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/27/caxwebbrowseriframeframes20%e4%b8%80/" title="C#,AxWebBrowser,Iframe,Frames,2.0(一)">C#,AxWebBrowser,Iframe,Frames,2.0(一) (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/24/%e9%9d%9e%e5%b8%b8%e6%9c%89%e7%94%a8%e7%9a%84%e6%93%8d%e4%bd%9cinternet%e7%9a%84api%e5%87%bd%e6%95%b0/" title="非常有用的操作INTERNET的API函数">非常有用的操作INTERNET的API函数 (0)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/23/cwebbrowseronnavigate%e8%a7%a6%e5%8f%91%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a0%81/" title="C#,WebBrowser,OnNavigate,触发,示例,代码">C#,WebBrowser,OnNavigate,触发,示例,代码 (0)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=255&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_255" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-11/255/%e5%9c%a8c%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%b3%bb%e7%bb%9f%e7%83%ad%e9%94%ae/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# 制作超酷图像效果</title>
		<link>http://www.apc001.com/2008-11/251/c-%e5%88%b6%e4%bd%9c%e8%b6%85%e9%85%b7%e5%9b%be%e5%83%8f%e6%95%88%e6%9e%9c/</link>
		<comments>http://www.apc001.com/2008-11/251/c-%e5%88%b6%e4%bd%9c%e8%b6%85%e9%85%b7%e5%9b%be%e5%83%8f%e6%95%88%e6%9e%9c/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 13:41:40 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[Program Life]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[图像处理]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=251</guid>
		<description><![CDATA[一. 底片效果
原理: GetPixel方法获得每一点像素的值, 然后再使用SetPixel方法将取反后的颜色值设置到对应的点.
CODE:
private void button1_Click(object sender, EventArgs e)
{
//以底片效果显示图像
try
{
int Height... ]]></description>
			<content:encoded><![CDATA[<p>一. 底片效果<br />
原理: GetPixel方法获得每一点像素的值, 然后再使用SetPixel方法将取反后的颜色值设置到对应的点.<br />
<span id="Code_Open_Text_24238_-1" style="display: none;">CODE:<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以底片效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap newbitmap = new Bitmap(Width, Height);<br />
Bitmap oldbitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel;<br />
for (int x = 1; x &lt; Width; x++)<br />
{<br />
for (int y = 1; y &lt; Height; y++)<br />
{<br />
int r, g, b;<br />
pixel = oldbitmap.GetPixel(x, y);<br />
r = 255 - pixel.R;<br />
g = 255 - pixel.G;<br />
b = 255 - pixel.B;<br />
newbitmap.SetPixel(x, y, Color.FromArgb(r, g, b));<br />
}<br />
}<br />
this.pictureBox1.Image = newbitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;, MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
}<br />
}</span></p>
<p>二. 浮雕效果<br />
原理: 对图像像素点的像素值分别与相邻像素点的像素值相减后加上128, 然后将其作为新的像素点的值.<br />
<span id="Code_Open_Text_24238_0" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以浮雕效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap newBitmap = new Bitmap(Width, Height);<br />
Bitmap oldBitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel1, pixel2;<br />
for (int x = 0; x &lt; Width - 1; x++)<br />
{<br />
for (int y = 0; y &lt; Height - 1; y++)<br />
{<br />
int r = 0, g = 0, b = 0;<br />
pixel1 = oldBitmap.GetPixel(x, y);<br />
pixel2 = oldBitmap.GetPixel(x + 1, y + 1);<br />
r = Math.Abs(pixel1.R - pixel2.R + 128);<br />
g = Math.Abs(pixel1.G - pixel2.G + 128);<br />
b = Math.Abs(pixel1.B - pixel2.B + 128);<br />
if (r &gt; 255)<br />
r = 255;<br />
if (r &lt; 0)<br />
r = 0;<br />
if (g &gt; 255)<br />
g = 255;<br />
if (g &lt; 0)<br />
g = 0;<br />
if (b &gt; 255)<br />
b = 255;<br />
if (b &lt; 0)<br />
b = 0;<br />
newBitmap.SetPixel(x, y, Color.FromArgb(r, g, b));<br />
}<br />
}<br />
this.pictureBox1.Image = newBitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;, MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
}<br />
}</span><br />
三. 黑白效果<br />
原理: 彩色图像处理成黑白效果通常有3种算法；<br />
(1).最大值法: 使每个像素点的 R, G, B 值等于原像素点的 RGB (颜色值) 中最大的一个；<br />
(2).平均值法: 使用每个像素点的 R,G,B值等于原像素点的RGB值的平均值；<br />
(3).加权平均值法: 对每个像素点的 R, G, B值进行加权<br />
    &#8212;自认为第三种方法做出来的黑白效果图像最 &#8220;真实&#8221;.<br />
<span id="Code_Open_Text_24238_1" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以黑白效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap newBitmap = new Bitmap(Width, Height);<br />
Bitmap oldBitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel;<br />
for (int x = 0; x &lt; Width; x++)<br />
for (int y = 0; y &lt; Height; y++)<br />
{<br />
pixel = oldBitmap.GetPixel(x, y);<br />
int r, g, b, Result = 0;<br />
r = pixel.R;<br />
g = pixel.G;<br />
b = pixel.B;<br />
//实例程序以加权平均值法产生黑白图像<br />
int iType =2;<br />
switch (iType)<br />
{<br />
case 0://平均值法<br />
Result = ((r + g + b) / 3);<br />
break;<br />
case 1://最大值法<br />
Result = r &gt; g ? r : g;<br />
Result = Result &gt; b ? Result : b;<br />
break;<br />
case 2://加权平均值法<br />
Result = ((int)(0.7 * r) + (int)(0.2 * g) + (int)(0.1 * b));<br />
break;<br />
}<br />
newBitmap.SetPixel(x, y, Color.FromArgb(Result, Result, Result));<br />
}<br />
this.pictureBox1.Image = newBitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span></p>
<p>四. 柔化效果<br />
原理: 当前像素点与周围像素点的颜色差距较大时取其平均值.<br />
<span id="Code_Open_Text_24238_2" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以柔化效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap bitmap = new Bitmap(Width, Height);<br />
Bitmap MyBitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel;<br />
//高斯模板<br />
int[] Gauss ={ 1, 2, 1, 2, 4, 2, 1, 2, 1 };<br />
for (int x = 1; x &lt; Width - 1; x++)<br />
for (int y = 1; y &lt; Height - 1; y++)<br />
{<br />
int r = 0, g = 0, b = 0;<br />
int Index = 0;<br />
for (int col = -1; col &lt;= 1; col++)<br />
for (int row = -1; row &lt;= 1; row++)<br />
{<br />
pixel = MyBitmap.GetPixel(x + row, y + col);<br />
r += pixel.R * Gauss[Index];<br />
g += pixel.G * Gauss[Index];<br />
b += pixel.B * Gauss[Index];<br />
Index++;<br />
}<br />
r /= 16;<br />
g /= 16;<br />
b /= 16;<br />
//处理颜色值溢出<br />
r = r &gt; 255 ? 255 : r;<br />
r = r &lt; 0 ? 0 : r;<br />
g = g &gt; 255 ? 255 : g;<br />
g = g &lt; 0 ? 0 : g;<br />
b = b &gt; 255 ? 255 : b;<br />
b = b &lt; 0 ? 0 : b;<br />
bitmap.SetPixel(x - 1, y - 1, Color.FromArgb(r, g, b));<br />
}<br />
this.pictureBox1.Image = bitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span><br />
五.锐化效果<br />
原理:突出显示颜色值大(即形成形体边缘)的像素点.<br />
<span id="Code_Open_Text_24238_3" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以锐化效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap newBitmap = new Bitmap(Width, Height);<br />
Bitmap oldBitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel;<br />
//拉普拉斯模板<br />
int[] Laplacian ={ -1, -1, -1, -1, 9, -1, -1, -1, -1 };<br />
for (int x = 1; x &lt; Width - 1; x++)<br />
for (int y = 1; y &lt; Height - 1; y++)<br />
{<br />
int r = 0, g = 0, b = 0;<br />
int Index = 0;<br />
for (int col = -1; col &lt;= 1; col++)<br />
for (int row = -1; row &lt;= 1; row++)<br />
{<br />
pixel = oldBitmap.GetPixel(x + row, y + col); r += pixel.R * Laplacian[Index];<br />
g += pixel.G * Laplacian[Index];<br />
b += pixel.B * Laplacian[Index];<br />
Index++;<br />
}<br />
//处理颜色值溢出<br />
r = r &gt; 255 ? 255 : r;<br />
r = r &lt; 0 ? 0 : r;<br />
g = g &gt; 255 ? 255 : g;<br />
g = g &lt; 0 ? 0 : g;<br />
b = b &gt; 255 ? 255 : b;<br />
b = b &lt; 0 ? 0 : b;<br />
newBitmap.SetPixel(x - 1, y - 1, Color.FromArgb(r, g, b));<br />
}<br />
this.pictureBox1.Image = newBitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span>六. 雾化效果<br />
原理: 在图像中引入一定的随机值, 打乱图像中的像素值<br />
<span id="Code_Open_Text_24238_4" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以雾化效果显示图像<br />
try<br />
{<br />
int Height = this.pictureBox1.Image.Height;<br />
int Width = this.pictureBox1.Image.Width;<br />
Bitmap newBitmap = new Bitmap(Width, Height);<br />
Bitmap oldBitmap = (Bitmap)this.pictureBox1.Image;<br />
Color pixel;<br />
for (int x = 1; x &lt; Width - 1; x++)<br />
for (int y = 1; y &lt; Height - 1; y++)<br />
{<br />
System.Random MyRandom = new Random();<br />
int k = MyRandom.Next(123456);<br />
//像素块大小<br />
int dx = x + k % 19;<br />
int dy = y + k % 19;<br />
if (dx &gt;= Width)<br />
dx = Width - 1;<br />
if (dy &gt;= Height)<br />
dy = Height - 1;<br />
pixel = oldBitmap.GetPixel(dx, dy);<br />
newBitmap.SetPixel(x, y, pixel);<br />
}<br />
this.pictureBox1.Image = newBitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span><br />
七. 光照效果<br />
原理: 对图像中的某一范围内的像素的亮度分别进行处理.<br />
<span id="Code_Open_Text_24238_5" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以光照效果显示图像<br />
Graphics MyGraphics = this.pictureBox1.CreateGraphics();<br />
MyGraphics.Clear(Color.White);<br />
Bitmap MyBmp = new Bitmap(this.pictureBox1.Image, this.pictureBox1.Width, this.pictureBox1.Height);<br />
int MyWidth = MyBmp.Width;<br />
int MyHeight = MyBmp.Height;<br />
Bitmap MyImage = MyBmp.Clone(new RectangleF(0, 0, MyWidth, MyHeight), System.Drawing.Imaging.PixelFormat.DontCare);<br />
int A = Width / 2;<br />
int B = Height / 2;<br />
//MyCenter图片中心点，发亮此值会让强光中心发生偏移<br />
Point MyCenter = new Point(MyWidth / 2, MyHeight / 2);<br />
//R强光照射面的半径，即”光晕”<br />
int R = Math.Min(MyWidth / 2, MyHeight / 2);<br />
for (int i = MyWidth - 1; i &gt;= 1; i&#8211;)<br />
{<br />
for (int j = MyHeight - 1; j &gt;= 1; j&#8211;)<br />
{<br />
float MyLength = (float)Math.Sqrt(Math.Pow((i - MyCenter.X), 2) + Math.Pow((j - MyCenter.Y), 2));<br />
//如果像素位于”光晕”之内<br />
if (MyLength &lt; R)<br />
{<br />
Color MyColor = MyImage.GetPixel(i, j);<br />
int r, g, b;<br />
//220亮度增加常量，该值越大，光亮度越强<br />
float MyPixel = 220.0f * (1.0f - MyLength / R);<br />
r = MyColor.R + (int)MyPixel;<br />
r = Math.Max(0, Math.Min(r, 255));<br />
g = MyColor.G + (int)MyPixel;<br />
g = Math.Max(0, Math.Min(g, 255));<br />
b = MyColor.B + (int)MyPixel;<br />
b = Math.Max(0, Math.Min(b, 255));<br />
//将增亮后的像素值回写到位图<br />
Color MyNewColor = Color.FromArgb(255, r, g, b);<br />
MyImage.SetPixel(i, j, MyNewColor);<br />
}<br />
}<br />
//重新绘制图片<br />
MyGraphics.DrawImage(MyImage, new Rectangle(0, 0, MyWidth, MyHeight));<br />
}</p>
<p>}<br />
}</span>八.百叶窗效果<br />
原理:(1).垂直百叶窗效果:<br />
根据窗口或图像的高度或宽度和定制的百叶窗显示条宽度计算百叶窗显示的条数量 ；<br />
根据窗口或图像的高度或宽度定制百叶窗显示条数量计算百窗显示的条宽度.<br />
(2).水平百叶窗效果: 原理同上,只是绘制像素点开始的坐标不同.<br />
<span id="Code_Open_Text_24238_6" style="display: none;"><br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
//垂直百叶窗显示图像<br />
try<br />
{<br />
MyBitmap = (Bitmap)this.pictureBox1.Image.Clone();<br />
int dw = MyBitmap.Width / 30;<br />
int dh = MyBitmap.Height;<br />
Graphics g = this.pictureBox1.CreateGraphics();<br />
g.Clear(Color.Gray);<br />
Point[] MyPoint = new Point[30];<br />
for (int x = 0; x &lt; 30; x++)<br />
{<br />
MyPoint[x].Y = 0;<br />
MyPoint[x].X = x * dw;<br />
}<br />
Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);<br />
for (int i = 0; i &lt; dw; i++)<br />
{<br />
for (int j = 0; j &lt; 30; j++)<br />
{<br />
for (int k = 0; k &lt; dh; k++)<br />
{<br />
bitmap.SetPixel(MyPoint[j].X + i, MyPoint[j].Y + k,<br />
MyBitmap.GetPixel(MyPoint[j].X + i, MyPoint[j].Y + k));<br />
}<br />
}<br />
this.pictureBox1.Refresh();<br />
this.pictureBox1.Image = bitmap;<br />
System.Threading.Thread.Sleep(100);<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}</p>
<p>}</span>水平百叶窗<br />
<span id="Code_Open_Text_24238_7" style="display: none;">private void button3_Click(object sender, EventArgs e)<br />
{<br />
//水平百叶窗显示图像<br />
try<br />
{<br />
MyBitmap = (Bitmap)this.pictureBox1.Image.Clone();<br />
int dh = MyBitmap.Height / 20;<br />
int dw = MyBitmap.Width;<br />
Graphics g = this.pictureBox1.CreateGraphics();<br />
g.Clear(Color.Gray);<br />
Point[] MyPoint = new Point[20];<br />
for (int y = 0; y &lt; 20; y++)<br />
{<br />
MyPoint[y].X = 0;<br />
MyPoint[y].Y = y * dh;<br />
}<br />
Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);<br />
for (int i = 0; i &lt; dh; i++)<br />
{<br />
for (int j = 0; j &lt; 20; j++)<br />
{<br />
for (int k = 0; k &lt; dw; k++)<br />
{<br />
bitmap.SetPixel(MyPoint[j].X + k, MyPoint[j].Y + i, MyBitmap.GetPixel(MyPoint[j].X + k, MyPoint[j].Y + i));<br />
}<br />
}<br />
this.pictureBox1.Refresh();<br />
this.pictureBox1.Image = bitmap;<br />
System.Threading.Thread.Sleep(100);<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span>九.马赛克效果<br />
原理: 确定图像的随机位置点和确定马赛克块的大小,然后马赛克块图像覆盖随机点即可.<br />
<span id="Code_Open_Text_24238_8" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以马赛克效果显示图像<br />
try<br />
{<br />
int dw = MyBitmap.Width / 50;<br />
int dh = MyBitmap.Height / 50;<br />
Graphics g = this.pictureBox1.CreateGraphics();<br />
g.Clear(Color.Gray);<br />
Point[] MyPoint = new Point[2500];<br />
for (int x = 0; x &lt; 50; x++)<br />
for (int y = 0; y &lt; 50; y++)<br />
{<br />
MyPoint[x * 50 + y].X = x * dw;<br />
MyPoint[x * 50 + y].Y = y * dh;<br />
}<br />
Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);<br />
for (int i = 0; i &lt; 10000; i++)<br />
{<br />
System.Random MyRandom = new Random();<br />
int iPos = MyRandom.Next(2500);<br />
for (int m = 0; m &lt; dw; m++)<br />
for (int n = 0; n &lt; dh; n++)<br />
{<br />
bitmap.SetPixel(MyPoint[iPos].X + m, MyPoint[iPos].Y + n, MyBitmap.GetPixel(MyPoint[iPos].X + m, MyPoint[iPos].Y + n));<br />
}<br />
this.pictureBox1.Refresh();<br />
this.pictureBox1.Image = bitmap;<br />
}<br />
for (int i = 0; i &lt; 2500; i++)<br />
for (int m = 0; m &lt; dw; m++)<br />
for (int n = 0; n &lt; dh; n++)<br />
{<br />
bitmap.SetPixel(MyPoint[i].X + m, MyPoint[i].Y + n, MyBitmap.GetPixel(MyPoint[i].X + m, MyPoint[i].Y + n));<br />
}<br />
this.pictureBox1.Refresh();<br />
this.pictureBox1.Image = bitmap;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span><br />
十. 油画效果<br />
原理: 对图像中某一范围内的像素引入随机值.<br />
<span id="Code_Open_Text_24238_9" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以油画效果显示图像<br />
Graphics g = this.panel1.CreateGraphics();<br />
//Bitmap bitmap = this.MyBitmap;<br />
//取得图片尺寸<br />
int width = MyBitmap.Width;<br />
int height = MyBitmap.Height;<br />
RectangleF rect = new RectangleF(0, 0, width, height);<br />
Bitmap img = MyBitmap.Clone(rect, System.Drawing.Imaging.PixelFormat.DontCare);<br />
//产生随机数序列<br />
Random rnd = new Random();<br />
//取不同的值决定油画效果的不同程度<br />
int iModel = 2;<br />
int i = width - iModel;<br />
while (i &gt; 1)<br />
{<br />
int j = height - iModel;<br />
while (j &gt; 1)<br />
{<br />
int iPos = rnd.Next(100000) % iModel;<br />
//将该点的RGB值设置成附近iModel点之内的任一点<br />
Color color = img.GetPixel(i + iPos, j + iPos);<br />
img.SetPixel(i, j, color);<br />
j = j - 1;<br />
}<br />
i = i - 1;<br />
}<br />
//重新绘制图像<br />
g.Clear(Color.White);<br />
g.DrawImage(img, new Rectangle(0, 0, width, height));<br />
}</span><br />
十一: 扭曲效果<br />
原理: 将图像缩放为一个非矩形的平等四边形即可<br />
<span id="Code_Open_Text_24238_10" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以扭曲效果显示图像<br />
if (h == panel1.Height/2)<br />
{<br />
w = 0;<br />
h = 0;<br />
}<br />
Size offset =new Size (w++,h++);//设置偏移量<br />
Graphics g = panel1.CreateGraphics();<br />
Rectangle rect = this.panel1.ClientRectangle;<br />
Point[] points = new Point[3];<br />
points[0] = new Point(rect.Left+offset.Width ,rect.Top +offset .Height);<br />
points[1] = new Point(rect.Right, rect.Top + offset.Height);<br />
points[2] = new Point(rect.Left, rect.Bottom - offset.Height);<br />
g.Clear(Color.White);<br />
g.DrawImage(MyBitmap, points);<br />
}</span></p>
<p>十二.积木效果<br />
原理: 对图像中的各个像素点着重(即加大分像素的颜色值)着色.<br />
<span id="Code_Open_Text_24238_11" style="display: none;">private void button1_Click(object sender, EventArgs e)<br />
{<br />
//以积木效果显示图像<br />
try<br />
{<br />
Graphics myGraphics = this.panel1.CreateGraphics ();<br />
//Bitmap myBitmap = new Bitmap(this.BackgroundImage);<br />
int myWidth, myHeight, i, j, iAvg, iPixel;<br />
Color myColor, myNewColor;<br />
RectangleF myRect;<br />
myWidth = MyBitmap.Width;<br />
myHeight = MyBitmap.Height;<br />
myRect = new RectangleF(0, 0, myWidth, myHeight);<br />
Bitmap bitmap = MyBitmap.Clone(myRect, System.Drawing.Imaging.PixelFormat.DontCare);<br />
i = 0;<br />
while (i &lt; myWidth - 1)<br />
{<br />
j = 0;<br />
while (j &lt; myHeight - 1)<br />
{<br />
myColor = bitmap.GetPixel(i, j);<br />
iAvg = (myColor.R + myColor.G + myColor.B) / 3;<br />
iPixel = 0;<br />
if (iAvg &gt;= 128)<br />
iPixel = 255;<br />
else<br />
iPixel = 0;<br />
myNewColor = Color.FromArgb(255, iPixel, iPixel, iPixel);<br />
bitmap.SetPixel(i, j, myNewColor);<br />
j = j + 1;<br />
}<br />
i = i + 1;<br />
}<br />
myGraphics.Clear(Color.WhiteSmoke);<br />
myGraphics.DrawImage(bitmap, new Rectangle(0, 0, myWidth, myHeight));<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message, &#8220;信息提示&#8221;);<br />
}<br />
}</span>说明.这些大多为静态图. 后面会有图像的动态显示. 如分块合成图像, 四周扩散显示图像, 上下对接显示图像等.</p>
<p>      这些也许能说明一下 PPT或者手机中的图片效果处理程序是如果做出来的.原理应该是相通的.</p>
<p>      制作图像一般常用的类有: Bitmap; Graphics; Rectangle；Color; 用到的方法是 Graphics类的DrawImage；<br />
      此方法共有30个版本, 我习惯用 DrawImage(&#8221;图像&#8221;, &#8220;图框&#8221;) 版本.</p>
<p>      因为这个版本的思想是最简单的&#8212;-把一张**地图像装在一个**地框里! (**代表某种效果的图像和某种效果的框)<br />
      如. g.DrawImage(new Bitmap(&#8221;myPicture&#8221;), new Rectangle(0, 0, myWidth, myHeight));<br />
<h3>相关日志</h3>
<ul class="related_post">
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/258/%e5%9c%a8c%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%83%ad%e9%94%ae%e9%9a%90%e5%90%ab%e7%aa%97%e5%8f%a3/" title="在C#中使用热键隐含窗口">在C#中使用热键隐含窗口 (0)</a></li>
<li>2008年11月11日 &#8212; <a href="http://www.apc001.com/2008-11/255/%e5%9c%a8c%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e7%b3%bb%e7%bb%9f%e7%83%ad%e9%94%ae/" title="在C#程序中使用系统热键">在C#程序中使用系统热键 (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/28/caxwebbrowseriframeframes20%e4%ba%8c/" title="C#,AxWebBrowser,Iframe,Frames,2.0(二) ">C#,AxWebBrowser,Iframe,Frames,2.0(二)  (0)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/27/caxwebbrowseriframeframes20%e4%b8%80/" title="C#,AxWebBrowser,Iframe,Frames,2.0(一)">C#,AxWebBrowser,Iframe,Frames,2.0(一) (0)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/23/cwebbrowseronnavigate%e8%a7%a6%e5%8f%91%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a0%81/" title="C#,WebBrowser,OnNavigate,触发,示例,代码">C#,WebBrowser,OnNavigate,触发,示例,代码 (0)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=251&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_251" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-11/251/c-%e5%88%b6%e4%bd%9c%e8%b6%85%e9%85%b7%e5%9b%be%e5%83%8f%e6%95%88%e6%9e%9c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Easy Way to Extract Useful Text from Arbitrary HTML</title>
		<link>http://www.apc001.com/2008-10/248/the-easy-way-to-extract-useful-text-from-arbitrary-html/</link>
		<comments>http://www.apc001.com/2008-10/248/the-easy-way-to-extract-useful-text-from-arbitrary-html/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 06:10:55 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[Program Life]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=248</guid>
		<description><![CDATA[The Easy Way to Extract Useful Text from Arbitrary HTML
从HTML文件中抽取正文的简单方案
译者导读：这篇文章主要介绍了从不同类型的HTML文件中抽取出真正有用的正文内容的一种有广泛适应性的方法。其功... ]]></description>
			<content:encoded><![CDATA[<p>The Easy Way to Extract Useful Text from Arbitrary HTML<br />
从HTML文件中抽取正文的简单方案</p>
<p>译者导读：这篇文章主要介绍了从不同类型的HTML文件中抽取出真正有用的正文内容的一种有广泛适应性的方法。其功能类似于CSDN近期推出的“剪影”，能够去除页眉、页脚和侧边栏的无关内容，非常实用。其方法简单有效而又出乎意料，看完后难免大呼原来还可以这样！行文简明易懂，虽然应用了人工神经网络这样的算法，但因为FANN良好的封装性，并不要求读者需要懂得ANN。全文示例以Python代码写成，可读性更佳，具有科普气息，值得一读。<br />
You’ve finally got your hands on the diverse collection of HTML documents you needed. But the content you’re interested in is hidden amidst adverts, layout tables or formatting markup, and other various links. Even worse, there’s visible text in the menus, headers and footers that you want to filter out. If you don’t want to write a complex scraping program for each type of HTML file, there is a solution.<br />
每个人手中都可能有一大堆讨论不同话题的HTML文档。但你真正感兴趣的内容可能隐藏于广告、布局表格或格式标记以及无数链接当中。甚至更糟的是，你希望那些来自菜单、页眉和页脚的文本能够被过滤掉。如果你不想为每种类型的HTML文件分别编写复杂的抽取程序的话，我这里有一个解决方案。<br />
This article shows you how to write a relatively simple script to extract text paragraphs from large chunks of HTML code, without knowing its structure or the tags used. It works on news articles and blogs pages with worthwhile text content, among others…<br />
本文讲述如何编写与从大量HTML代码中获取正文内容的简单脚本，这一方法无需知道HTML文件的结构和使用的标签。它能够工作于含有文本内容的所有新闻文章和博客页面……<br />
Do you want to find out how statistics and machine learning can save you time and effort mining text?<br />
你想知道统计学和机器学习在挖掘文本方面能够让你省时省力的原因吗？<br />
The concept is rather simple: use information about the density of text vs. HTML code to work out if a line of text is worth outputting. (This isn’t a novel idea, but it works!) The basic process works as follows:</p>
<p>答案极其简单：使用文本和HTML代码的密度来决定一行文件是否应该输出。（这听起来有点离奇，但它的确有用！）基本的处理工作如下：<br />
Parse the HTML code and keep track of the number of bytes processed.<br />
一、解析HTML代码并记下处理的字节数。<br />
Store the text output on a per-line, or per-paragraph basis.<br />
二、以行或段的形式保存解析输出的文本。<br />
Associate with each text line the number of bytes of HTML required to describe it.<br />
三、统计每一行文本相应的HTML代码的字节数<br />
Compute the text density of each line by calculating the ratio of text to bytes.<br />
四、通过计算文本相对于字节数的比率来获取文本密度<br />
Then decide if the line is part of the content by using a neural network.<br />
五、最后用神经网络来决定这一行是不是正文的一部分。<br />
You can get pretty good results just by checking if the line’s density is above a fixed threshold (or the average), but the system makes fewer mistakes if you use machine learning — not to mention that it’s easier to implement!<br />
仅仅通过判断行密度是否高于一个固定的阈值（或者就使用平均值）你就可以获得非常好的结果。但你也可以使用机器学习（这易于实现，简直不值一提）来减少这个系统出现的错误。<br />
Let’s take it from the top…<br />
现在让我从头开始……<br />
Converting the HTML to Text<br />
转换HTML为文本<br />
What you need is the core of a text-mode browser, which is already setup to read files with HTML markup and display raw text. By reusing existing code, you won’t have to spend too much time handling invalid XML documents, which are very common — as you’ll realise quickly.<br />
你需要一个文本模式浏览器的核心，它应该已经内建了读取HTML文件和显示原始文本功能。通过重用已有代码，你并不需要把很多时间花在处理无效的XML文件上。<br />
As a quick example, we’ll be using Python along with a few built-in modules: htmllib for the parsing and formatter for outputting formatted text. This is what the top-level function looks like:<br />
我们将使用Python来完成这个例子，它的htmllib模块可用以解析HTML文件，formatter模块可用以输出格式化的文本。嗯，实现的顶层函数如下：<br />
def extract_text(html):<br />
    # Derive from formatter.AbstractWriter to store paragraphs.<br />
    writer = LineWriter()<br />
    # Default formatter sends commands to our writer.<br />
    formatter = AbstractFormatter(writer)<br />
    # Derive from htmllib.HTMLParser to track parsed bytes.<br />
    parser = TrackingParser(writer, formatter)<br />
    # Give the parser the raw HTML data.<br />
    parser.feed(html)<br />
    parser.close()<br />
    # Filter the paragraphs stored and output them.<br />
    return writer.output()<br />
The TrackingParser itself overrides the callback functions for parsing start and end tags, as they are given the current parse index in the buffer. You don’t have access to that normally, unless you start diving into frames in the call stack — which isn’t the best approach! Here’s what the class looks like:<br />
TrackingParser覆盖了解析标签开始和结束时调用的回调函数，用以给缓冲对象传递当前解析的索引。通常你不得不这样，除非你使用不被推荐的方法——深入调用堆栈去获取执行帧。这个类看起来是这样的：<br />
class TrackingParser(htmllib.HTMLParser):<br />
    &#8220;&#8221;"Try to keep accurate pointer of parsing location.&#8221;"&#8221;<br />
    def __init__(self, writer, *args):<br />
        htmllib.HTMLParser.__init__(self, *args)<br />
        self.writer = writer<br />
    def parse_starttag(self, i):<br />
        index = htmllib.HTMLParser.parse_starttag(self, i)<br />
        self.writer.index = index<br />
        return index<br />
    def parse_endtag(self, i):<br />
        self.writer.index = i<br />
        return htmllib.HTMLParser.parse_endtag(self, i)<br />
The LineWriter class does the bulk of the work when called by the default formatter. If you have any improvements or changes to make, most likely they’ll go here. This is where we’ll put our machine learning code in later. But you can keep the implementation rather simple and still get good results. Here’s the simplest possible code:<br />
LinWriter的大部分工作都通过调用formatter来完成。如果你要改进或者修改程序，大部分时候其实就是在修改它。我们将在后面讲述怎么为它加上机器学习代码。但你也可以保持它的简单实现，仍然可以得到一个好结果。具体的代码如下：<br />
class Paragraph:<br />
    def __init__(self):<br />
        self.text = &#8221;<br />
        self.bytes = 0<br />
        self.density = 0.0<br />
class LineWriter(formatter.AbstractWriter):<br />
    def __init__(self, *args):<br />
        self.last_index = 0<br />
        self.lines = [Paragraph()]<br />
        formatter.AbstractWriter.__init__(self)<br />
    def send_flowing_data(self, data):<br />
        # Work out the length of this text chunk.<br />
        t = len(data)<br />
        # We&#8217;ve parsed more text, so increment index.<br />
        self.index += t<br />
        # Calculate the number of bytes since last time.<br />
        b = self.index - self.last_index<br />
        self.last_index = self.index<br />
        # Accumulate this information in current line.<br />
        l = self.lines[-1]<br />
        l.text += data<br />
        l.bytes += b<br />
    def send_paragraph(self, blankline):<br />
        &#8220;&#8221;"Create a new paragraph if necessary.&#8221;"&#8221;<br />
        if self.lines[-1].text == &#8221;:<br />
            return<br />
        self.lines[-1].text += &#8216;n&#8217; * (blankline+1)<br />
        self.lines[-1].bytes += 2 * (blankline+1)<br />
        self.lines.append(Writer.Paragraph())<br />
    def send_literal_data(self, data):<br />
        self.send_flowing_data(data)<br />
    def send_line_break(self):<br />
        self.send_paragraph(0)<br />
This code doesn’t do any outputting yet, it just gathers the data. We now have a bunch of paragraphs in an array, we know their length, and we know roughly how many bytes of HTML were necessary to create them. Let’s see what emerge from our statistics.<br />
这里代码还没有做输出部分，它只是聚合数据。现在我们有一系列的文字段（用数组保存），以及它们的长度和生成它们所需要的HTML的大概字节数。现在让我们来看看统计学带来了什么。<br />
Examining the Data<br />
数据分析<br />
Luckily, there are some patterns in the data. In the raw output below, you’ll notice there are definite spikes in the number of HTML bytes required to encode lines of text, notably around the title, both sidebars, headers and footers.<br />
幸运的是，数据里总是存在一些模式。从下面的原始输出你可以发现有些文本需要大量的HTML来编码，特别是标题、侧边栏、页眉和页脚。</p>
<p>While the number of HTML bytes spikes in places, it remains below average for quite a few lines. On these lines, the text output is rather high. Calculating the density of text to HTML bytes gives us a better understanding of this relationship.<br />
虽然HTML字节数的峰值多次出现，但大部分仍然低于平均值；我们也可以看到在大部分低HTML字节数的字段中，文本输出却相当高。通过计算文本与HTML字节数的比率（即密度）可以让我们更容易明白它们之间的关系：</p>
<p>The patterns are more obvious in this density value, so it gives us something concrete to work with.<br />
密度值图更加清晰地表达了正文的密度更高，这是我们的工作的事实依据。<br />
Filtering the Lines<br />
过滤文本行<br />
The simplest way we can filter lines now is by comparing the density to a fixed threshold, such as 50% or the average density. Finishing the LineWriter class:<br />
过滤文本行的最简单方法是通过与一个阈值（如50%或者平均值）比较密度值。下面来完成LineWriter类：<br />
    def compute_density(self):<br />
        &#8220;&#8221;"Calculate the density for each line, and the average.&#8221;"&#8221;<br />
        total = 0.0<br />
        for l in self.lines:<br />
            l.density = len(l.text) / float(l.bytes)<br />
            total += l.density<br />
        # Store for optional use by the neural network.<br />
        self.average = total / float(len(self.lines))<br />
    def output(self):<br />
        &#8220;&#8221;"Return a string with the useless lines filtered out.&#8221;"&#8221;<br />
        self.compute_density()<br />
        output = StringIO.StringIO()<br />
        for l in self.lines:<br />
            # Check density against threshold.<br />
            # Custom filter extensions go here.<br />
           if l.density &gt; 0.5:<br />
                output.write(l.text)<br />
        return output.getvalue()<br />
This rough filter typically gets most of the lines right. All the headers, footers and sidebars text is usually stripped as long as it’s not too long. However, if there are long copyright notices, comments, or descriptions of other stories, then those are output too. Also, if there are short lines around inline graphics or adverts within the text, these are not output.<br />
这个粗糙的过滤器能够获取大部分正确的文本行。只要页眉、页脚和侧边栏文本并不非常长，那么所有的这些都会被剔除。然而，它仍然会输出比较长的版本声明、注释和对其它故事的概述；在图片和广告周边的比较短小的文本，却被过滤掉了。<br />
To fix this, we need a more complex filtering heuristic. But instead of spending days working out the logic manually, we’ll just grab loads of information about each line and use machine learning to find patterns for us.<br />
要解决这个问题，我们需要更复杂些的启发式过滤器。为了节省手工计算需要花费的无数时间，我们将利用机器学习来处理每一文本行的信息，以找出对我们有用的模式。<br />
Supervised Machine Learning<br />
监督式机器学习<br />
Here’s an example of an interface for tagging lines of text as content or not:<br />
这是一个标识文本行是否为正文的接口界面：</p>
<p>The idea of supervised learning is to provide examples for an algorithm to learn from. In our case, we give it a set documents that were tagged by humans, so we know which line must be output and which line must be filtered out. For this we’ll use a simple neural network known as the perceptron. It takes floating point inputs and filters the information through weighted connections between “neurons” and outputs another floating point number. Roughly speaking, the number of neurons and layers affects the ability to approximate functions precisely; we’ll use both single-layer perceptrons (SLP) and multi-layer perceptrons (MLP) for prototyping.<br />
所谓的监督式学习就是为算法提供学习的例子。在这个案例中，我们给定一系列已经由人标识好的文档——我们知道哪一行必须输出或者过滤掉。我们用使用一个简单的神经网络作为感知器，它接受浮点输入并通过“神经元”间的加权连接过滤信息，然后输后另一个浮点数。大体来说，神经元数量和层数将影响获取最优解的能力。我们的原型将分别使用单层感知器（SLP）和多层感知器（MLP）模型。<br />
To get the neural network to learn, we need to gather some data. This is where the earlier LineWriter.output() function comes in handy; it gives us a central point to process all the lines at once, and make a global decision which lines to output. Starting with intuition and experimenting a bit, we discover that the following data is useful to decide how to filter a line:<br />
我们需要找些数据来供机器学习。之前的LineWriter.output()函数正好派上用场，它使我们能够一次处理所有文本行并作出决定哪些文本行应该输出的全局结策。从直觉和经验中我们发现下面的几条原则可用于决定如何过滤文本行：<br />
Density of the current line.<br />
当前行的密度<br />
Number of HTML bytes of the line.<br />
当前行的HTML字节数<br />
Length of output text for this line.<br />
当前行的输出文本长度<br />
These three values for the previous line,<br />
前一行的这三个值<br />
… and the same for the next line.<br />
后一行的这三个值<br />
For the implementation, we’ll be using Python to interface with FANN, the Fast Artificial Neural Network Library. The essence of the learning code goes like this:<br />
我们可以利用FANN的Python接口来实现，FANN是Fast Artificial Neural NetWork库的简称。基本的学习代码如下：<br />
from pyfann import fann, libfann<br />
# This creates a new single-layer perceptron with 1 output and 3 inputs.<br />
obj = libfann.fann_create_standard_array(2, (3, 1))<br />
ann = fann.fann_class(obj)<br />
# Load the data we described above.<br />
patterns = fann.read_train_from_file(&#8217;training.txt&#8217;)<br />
ann.train_on_data(patterns, 1000, 1, 0.0)<br />
# Then test it with different data.<br />
for datin, datout in validation_data:<br />
    result = ann.run(datin)<br />
    print &#8216;Got:&#8217;, result, &#8216; Expected:&#8217;, datout<br />
Trying out different data and different network structures is a rather mechanical process. Don’t have too many neurons or you may train too well for the set of documents you have (overfitting), and conversely try to have enough to solve the problem well. Here are the results, varying the number of lines used (1L-3L) and the number of attributes per line (1A-3A):<br />
尝试不同的数据和不同的网络结构是比较机械的过程。不要使用太多的神经元和使用太好的文本集合来训练（过拟合），相反地应当尝试解决足够多的问题。使用不同的行数（1L-3L）和每一行不同的属性（1A-3A）得到的结果如下：</p>
<p>The interesting thing to note is that 0.5 is already a pretty good guess at a fixed threshold (see first set of columns). The learning algorithm cannot find much better solution for comparing the density alone (1 Attribute in the second column). With 3 Attributes, the next SLP does better overall, though it gets more false negatives. Using multiple lines also increases the performance of the single layer perceptron (fourth set of columns). And finally, using a more complex neural network structure works best overall — making 80% less errors in filtering the lines.<br />
有趣的是作为一个猜测的固定阈值，0.5的表现非常好（看第一列）。学习算法并不能仅仅通过比较密度来找出更佳的方案（第二列）。使用三个属性，下一个SLP比前两都好，但它引入了更多的假阴性。使用多行文本也增进了性能（第四列），最后使用更复杂的神经网络结构比所有的结果都要更好，在文本行过滤中减少了80%错误。<br />
Note that you can tweak how the error is calculated if you want to punish false positives more than false negatives.<br />
注意：你能够调整误差计算，以给假阳性比假阴性更多的惩罚（宁缺勿滥的策略）。<br />
Conclusion<br />
结论<br />
Extracting text from arbitrary HTML files doesn’t necessarily require scraping the file with custom code. You can use statistics to get pretty amazing results, and machine learning to get even better. By tweaking the threshold, you can avoid the worst false positive that pollute your text output. But it’s not so bad in practice; where the neural network makes mistakes, even humans have trouble classifying those lines as “content” or not.<br />
从任意HTML文件中抽取正文无需编写针对文件编写特定的抽取程序，使用统计学就能获得令人惊讶的效果，而机器学习能让它做得更好。通过调整阈值，你能够避免出现鱼目混珠的情况。它的表现相当好，因为在神经网络判断错误的地方，甚至人类也难以判定它是否为正文。<br />
Now all you have to figure out is what to do with that clean text content!<br />
现在需要思考的问题是用这些“干净”的正文内容做什么应用好呢？<br />
<h3>最多留言日志</h3>
<ul class="related_post">
<li>2008年6月26日 &#8212; <a href="http://www.apc001.com/2008-06/122/rent-compared-the-erfang-dong-going-nb/" title="租房,比较不顺..nb的二房东">租房,比较不顺..nb的二房东 (6)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/7/has-done-a-dream-last-night-khan-a-dream-about-my-wife-pregnant/" title="昨晚做了梦了．．汗下，梦到老婆怀孕了">昨晚做了梦了．．汗下，梦到老婆怀孕了 (5)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/3/shanghais-sister-in-the-photo-as-kazakhstan-idle-boredom/" title="在上海的姐家照的相片哈，闲着无聊">在上海的姐家照的相片哈，闲着无聊 (5)</a></li>
<li>2008年6月23日 &#8212; <a href="http://www.apc001.com/2008-06/114/han-a-dream/" title="寒，又做梦了．．">寒，又做梦了．． (4)</a></li>
<li>2008年6月27日 &#8212; <a href="http://www.apc001.com/2008-06/126/2008-college-entrance-examination-shocked-btoaessay-the-bastard/" title="2008高考震撼BT作文出炉！海王八&#8230;.">2008高考震撼BT作文出炉！海王八&#8230;. (3)</a></li>
<li>2008年7月6日 &#8212; <a href="http://www.apc001.com/2008-07/152/76-a-visit-hangzhou-zaozui-zaozui-zaozui-zaozui/" title="7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230;">7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230; (2)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/30/ie%e7%bc%96%e7%a8%8b%e4%b9%8b%e2%80%9c%e5%91%bd%e4%bb%a4%e6%a0%87%e8%af%86%e7%ac%a6%e2%80%9dcommand-identifiers%e4%bb%8b%e7%bb%8d/" title="IE编程之“命令标识符”(Command Identifiers)介绍">IE编程之“命令标识符”(Command Identifiers)介绍 (1)</a></li>
<li>2008年6月30日 &#8212; <a href="http://www.apc001.com/2008-06/127/internet-a-new-home-can-finally-borrowed-cable/" title="新家终于可以上网了&#8230;借来的有线通">新家终于可以上网了&#8230;借来的有线通 (1)</a></li>
<li>2008年7月15日 &#8212; <a href="http://www.apc001.com/2008-07/167/just-back-from-the-airport-haolei/" title="刚从机场归来..好累">刚从机场归来..好累 (1)</a></li>
<li>2008年8月9日 &#8212; <a href="http://www.apc001.com/2008-08/184/china-made-animated-blockbusters-hoist-her-astonishing-insider-comedy/" title="国产动画巨片葫芦娃惊人内幕(爆笑&#8230;)">国产动画巨片葫芦娃惊人内幕(爆笑&#8230;) (1)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=248&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_248" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-10/248/the-easy-way-to-extract-useful-text-from-arbitrary-html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>经典原创行业站模板_界面清新,已整理，可以下载！</title>
		<link>http://www.apc001.com/2008-10/246/%e7%bb%8f%e5%85%b8%e5%8e%9f%e5%88%9b%e8%a1%8c%e4%b8%9a%e7%ab%99%e6%a8%a1%e6%9d%bf_%e7%95%8c%e9%9d%a2%e6%b8%85%e6%96%b0%e5%b7%b2%e6%95%b4%e7%90%86%ef%bc%8c%e5%8f%af%e4%bb%a5%e4%b8%8b%e8%bd%bd%ef%bc%81/</link>
		<comments>http://www.apc001.com/2008-10/246/%e7%bb%8f%e5%85%b8%e5%8e%9f%e5%88%9b%e8%a1%8c%e4%b8%9a%e7%ab%99%e6%a8%a1%e6%9d%bf_%e7%95%8c%e9%9d%a2%e6%b8%85%e6%96%b0%e5%b7%b2%e6%95%b4%e7%90%86%ef%bc%8c%e5%8f%af%e4%bb%a5%e4%b8%8b%e8%bd%bd%ef%bc%81/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 02:01:37 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[生活点滴]]></category>

		<category><![CDATA[dede 模板]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=246</guid>
		<description><![CDATA[ 先和被骗进来的朋友道个歉。。。标题不吸引人，ＡＤ没效果呀。
http://77521.cn 这个站的，是帮朋友做的。
做好了又要帮忙。。。- -!!  想办法ＡＤ唉。
不太好意思，光ＡＤ会被骂到祖宗三代... ]]></description>
			<content:encoded><![CDATA[<p><img src="http://bbs.dedecms.com/image/post/smile/ych/yociexpress09.gif" alt="" /> 先和被骗进来的朋友道个歉。。。标题不吸引人，ＡＤ没效果呀。</p>
<p><a href="http://bbs.dedecms.com/goto.php?url=http%3A%2F%2F77521.cn" target="_blank"><span style="color: #2f5fa1;">http://77521.cn</span></a> 这个站的，是帮朋友做的。</p>
<p>做好了又要帮忙。。。- -!!  想办法ＡＤ唉。</p>
<p>不太好意思，光ＡＤ会被骂到祖宗三代的。。。。</p>
<p>换个方法。发布下风格吧。漂亮大气不敢保证，但１００％是原创的。（因为现在table的板子很少见吧，没地方偷去）</p>
<p>不是专业美工，所以不懂，要是真有人能看中这破板子。。，就顺手帮偶顶一下吧。。。</p>
<p>满１０个人喜欢，我就整理发布出来。随时可以。。。如果人数不够。。特别喜欢的朋友，也可以单独Ｍ我。<br />
<img src="http://bbs.dedecms.com/image/post/smile/ych/yociexp46.gif" alt="" /></p>
<p>说明一下，是table做的，所以要求严格的朋友，估计都不用考虑了。</p>
<p><img src="http://bbs.dedecms.com/image/post/smile/ych/yociexp49.gif" alt="" /> <img src="http://bbs.dedecms.com/image/post/smile/ych/yociexp54.gif" alt="" /></p>
<p> </p>
<p>下载地址:(打开下载）<br />
<a href="http://bbs.dedecms.com/read.php?tid=95681&amp;page=1&amp;toread=1">http://bbs.dedecms.com/read.php?tid=95681&amp;page=1&amp;toread=1</a><br />
<h3>最多留言日志</h3>
<ul class="related_post">
<li>2008年6月26日 &#8212; <a href="http://www.apc001.com/2008-06/122/rent-compared-the-erfang-dong-going-nb/" title="租房,比较不顺..nb的二房东">租房,比较不顺..nb的二房东 (6)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/7/has-done-a-dream-last-night-khan-a-dream-about-my-wife-pregnant/" title="昨晚做了梦了．．汗下，梦到老婆怀孕了">昨晚做了梦了．．汗下，梦到老婆怀孕了 (5)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/3/shanghais-sister-in-the-photo-as-kazakhstan-idle-boredom/" title="在上海的姐家照的相片哈，闲着无聊">在上海的姐家照的相片哈，闲着无聊 (5)</a></li>
<li>2008年6月23日 &#8212; <a href="http://www.apc001.com/2008-06/114/han-a-dream/" title="寒，又做梦了．．">寒，又做梦了．． (4)</a></li>
<li>2008年6月27日 &#8212; <a href="http://www.apc001.com/2008-06/126/2008-college-entrance-examination-shocked-btoaessay-the-bastard/" title="2008高考震撼BT作文出炉！海王八&#8230;.">2008高考震撼BT作文出炉！海王八&#8230;. (3)</a></li>
<li>2008年7月6日 &#8212; <a href="http://www.apc001.com/2008-07/152/76-a-visit-hangzhou-zaozui-zaozui-zaozui-zaozui/" title="7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230;">7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230; (2)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/30/ie%e7%bc%96%e7%a8%8b%e4%b9%8b%e2%80%9c%e5%91%bd%e4%bb%a4%e6%a0%87%e8%af%86%e7%ac%a6%e2%80%9dcommand-identifiers%e4%bb%8b%e7%bb%8d/" title="IE编程之“命令标识符”(Command Identifiers)介绍">IE编程之“命令标识符”(Command Identifiers)介绍 (1)</a></li>
<li>2008年6月30日 &#8212; <a href="http://www.apc001.com/2008-06/127/internet-a-new-home-can-finally-borrowed-cable/" title="新家终于可以上网了&#8230;借来的有线通">新家终于可以上网了&#8230;借来的有线通 (1)</a></li>
<li>2008年7月15日 &#8212; <a href="http://www.apc001.com/2008-07/167/just-back-from-the-airport-haolei/" title="刚从机场归来..好累">刚从机场归来..好累 (1)</a></li>
<li>2008年8月9日 &#8212; <a href="http://www.apc001.com/2008-08/184/china-made-animated-blockbusters-hoist-her-astonishing-insider-comedy/" title="国产动画巨片葫芦娃惊人内幕(爆笑&#8230;)">国产动画巨片葫芦娃惊人内幕(爆笑&#8230;) (1)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=246&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_246" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-10/246/%e7%bb%8f%e5%85%b8%e5%8e%9f%e5%88%9b%e8%a1%8c%e4%b8%9a%e7%ab%99%e6%a8%a1%e6%9d%bf_%e7%95%8c%e9%9d%a2%e6%b8%85%e6%96%b0%e5%b7%b2%e6%95%b4%e7%90%86%ef%bc%8c%e5%8f%af%e4%bb%a5%e4%b8%8b%e8%bd%bd%ef%bc%81/feed/</wfw:commentRss>
		</item>
		<item>
		<title>用好DEDE的防采集串混淆给自己增加额外的外链</title>
		<link>http://www.apc001.com/2008-10/243/dede-good-use-of-the-anti-acquisition-to-confuse-his-own-string-of-additional-foreign-chain/</link>
		<comments>http://www.apc001.com/2008-10/243/dede-good-use-of-the-anti-acquisition-to-confuse-his-own-string-of-additional-foreign-chain/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 10:09:47 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[建站心得]]></category>

		<category><![CDATA[生活点滴]]></category>

		<category><![CDATA[dede 防采集 混淆 外链]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=243</guid>
		<description><![CDATA[用过DEDE的朋友们应该都知道，DEDE有一项防采集串混淆的功能.
　　具体位置在后台管理-&#62;频道管理-&#62;防采集串混淆 &#62;&#62;&#62;
        默认的原来只是几个 % &#38;^T8YN(*$Y(V*u (vu4 0 这样的... ]]></description>
			<content:encoded><![CDATA[<p>用过DEDE的朋友们应该都知道，DEDE有一项防采集串混淆的功能.</p>
<p>　　具体位置在后台管理-&gt;频道管理-&gt;防采集串混淆 &gt;&gt;&gt;</p>
<p>        默认的原来只是几个 % &amp;^T8YN(*$Y(V*u (vu4 0 这样的乱码字符．目地也很简单，如果碰到有人采集，那采过去的将会是夹着N多乱码字符的文章内容．具体原理就不说了．</p>
<p>        但是如果把这些行混淆字符串改造一下，换成我们自己的网址呢？</p>
<p>　　相信会有人提出疑问：</p>
<p>　　1.如果别人采集的时候去掉所有的链接了怎么办?</p>
<p>　　(他只能去掉所有的链接，但是链接的文字还是会保留的&#8230;比如你的网址，或关键字)</p>
<p>　　2.如果别人用火车头采集的时候，把内容里我的域名部分全部替换成他的米怎么办?</p>
<p>　　(你多弄一些网址的样式他不就替换不完了?呵呵)</p>
<p>　　请看这一页：</p>
<p>　　http://77521.cn/html/huiyizhanlan/200810/13-143164.html</p>
<p>　　这是给一个朋友做的，他不想别人采集，但是又不能用会员才能查看的功能.影响收录.所以我帮他想的这个办法.打开页面后，按CTRL+A，全选&#8230;这时候正文会是蓝色背景，白色的字。对吧?可是细看一下，还有若干个不一样的。却是白底蓝字?这是为何?鼠标放到这些&#8221;白底蓝字&#8221;上面..鼠标变成了手指的形状.说明这些都是链接!这些字有的是这个网站的关键字，有些直接就是搜索。呵。不要说这个可以轻易的替换掉啊.马虎的人这样想就错了，因为所有的链接并不是一样的.比如，某些链接，鼠标放上去后：看左下角状态栏，显示的并不一样：</p>
<p>　　第一个链接-环保网：</p>
<p>        http://www.77521.cn/html/huiyizhanlan/200810/13-143164.html##<br />
        熟悉html的朋友会看得出来，这根本就和没链接一样，因为显示的是 ## 锚点链接 ，但是查看源码，你可以看到：&lt;span class=&#8217;Ita310&#8242;&gt;&lt;a href=&#8221;##&#8221; _fcksavedurl=&#8221;"##&#8221;" _fcksavedurl=&#8221;"##&#8221;" _fcksavedurl=&#8221;"##&#8221;" _fcksavedurl=&#8221;"##&#8221;" onclick=&#8221;location.href=&#8217;http://77521.cn/plus/search.php?keyword=环保网&amp;searchtype=titlekeyword&#8217;;&#8221; style=&#8221;color:white;&#8221;&gt;环保网&lt;/a&gt;&lt;/span&gt;<br />
却是这样的．看起来没链接，但你点击一下，却会转到77521.cn这个网站的搜索页面．^_^</p>
<p>        又有朋友要问题了，那替换掉所有的77521.cn 不就可以让他失效了？</p>
<p>        那我们来看下面的链接．．有个链接是：环球水网<br />
        http://%37%37%35%32%31%2e%63%6e/plus/search.php?keyword=环球水网&amp;searchtype=titlekeyword</p>
<p>        这个的链接却是这样的。这样你搜域名，怎么可能会搜得到？<br />
        有人又说，那我把这个也搜一下．．．可是这个米有77521.cn -&gt;8位长度．我帮他做的是，每一个字符，或每2-5个字符，我都变了NNN种组合．像  http://%377521.cn 这样最简单．我只把第一个 7 编码了．你哪里去搜呢．后面的若干位，我都给编码，不一定是哪个和哪个的组合．这样一算，组合太多了．．．</p>
<p>        还有若干种样子．</p>
<p>        但是这个要大家自己想去了．现在我提供我用的几种方法。</p>
<p>        &lt;?php<br />
        //随机字符串，请在&#8221;#,&#8221;后填上你网站的广告语或网址<br />
        #start#&#8212;&#8212;本行不允许更改</p>
<p>        #,&lt;a href=&#8221;http://%37%37%35%32%31.cn/plus/search.php?keyword=中国环保网&amp;searchtype=titlekeyword&#8221; style=&#8221;color:white;&#8221;&gt;中国环保网   &lt;/a&gt;   &#8212; 最普通的链接＋编码</p>
<p>        #,&lt;a href=&#8221;http://%37%37%35%32%31%2e%63%6e/plus/search.php?keyword=环球水网&amp;searchtype=titlekeyword&#8221; style=&#8221;color:white;&#8221;&gt;环球水网&lt;/a&gt;   &#8212; 网址全编码．．上面的.cn没有编码</p>
<p>        #,&lt;a href=&#8221;http://%377521.cn/plus/search.php?keyword=污水综合排放标准&amp;searchtype=titlekeyword&#8221; style=&#8221;color:white;&#8221;&gt;污水综合排放标准&lt;/a&gt;    &#8212;-只编码了一个&#8221; 7 &#8221; （当然后面随便编哪个都行的）</p>
<p>        #,&lt;a href=&#8221;http://%377%3521.cn/plus/search.php?keyword=环境空气质量标准&amp;searchtype=titlekeyword&#8221; style=&#8221;color:white;&#8221;&gt;环境空气质量标准&lt;/a&gt; &#8212;  编码第一个 7 和 第三个 5</p>
<p>        #,&lt;a href=&#8221;##&#8221; onclick=&#8221;location.href=&#8217;http://77521.cn/plus/search.php?keyword=生活污水排放标准&amp;searchtype=titlekeyword&#8217;;&#8221; style=&#8221;color:white;&#8221;&gt;生活污水排放标准&lt;/a&gt;   &#8212; 这个没特别的，只是给正则替换增加一点点的难度而已</p>
<p>        #,&lt;div onmouseout=&#8221;if(location.href.indexOf(&#8217;21.cn&#8217;)==-1)location.href=&#8217;http://775%32%31%2e%63%6e/plus/search.php?keyword=国家污染物排放标准&amp;searchtype=titlekeyword&#8217;;&#8221; style=&#8221;color:white;&#8221;&gt;国家污染物排放标准&lt;/div&gt;    &#8212; 有不少朋友采集都不过滤div的，因为要保持格式的完整．所以这个利用div + 编码来实现&#8230;这个串里面没有77521.cn 这个完整的域名字符串,又没有 &lt;a 标签．．所以普通的删除替换，是没法起作用的．</p>
<p>        就说这几个吧．</p>
<p>        像  &lt;span   &lt;font &lt;img  这些都可以用的．特别是  &lt;img 一般人都不会屏弊的．大有用处哦！</p>
<p>        别忘了 img 有个  onerror 事件，用好了会很不错</p>
<p>        附带编码网址: <a style="target: _blank;" href="http://tool.admin5.com/" target="_blank">http://tool.admin5.com</a>   在最下面。Hex编码。</p>
<p>        其实讲了半天无非就是让人家采集完自己的文章，却保留自己的一点版权。我觉得这个如果不影响自己版面布局的话，保留一下人家的链接又有何妨。再说内页吗，一共能有几个PR，放上人家链接又不会分走你多少PR分。大方一点吧。从用户体验来说也会方便用户。。一点就开了，直接查看示例网站。多好！话说如果你实在敞不开。。不想分享PR，那也不用去掉人家链接，可以用替换功能：<br />
        替换  &#8220;&lt;a &#8221; （注意a后面有一个空格）。。替换成 &#8220;&lt;a rel=&#8217;ex&#8230;..   nofollow&#8217; &#8220;  这个。相信一些人知道，这个nofollow就是阻止投票PR分的。</p>
<p>        好了，差不多都说完了．^_^ 吃人的嘴短，没办法上来写个小软文．要是语无伦次看不懂，欢迎大家留言交流．</p>
<p>        Google Adsense 2号群：12863364   (不是我的群,网络是毒药的) 感谢<a style="target: _blank;" href="http://www.77521.cn/" target="_blank">www.77521.cn</a>  恶猫友情供稿。</p>
<p>PS&#8230;.原创发于站长网.转回自己的blog一下<br />
<h3>最多留言日志</h3>
<ul class="related_post">
<li>2008年6月26日 &#8212; <a href="http://www.apc001.com/2008-06/122/rent-compared-the-erfang-dong-going-nb/" title="租房,比较不顺..nb的二房东">租房,比较不顺..nb的二房东 (6)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/7/has-done-a-dream-last-night-khan-a-dream-about-my-wife-pregnant/" title="昨晚做了梦了．．汗下，梦到老婆怀孕了">昨晚做了梦了．．汗下，梦到老婆怀孕了 (5)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/3/shanghais-sister-in-the-photo-as-kazakhstan-idle-boredom/" title="在上海的姐家照的相片哈，闲着无聊">在上海的姐家照的相片哈，闲着无聊 (5)</a></li>
<li>2008年6月23日 &#8212; <a href="http://www.apc001.com/2008-06/114/han-a-dream/" title="寒，又做梦了．．">寒，又做梦了．． (4)</a></li>
<li>2008年6月27日 &#8212; <a href="http://www.apc001.com/2008-06/126/2008-college-entrance-examination-shocked-btoaessay-the-bastard/" title="2008高考震撼BT作文出炉！海王八&#8230;.">2008高考震撼BT作文出炉！海王八&#8230;. (3)</a></li>
<li>2008年7月6日 &#8212; <a href="http://www.apc001.com/2008-07/152/76-a-visit-hangzhou-zaozui-zaozui-zaozui-zaozui/" title="7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230;">7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230; (2)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/30/ie%e7%bc%96%e7%a8%8b%e4%b9%8b%e2%80%9c%e5%91%bd%e4%bb%a4%e6%a0%87%e8%af%86%e7%ac%a6%e2%80%9dcommand-identifiers%e4%bb%8b%e7%bb%8d/" title="IE编程之“命令标识符”(Command Identifiers)介绍">IE编程之“命令标识符”(Command Identifiers)介绍 (1)</a></li>
<li>2008年6月30日 &#8212; <a href="http://www.apc001.com/2008-06/127/internet-a-new-home-can-finally-borrowed-cable/" title="新家终于可以上网了&#8230;借来的有线通">新家终于可以上网了&#8230;借来的有线通 (1)</a></li>
<li>2008年7月15日 &#8212; <a href="http://www.apc001.com/2008-07/167/just-back-from-the-airport-haolei/" title="刚从机场归来..好累">刚从机场归来..好累 (1)</a></li>
<li>2008年8月9日 &#8212; <a href="http://www.apc001.com/2008-08/184/china-made-animated-blockbusters-hoist-her-astonishing-insider-comedy/" title="国产动画巨片葫芦娃惊人内幕(爆笑&#8230;)">国产动画巨片葫芦娃惊人内幕(爆笑&#8230;) (1)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=243&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_243" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-10/243/dede-good-use-of-the-anti-acquisition-to-confuse-his-own-string-of-additional-foreign-chain/feed/</wfw:commentRss>
		</item>
		<item>
		<title>做了个真JB爽的梦．似乎还有外星人的嫌疑，他们托梦给我？哈哈</title>
		<link>http://www.apc001.com/2008-10/240/jb-has-done-a-really-cool-dream-there-seems-to-be-the-aliens-suspected-they-tuomeng-to-me-ha-ha/</link>
		<comments>http://www.apc001.com/2008-10/240/jb-has-done-a-really-cool-dream-there-seems-to-be-the-aliens-suspected-they-tuomeng-to-me-ha-ha/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 01:24:07 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[生活点滴]]></category>

		<category><![CDATA[梦 麦田圈]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=240</guid>
		<description><![CDATA[在梦里上网。。无意间打开一个网页，。。。。
当时感觉好像是和爱情有关的一个，画面是一个大山的山顶，很小的一个地方，我用键盘控制一个小人儿在山顶，面朝屏幕，玩过ＲＰＧ游戏的... ]]></description>
			<content:encoded><![CDATA[<p>在梦里上网。。无意间打开一个网页，。。。。</p>
<p>当时感觉好像是和爱情有关的一个，画面是一个大山的山顶，很小的一个地方，我用键盘控制一个小人儿在山顶，面朝屏幕，玩过ＲＰＧ游戏的应该都知道，有些游戏像风之幻想，人物要走的时候，脚下会出现一些格格，只能走到这些格格所标示的范围内。。。。那游戏网页就是这样，不过是像波纹一样。小人儿的面前都是这样的波纹标示。。。我要控制这个小人儿走到山的最边缘（最危险的地方），好像还要说话，什么一览众山小之类的。。。忘了，但是控制了两下之后。。。。</p>
<p>我让小人儿转了个身，背向屏幕。。</p>
<p>突然有个想法，这游戏咋做的。。。我让这小人儿一直往边上走，我让它掉下去！！！！</p>
<p>结果这小人真的掉下去了。。。</p>
<p>像是２座山峰之间，小人儿不掉的下落，有种腾云驾雾的感觉。。哈哈。</p>
<p>因为是游戏么，纯粹是恶搞的心理，掉落过程中，我控制着小人儿左右飘动。。。。</p>
<p>这时画面，左右都是山，小人儿就沿着右边山一直向下掉。。８９度的坡度。。。</p>
<p>突然之间，我感觉自己融入进去了，就好像这里面的人是我一样。。</p>
<p>（经常做梦的朋友应该有这感觉的，有时候明明是第三者在旁观，却突然变成主人公的感觉）</p>
<p>这时感觉就不一样了，试想。你要是在悬崖边上一直掉。。。你能不害怕么。（但我没害怕啥，梦里么，不至于现实那样害怕，但还是有一点点。）</p>
<p>这时我的感觉就更清晰了，这明明是蜀山传里面，那样的大山。都是悬浮在空中的大山。。。。</p>
<p>哗，我这样的掉落法，不迟早被摔死！？！？！？！？！？</p>
<p>不过画面还是很爽的，就像跳伞一样的感觉，很真实，一直向下飘落。</p>
<p>我则一直沿着山边上一直飘啊飘啊。。。。路遇无数的飘在空中的小石块。。。都给碰的粉碎。。</p>
<p>过了一会儿，感觉地面的景物越来越大。。。。马上就要着路了。。。。</p>
<p>（这里还是有点像跳伞的感觉哈哈。。。。是斜着降落到地上的。不是直直落地，估计那样就成肉饼了）</p>
<p>一落地，发现一点没受伤。。。。一抬头。。挖，全都是奇形怪状的牛，羊。。。</p>
<p>再一看地上，传说中的麦田圈图案。。不过是简单的。（也许是别的图案，但脑海中直接想到的就是麦田圈）</p>
<p>有些月亮，星星什么的图。终合起来的。。到处都是，（地上全是这样的图，很大的图，一个星星就占好几个人站的地方）</p>
<p>想完麦田圈，我马上想；我靠，不会是到了外星球吧？咋全ＪＢ都是这些东西。。。。。</p>
<p>吓得我赶紧爬起来就跑。。。。。。。。。（）＃—％）！·＊％）！·（＊％）·！％＊·）</p>
<p>（中间部分失忆）</p>
<p>跑进一个山洞还是车间。。唉，看到有人在工作。电焊的电焊，切割的切割，锯木头的也有。</p>
<p>我站在边上看了半天，居然对一个人说：给我找份工作吧。　－－！！！！！暴汗</p>
<p>居然让我锯木头。。。。。唉，一不忿就想了。想想这梦太好玩了。</p>
<p>描述的太差劲了，完全说不出当时的感觉。</p>
<p>集跳伞＋跳崖＋古装武侠人物＋外星生物＋麦田圈＋锯木头(&#8211;!!) </p>
<p>不过当时在空中左飘右飘的感觉，真不错，梦里体验了一把身带武功，跳崖的感觉。</p>
<p>（小人儿跳了崖，才忽然变成自己跳崖了，要不然我才不跳呢！）<br />
<h3>最多留言日志</h3>
<ul class="related_post">
<li>2008年6月26日 &#8212; <a href="http://www.apc001.com/2008-06/122/rent-compared-the-erfang-dong-going-nb/" title="租房,比较不顺..nb的二房东">租房,比较不顺..nb的二房东 (6)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/7/has-done-a-dream-last-night-khan-a-dream-about-my-wife-pregnant/" title="昨晚做了梦了．．汗下，梦到老婆怀孕了">昨晚做了梦了．．汗下，梦到老婆怀孕了 (5)</a></li>
<li>2008年6月20日 &#8212; <a href="http://www.apc001.com/2008-06/3/shanghais-sister-in-the-photo-as-kazakhstan-idle-boredom/" title="在上海的姐家照的相片哈，闲着无聊">在上海的姐家照的相片哈，闲着无聊 (5)</a></li>
<li>2008年6月23日 &#8212; <a href="http://www.apc001.com/2008-06/114/han-a-dream/" title="寒，又做梦了．．">寒，又做梦了．． (4)</a></li>
<li>2008年6月27日 &#8212; <a href="http://www.apc001.com/2008-06/126/2008-college-entrance-examination-shocked-btoaessay-the-bastard/" title="2008高考震撼BT作文出炉！海王八&#8230;.">2008高考震撼BT作文出炉！海王八&#8230;. (3)</a></li>
<li>2008年7月6日 &#8212; <a href="http://www.apc001.com/2008-07/152/76-a-visit-hangzhou-zaozui-zaozui-zaozui-zaozui/" title="7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230;">7.6杭州一游,遭罪+遭罪+遭罪+遭罪&#8230; (2)</a></li>
<li>2008年6月21日 &#8212; <a href="http://www.apc001.com/2008-06/30/ie%e7%bc%96%e7%a8%8b%e4%b9%8b%e2%80%9c%e5%91%bd%e4%bb%a4%e6%a0%87%e8%af%86%e7%ac%a6%e2%80%9dcommand-identifiers%e4%bb%8b%e7%bb%8d/" title="IE编程之“命令标识符”(Command Identifiers)介绍">IE编程之“命令标识符”(Command Identifiers)介绍 (1)</a></li>
<li>2008年6月30日 &#8212; <a href="http://www.apc001.com/2008-06/127/internet-a-new-home-can-finally-borrowed-cable/" title="新家终于可以上网了&#8230;借来的有线通">新家终于可以上网了&#8230;借来的有线通 (1)</a></li>
<li>2008年7月15日 &#8212; <a href="http://www.apc001.com/2008-07/167/just-back-from-the-airport-haolei/" title="刚从机场归来..好累">刚从机场归来..好累 (1)</a></li>
<li>2008年8月9日 &#8212; <a href="http://www.apc001.com/2008-08/184/china-made-animated-blockbusters-hoist-her-astonishing-insider-comedy/" title="国产动画巨片葫芦娃惊人内幕(爆笑&#8230;)">国产动画巨片葫芦娃惊人内幕(爆笑&#8230;) (1)</a></li>
</ul>
<p class="akst_link"><a href="http://www.apc001.com/?p=240&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_240" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.apc001.com/2008-10/240/jb-has-done-a-really-cool-dream-there-seems-to-be-the-aliens-suspected-they-tuomeng-to-me-ha-ha/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to convert html file to image without using any third party tool in asp.net.</title>
		<link>http://www.apc001.com/2008-10/237/how-to-convert-html-file-to-image-without-using-any-third-party-tool-in-aspnet/</link>
		<comments>http://www.apc001.com/2008-10/237/how-to-convert-html-file-to-image-without-using-any-third-party-tool-in-aspnet/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 23:38:49 +0000</pubDate>
		<dc:creator>恶猫</dc:creator>
		
		<category><![CDATA[Program Life]]></category>

		<category><![CDATA[html to image]]></category>

		<guid isPermaLink="false">http://www.apc001.com/?p=237</guid>
		<description><![CDATA[hi sure you can do it in asp.net  i have done it few months back.see the code below.. in the IECapt.Start() method you can provide the url of html website to be captured .this is a opensource code i found somewhere where i have modified some of its part... ]]></description>
			<content:encoded><![CDATA[<p>hi sure you can do it in asp.net  i have done it few months back.see the code below.. in the IECapt.Start() method you can provide the url of html website to be captured .this is a opensource code i found somewhere where i have modified some of its parts to suit my requirement.compile it to a library and call it in your website.i hope it helps.</p>
<p>转载请注明:转自<a href="http://www.apc001.com">恶猫的博客http://www.apc001.com</a></p>
<pre class="coloredcode"><span class="kwd">using</span> System;
<span class="kwd">using</span> System.Drawing;
<span class="kwd">using</span> System.Drawing.Imaging;
<span class="kwd">using</span> System.Runtime.InteropServices;
<span class="kwd">using</span> System.Runtime.CompilerServices;
<span class="kwd">using</span> System.Windows.Forms;
<span class="kwd">using</span> AxSHDocVw; <span class="cmt">// Use `aximp %SystemRoot%\system32\shdocvw.dll`</span>
<span class="kwd">using</span> mshtml;    <span class="cmt">// Add "Microsoft.mshtml" (.NET)</span>

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"0000010F-0000-0000-C000-000000000046"</span>), ComConversionLoss]
<span class="kwd">public interface</span> IAdviseSink
{
    <span class="kwd">void</span> RemoteOnDataChange([In] <span class="kwd">ref</span> tagFORMATETC pformatetc, [In] IntPtr pStgmed);
    <span class="kwd">void</span> RemoteOnViewChange([In] <span class="kwd">uint</span> dwAspect, [In] <span class="kwd">int</span> lindex);
    <span class="kwd">void</span> RemoteOnRename([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmk);
    <span class="kwd">void</span> RemoteOnSave();
    <span class="kwd">void</span> RemoteOnClose();
}

[ComImport, Guid(<span class="st">"0000000E-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IBindCtx
{
    <span class="kwd">void</span> RegisterObjectBound([In, MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">object</span> punk);
    <span class="kwd">void</span> RevokeObjectBound([In, MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">object</span> punk);
    <span class="kwd">void</span> ReleaseBoundObjects();
    <span class="kwd">void</span> RemoteSetBindOptions([In] <span class="kwd">ref</span> tagBIND_OPTS2 pbindopts);
    <span class="kwd">void</span> RemoteGetBindOptions([In, Out] <span class="kwd">ref</span> tagBIND_OPTS2 pbindopts);
    <span class="kwd">void</span> GetRunningObjectTable([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IRunningObjectTable pprot);
    <span class="kwd">void</span> RegisterObjectParam([In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszKey, [In, MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">object</span> punk);
    <span class="kwd">void</span> GetObjectParam([In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszKey, [MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">out object</span> ppunk);
    <span class="kwd">void</span> EnumObjectParam([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumString ppenum);
    <span class="kwd">void</span> RevokeObjectParam([In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszKey);
}

[ComImport, Guid(<span class="st">"0000012A-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IContinue
{
    <span class="kwd">void</span> FContinue();
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"3050F3F0-98B5-11CF-BB82-00AA00BDCE0B"</span>)]
<span class="kwd">public interface</span> ICustomDoc
{
    <span class="kwd">void</span> SetUIHandler([In, MarshalAs(UnmanagedType.Interface)] IDocHostUIHandler pUIHandler);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), ComConversionLoss, Guid(<span class="st">"0000010E-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IDataObject
{
    <span class="kwd">void</span> RemoteGetData([In] <span class="kwd">ref</span> tagFORMATETC pformatetcIn, [Out] IntPtr pRemoteMedium);
    <span class="kwd">void</span> RemoteGetDataHere([In] <span class="kwd">ref</span> tagFORMATETC pformatetc, [In, Out] IntPtr pRemoteMedium);
    <span class="kwd">void</span> QueryGetData([In] <span class="kwd">ref</span> tagFORMATETC pformatetc);
    <span class="kwd">void</span> GetCanonicalFormatEtc([In] <span class="kwd">ref</span> tagFORMATETC pformatectIn, <span class="kwd">out</span> tagFORMATETC pformatetcOut);
    <span class="kwd">void</span> RemoteSetData([In] <span class="kwd">ref</span> tagFORMATETC pformatetc, [In] IntPtr pmedium, [In] <span class="kwd">int</span> fRelease);
    <span class="kwd">void</span> EnumFormatEtc([In] <span class="kwd">uint</span> dwDirection, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumFORMATETC ppenumFormatEtc);
    <span class="kwd">void</span> DAdvise([In] <span class="kwd">ref</span> tagFORMATETC pformatetc, [In] <span class="kwd">uint</span> advf, [In, MarshalAs(UnmanagedType.Interface)] IAdviseSink pAdvSink, <span class="kwd">out uint</span> pdwConnection);
    <span class="kwd">void</span> DUnadvise([In] <span class="kwd">uint</span> dwConnection);
    <span class="kwd">void</span> EnumDAdvise([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumSTATDATA ppenumAdvise);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"BD3F23C0-D43E-11CF-893B-00AA00BDCE1A"</span>), ComConversionLoss]
<span class="kwd">public interface</span> IDocHostUIHandler
{
    [PreserveSig]
    <span class="kwd">uint</span> ShowContextMenu([In] <span class="kwd">uint</span> dwID, [In] <span class="kwd">ref</span> tagPOINT ppt, [In, MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">object</span> pcmdtReserved, [In, MarshalAs(UnmanagedType.IDispatch)] <span class="kwd">object</span> pdispReserved);
    <span class="kwd">void</span> GetHostInfo([In, Out] <span class="kwd">ref</span> _DOCHOSTUIINFO pInfo);
    <span class="kwd">uint</span> ShowUI([In] <span class="kwd">uint</span> dwID, [In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceActiveObject pActiveObject, [In, MarshalAs(UnmanagedType.Interface)] IOleCommandTarget pCommandTarget, [In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceFrame pFrame, [In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceUIWindow pDoc);
    <span class="kwd">void</span> HideUI();
    <span class="kwd">void</span> UpdateUI();
    <span class="kwd">void</span> EnableModeless([In] <span class="kwd">int</span> fEnable);
    <span class="kwd">void</span> OnDocWindowActivate([In] <span class="kwd">int</span> fActivate);
    <span class="kwd">void</span> OnFrameWindowActivate([In] <span class="kwd">int</span> fActivate);
    <span class="kwd">void</span> ResizeBorder([In] <span class="kwd">ref</span> tagRECT prcBorder, [In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceUIWindow pUIWindow, [In] <span class="kwd">int</span> fRameWindow);
    [PreserveSig]
    <span class="kwd">void</span> TranslateAccelerator([In] <span class="kwd">ref</span> tagMSG lpmsg, [In] <span class="kwd">ref</span> Guid pguidCmdGroup, [In] <span class="kwd">uint</span> nCmdID);
    <span class="kwd">void</span> GetOptionKeyPath([MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">out string</span> pchKey, [In] <span class="kwd">uint</span> dw);
    <span class="kwd">void</span> GetDropTarget([In, MarshalAs(UnmanagedType.Interface)] IDropTarget pDropTarget, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IDropTarget ppDropTarget);
    [PreserveSig]
    <span class="kwd">void</span> GetExternal([MarshalAs(UnmanagedType.IDispatch)] <span class="kwd">out object</span> ppDispatch);
    [PreserveSig]
    <span class="kwd">uint</span> TranslateUrl([In] <span class="kwd">uint</span> dwTranslate, [In, MarshalAs(UnmanagedType.BStr)] <span class="kwd">string</span> pchURLIn, [In, Out, MarshalAs(UnmanagedType.BStr)] <span class="kwd">ref string</span> ppchURLOut);
    <span class="kwd">uint</span> FilterDataObject([In, MarshalAs(UnmanagedType.Interface)] IDataObject pDO, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IDataObject ppDORet);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000122-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public <a href="http://www.apc001.com" target="_blank">interface</a></span><a href="http://www.apc001.com" target="_blank"> </a>IDropTarget
{
    <span class="kwd">void</span> DragEnter([In, MarshalAs(UnmanagedType.Interface)] IDataObject pDataObj, [In] <span class="kwd">uint</span> grfKeyState, [In] _POINTL pt, [In, Out] <span class="kwd">ref uint</span> pdwEffect);
    <span class="kwd">void</span> DragOver([In] <span class="kwd">uint</span> grfKeyState, [In] _POINTL pt, [In, Out] <span class="kwd">ref uint</span> pdwEffect);
    <span class="kwd">void</span> DragLeave();
    <span class="kwd">void</span> Drop([In, MarshalAs(UnmanagedType.Interface)] IDataObject pDataObj, [In] <span class="kwd">uint</span> grfKeyState, [In] _POINTL pt, [In, Out] <span class="kwd">ref uint</span> pdwEffect);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000103-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IEnumFORMATETC
{
    <span class="kwd">void</span> RemoteNext([In] <span class="kwd">uint</span> celt, <span class="kwd">out</span> tagFORMATETC rgelt, <span class="kwd">out uint</span> pceltFetched);
    <span class="kwd">void</span> Skip([In] <span class="kwd">uint</span> celt);
    <span class="kwd">void</span> Reset();
    <span class="kwd">void</span> Clone([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumFORMATETC ppenum);
}

[ComImport, Guid(<span class="st">"00000102-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public <a href="http://77520.cn">interface</a></span><a href="http://77520.cn"> </a>IEnumMoniker
{
    <span class="kwd">void</span> RemoteNext([In] <span class="kwd">uint</span> celt, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker rgelt, <span class="kwd">out uint</span> pceltFetched);
    <span class="kwd">void</span> Skip([In] <span class="kwd">uint</span> celt);
    <span class="kwd">void</span> Reset();
    <span class="kwd">void</span> Clone([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumMoniker ppenum);
}

[ComImport, Guid(<span class="st">"00000105-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IEnumSTATDATA
{
    <span class="kwd">void</span> RemoteNext([In] <span class="kwd">uint</span> celt, <span class="kwd">out</span> tagSTATDATA rgelt, <span class="kwd">out uint</span> pceltFetched);
    <span class="kwd">void</span> Skip([In] <span class="kwd">uint</span> celt);
    <span class="kwd">void</span> Reset();
    <span class="kwd">void</span> Clone([<a href="http://77521.cn">MarshalAs</a>(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumSTATDATA ppenum);
}

[ComImport, Guid(<span class="st">"00000101-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IEnumString
{
    <span class="kwd">void</span> RemoteNext([In] <span class="kwd">uint</span> celt, [MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">out string</span> rgelt, <span class="kwd">out uint</span> pceltFetched);
    <span class="kwd">void</span> Skip([In] <span class="kwd">uint</span> celt);
    <span class="kwd">void</span> Reset();
    <span class="kwd">void</span> Clone([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumString ppenum);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"0000000F-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IMoniker : IPersistStream
{
    <span class="kwd">void</span> RemoteBindToObject([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, [In] <span class="kwd">ref</span> Guid riidResult, [MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">out object</span> ppvResult);
    <span class="kwd">void</span> RemoteBindToStorage([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, [In] <span class="kwd">ref</span> Guid riid, [MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">out object</span> ppvObj);
    <span class="kwd">void</span> Reduce([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In] <span class="kwd">uint</span> dwReduceHowFar, [In, Out, MarshalAs(UnmanagedType.Interface)] <span class="kwd">ref</span> IMoniker ppmkToLeft, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmkReduced);
    <span class="kwd">void</span> ComposeWith([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkRight, [In] <span class="kwd">int</span> fOnlyIfNotGeneric, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmkComposite);
    <span class="kwd">void</span> Enum([In] <span class="kwd">int</span> fForward, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumMoniker ppenumMoniker);
    <span class="kwd">void</span> IsEqual([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkOtherMoniker);
    <span class="kwd">void</span> Hash(<span class="kwd">out uint</span> pdwHash);
    <span class="kwd">void</span> IsRunning([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkNewlyRunning);
    <span class="kwd">void</span> GetTimeOfLastChange([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, <span class="kwd">out</span> _FILETIME pfiletime);
    <span class="kwd">void</span> Inverse([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmk);
    <span class="kwd">void</span> CommonPrefixWith([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkOther, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmkPrefix);
    <span class="kwd">void</span> RelativePathTo([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkOther, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmkRelPath);
    <span class="kwd">void</span> GetDisplayName([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">out string</span> ppszDisplayName);
    <span class="kwd">void</span> ParseDisplayName([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkToLeft, [In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszDisplayName, <span class="kwd">out uint</span> pchEaten, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IMoniker ppmkOut);
    <span class="kwd">void</span> IsSystemMoniker(<span class="kwd">out uint</span> pdwMksys);
}

[ComImport, Guid(<span class="st">"B722BCCB-4E68-101B-A2BC-00AA00404770"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IOleCommandTarget
{
    <span class="kwd">void</span> QueryStatus([In] <span class="kwd">ref</span> Guid pguidCmdGroup, [In] <span class="kwd">uint</span> cCmds, [In, Out] <span class="kwd">ref</span> _tagOLECMD prgCmds, [In, Out] <span class="kwd">ref</span> _tagOLECMDTEXT pCmdText);
    <span class="kwd">void</span> Exec([In] <span class="kwd">ref</span> Guid pguidCmdGroup, [In] <span class="kwd">uint</span> nCmdID, [In] <span class="kwd">uint</span> nCmdexecopt, [In, MarshalAs(UnmanagedType.Struct)] <span class="kwd">ref object</span> pvaIn, [In, Out, MarshalAs(UnmanagedType.Struct)] <span class="kwd">ref object</span> pvaOut);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000117-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IOleInPlaceActiveObject : IOleWindow
{
    <span class="kwd">void</span> RemoteTranslateAccelerator();
    <span class="kwd">void</span> OnFrameWindowActivate([In] <span class="kwd">int</span> fActivate);
    <span class="kwd">void</span> OnDocWindowActivate([In] <span class="kwd">int</span> fActivate);
    <span class="kwd">void</span> RemoteResizeBorder([In] <span class="kwd">ref</span> tagRECT prcBorder, [In] <span class="kwd">ref</span> Guid riid, [In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceUIWindow pUIWindow, [In] <span class="kwd">int</span> fFrameWindow);
    <span class="kwd">void</span> EnableModeless([In] <span class="kwd">int</span> fEnable);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000116-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IOleInPlaceFrame : IOleInPlaceUIWindow
{
    <span class="kwd">void</span> InsertMenus([In] <span class="kwd">ref</span> _RemotableHandle hmenuShared, [In, Out] <span class="kwd">ref</span> tagOleMenuGroupWidths lpMenuWidths);
    <span class="kwd">void</span> SetMenu([In] <span class="kwd">ref</span> _RemotableHandle hmenuShared, [In] <span class="kwd">ref</span> _userHGLOBAL holemenu, [In] <span class="kwd">ref</span> _RemotableHandle hwndActiveObject);
    <span class="kwd">void</span> RemoveMenus([In] <span class="kwd">ref</span> _RemotableHandle hmenuShared);
    <span class="kwd">void</span> SetStatusText([In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszStatusText);
    <span class="kwd">void</span> EnableModeless([In] <span class="kwd">int</span> fEnable);
    <span class="kwd">void</span> TranslateAccelerator([In] <span class="kwd">ref</span> tagMSG lpmsg, [In] <span class="kwd">ushort</span> wID);
}

[ComImport, Guid(<span class="st">"00000115-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IOleInPlaceUIWindow : IOleWindow
{
    <span class="kwd">void</span> GetBorder(<span class="kwd">out</span> tagRECT lprectBorder);
    <span class="kwd">void</span> RequestBorderSpace([In] <span class="kwd">ref</span> tagRECT pborderwidths);
    <span class="kwd">void</span> SetBorderSpace([In] <span class="kwd">ref</span> tagRECT pborderwidths);
    <span class="kwd">void</span> SetActiveObject([In, MarshalAs(UnmanagedType.Interface)] IOleInPlaceActiveObject pActiveObject, [In, MarshalAs(UnmanagedType.LPWStr)] <span class="kwd">string</span> pszObjName);
}

[ComImport, Guid(<span class="st">"00000114-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1), ComConversionLoss]
<span class="kwd">public interface</span> IOleWindow
{
    <span class="kwd">void</span> GetWindow([Out] IntPtr phwnd);
    <span class="kwd">void</span> ContextSensitiveHelp([In] <span class="kwd">int</span> fEnterMode);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"0000010C-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IPersist
{
    <span class="kwd">void</span> GetClassID(<span class="kwd">out</span> Guid pClassID);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000109-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IPersistStream : IPersist
{
    <span class="kwd">void</span> IsDirty();
    <span class="kwd">void</span> Load([In, MarshalAs(UnmanagedType.Interface)] IStream pstm);
    <span class="kwd">void</span> Save([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] <span class="kwd">int</span> fClearDirty);
    <span class="kwd">void</span> GetSizeMax(<span class="kwd">out</span> _ULARGE_INTEGER pcbSize);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000010-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IRunningObjectTable
{
    <span class="kwd">void</span> Register([In] <span class="kwd">uint</span> grfFlags, [In, MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">object</span> punkObject, [In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkObjectName, <span class="kwd">out uint</span> pdwRegister);
    <span class="kwd">void</span> Revoke([In] <span class="kwd">uint</span> dwRegister);
    <span class="kwd">void</span> IsRunning([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkObjectName);
    <span class="kwd">void</span> GetObject([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkObjectName, [MarshalAs(UnmanagedType.IUnknown)] <span class="kwd">out object</span> ppunkObject);
    <span class="kwd">void</span> NoteChangeTime([In] <span class="kwd">uint</span> dwRegister, [In] <span class="kwd">ref</span> _FILETIME pfiletime);
    <span class="kwd">void</span> GetTimeOfLastChange([In, MarshalAs(UnmanagedType.Interface)] IMoniker pmkObjectName, <span class="kwd">out</span> _FILETIME pfiletime);
    <span class="kwd">void</span> EnumRunning([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IEnumMoniker ppenumMoniker);
}

[ComImport, Guid(<span class="st">"0C733A30-2A1C-11CE-ADE5-00AA0044773D"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> ISequentialStream
{
    <span class="kwd">void</span> RemoteRead(<span class="kwd">out byte</span> pv, [In] <span class="kwd">uint</span> cb, <span class="kwd">out uint</span> pcbRead);
    <span class="kwd">void</span> RemoteWrite([In] <span class="kwd">ref byte</span> pv, [In] <span class="kwd">uint</span> cb, <span class="kwd">out uint</span> pcbWritten);
}

[ComImport, Guid(<span class="st">"0000000C-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1)]
<span class="kwd">public interface</span> IStream : ISequentialStream
{
    <span class="kwd">void</span> RemoteSeek([In] _LARGE_INTEGER dlibMove, [In] <span class="kwd">uint</span> dwOrigin, <span class="kwd">out</span> _ULARGE_INTEGER plibNewPosition);
    <span class="kwd">void</span> SetSize([In] _ULARGE_INTEGER libNewSize);
    <span class="kwd">void</span> RemoteCopyTo([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In] _ULARGE_INTEGER cb, <span class="kwd">out</span> _ULARGE_INTEGER pcbRead, <span class="kwd">out</span> _ULARGE_INTEGER pcbWritten);
    <span class="kwd">void</span> Commit([In] <span class="kwd">uint</span> grfCommitFlags);
    <span class="kwd">void</span> Revert();
    <span class="kwd">void</span> LockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] <span class="kwd">uint</span> dwLockType);
    <span class="kwd">void</span> UnlockRegion([In] _ULARGE_INTEGER libOffset, [In] _ULARGE_INTEGER cb, [In] <span class="kwd">uint</span> dwLockType);
    <span class="kwd">void</span> Stat(<span class="kwd">out</span> tagSTATSTG pstatstg, [In] <span class="kwd">uint</span> grfStatFlag);
    <span class="kwd">void</span> Clone([MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IStream ppstm);
}

[ComImport, Guid(<span class="st">"0000010D-0000-0000-C000-000000000046"</span>), InterfaceType((<span class="kwd">short</span>)1), ComConversionLoss]
<span class="kwd">public interface</span> IViewObject
{
    <span class="cmt">//void Draw([In] uint dwDrawAspect, [In] int lindex, [In] uint pvAspect, [In] IntPtr ptd, [In] uint hdcTargetDev, [In] uint hdcDraw, [In] ref _RECTL lprcBounds, [In] ref _RECTL lprcWBounds, [In, MarshalAs(UnmanagedType.Interface)] IContinue pContinue);</span>

    <span class="kwd">void</span> Draw([MarshalAs(UnmanagedType.U4)] UInt32 dwDrawAspect,
        <span class="kwd">int</span> lindex,
        IntPtr pvAspect,
        [In] IntPtr ptd,
        IntPtr hdcTargetDev,
        IntPtr hdcDraw,
        [MarshalAs(UnmanagedType.Struct)] <span class="kwd">ref</span> _RECTL lprcBounds,
        [In] IntPtr lprcWBounds,
        IntPtr pfnContinue,
        [MarshalAs(UnmanagedType.U4)] UInt32 dwContinue);

    <span class="kwd">void</span> RemoteGetColorSet([In] <span class="kwd">uint</span> dwDrawAspect, [In] <span class="kwd">int</span> lindex, [In] <span class="kwd">uint</span> pvAspect, [In] <span class="kwd">ref</span> tagDVTARGETDEVICE ptd, [In] <span class="kwd">uint</span> hicTargetDev, [Out] IntPtr ppColorSet);
    <span class="kwd">void</span> RemoteFreeze([In] <span class="kwd">uint</span> dwDrawAspect, [In] <span class="kwd">int</span> lindex, [In] <span class="kwd">uint</span> pvAspect, <span class="kwd">out uint</span> pdwFreeze);
    <span class="kwd">void</span> Unfreeze([In] <span class="kwd">uint</span> dwFreeze);
    <span class="kwd">void</span> SetAdvise([In] <span class="kwd">uint</span> aspects, [In] <span class="kwd">uint</span> advf, [In, MarshalAs(UnmanagedType.Interface)] IAdviseSink pAdvSink);
    <span class="kwd">void</span> RemoteGetAdvise(<span class="kwd">out uint</span> pAspects, <span class="kwd">out uint</span> pAdvf, [MarshalAs(UnmanagedType.Interface)] <span class="kwd">out</span> IAdviseSink ppAdvSink);
}

[ComImport, InterfaceType((<span class="kwd">short</span>)1), Guid(<span class="st">"00000127-0000-0000-C000-000000000046"</span>)]
<span class="kwd">public interface</span> IViewObject2 : IViewObject
{
    <span class="kwd">void</span> GetExtent([In] <span class="kwd">uint</span> dwDrawAspect, [In] <span class="kwd">int</span> lindex, [In] <span class="kwd">ref</span> tagDVTARGETDEVICE ptd, <span class="kwd">out</span> tagSIZEL lpsizel);
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> tagBIND_OPTS2
{
    <span class="kwd">public uint</span> cbStruct;
    <span class="kwd">public uint</span> grfFlags;
    <span class="kwd">public uint</span> grfMode;
    <span class="kwd">public uint</span> dwTickCountDeadline;
    <span class="kwd">public uint</span> dwTrackFlags;
    <span class="kwd">public uint</span> dwClassContext;
    <span class="kwd">public uint</span> locale;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pServerInfo;
}

<span class="kwd">public enum</span> tagDOCHOSTUIDBLCLK
{
    DOCHOSTUIDBLCLK_DEFAULT,
    DOCHOSTUIDBLCLK_SHOWPROPERTIES,
    DOCHOSTUIDBLCLK_SHOWCODE
}

<span class="kwd">public enum</span> tagDOCHOSTUIFLAG
{
    DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x200,
    DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x800,
    DOCHOSTUIFLAG_DIALOG = 1,
    DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x400000,
    DOCHOSTUIFLAG_DISABLE_HELP_MENU = 2,
    DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x40,
    DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x10,
    DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x1000000,
    DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x100,
    DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x4000,
    DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x10000,
    DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x80,
    DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x20000,
    DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x800000,
    DOCHOSTUIFLAG_NO3DBORDER = 4,
    DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x200000,
    DOCHOSTUIFLAG_NOPICS = 0x100000,
    DOCHOSTUIFLAG_NOTHEME = 0x80000,
    DOCHOSTUIFLAG_OPENNEWWIN = 0x20,
    DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x400,
    DOCHOSTUIFLAG_SCROLL_NO = 8,
    DOCHOSTUIFLAG_THEME = 0x40000,
    DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x1000,
    DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x2000
}

<span class="kwd">public enum</span> tagDOCHOSTUITYPE
{
    DOCHOSTUITYPE_BROWSE,
    DOCHOSTUITYPE_AUTHOR
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> tagDVTARGETDEVICE
{
    <span class="kwd">public uint</span> tdSize;
    <span class="kwd">public ushort</span> tdDriverNameOffset;
    <span class="kwd">public ushort</span> tdDeviceNameOffset;
    <span class="kwd">public ushort</span> tdPortNameOffset;
    <span class="kwd">public ushort</span> tdExtDevmodeOffset;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr tdData;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> tagFORMATETC
{
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr cfFormat;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr ptd;
    <span class="kwd">public uint</span> dwAspect;
    <span class="kwd">public int</span> lindex;
    <span class="kwd">public uint</span> tymed;
}

[StructLayout(LayoutKind.Sequential, Pack = 2), ComConversionLoss]
<span class="kwd">public struct</span> tagLOGPALETTE
{
    <span class="kwd">public ushort</span> palVersion;
    <span class="kwd">public ushort</span> palNumEntries;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr palPalEntry;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> tagMSG
{
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr hwnd;
    <span class="kwd">public uint</span> message;
    <span class="kwd">public uint</span> wParam;
    <span class="kwd">public int</span> lParam;
    <span class="kwd">public uint</span> time;
    <span class="kwd">public</span> tagPOINT pt;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> tagOleMenuGroupWidths
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
    <span class="kwd">public int</span>[] width;
}

[StructLayout(LayoutKind.Sequential, Pack = 1)]
<span class="kwd">public struct</span> tagPALETTEENTRY
{
    <span class="kwd">public byte</span> peRed;
    <span class="kwd">public byte</span> peGreen;
    <span class="kwd">public byte</span> peBlue;
    <span class="kwd">public byte</span> peFlags;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> tagPOINT
{
    <span class="kwd">public int</span> x;
    <span class="kwd">public int</span> y;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> tagRECT
{
    <span class="kwd">public int</span> left;
    <span class="kwd">public int</span> top;
    <span class="kwd">public int</span> right;
    <span class="kwd">public int</span> bottom;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> tagSIZEL
{
    <span class="kwd">public int</span> cx;
    <span class="kwd">public int</span> cy;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> tagSTATDATA
{
    <span class="kwd">public</span> tagFORMATETC formatetc;
    <span class="kwd">public uint</span> advf;
    [MarshalAs(UnmanagedType.Interface)]
    <span class="kwd">public</span> IAdviseSink pAdvSink;
    <span class="kwd">public uint</span> dwConnection;
}

[StructLayout(LayoutKind.Sequential, Pack = 8)]
<span class="kwd">public struct</span> tagSTATSTG
{
    [MarshalAs(UnmanagedType.LPWStr)]
    <span class="kwd">public string</span> pwcsName;
    <span class="kwd">public uint</span> type;
    <span class="kwd">public</span> _ULARGE_INTEGER cbSize;
    <span class="kwd">public</span> _FILETIME mtime;
    <span class="kwd">public</span> _FILETIME ctime;
    <span class="kwd">public</span> _FILETIME atime;
    <span class="kwd">public uint</span> grfMode;
    <span class="kwd">public uint</span> grfLocksSupported;
    <span class="kwd">public</span> Guid clsid;
    <span class="kwd">public uint</span> grfStateBits;
    <span class="kwd">public uint</span> reserved;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _BYTE_BLOB
{
    <span class="kwd">public uint</span> clSize;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr abData;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _COAUTHIDENTITY
{
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr User;
    <span class="kwd">public uint</span> UserLength;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr Domain;
    <span class="kwd">public uint</span> DomainLength;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr Password;
    <span class="kwd">public uint</span> PasswordLength;
    <span class="kwd">public uint</span> Flags;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _COAUTHINFO
{
    <span class="kwd">public uint</span> dwAuthnSvc;
    <span class="kwd">public uint</span> dwAuthzSvc;
    [MarshalAs(UnmanagedType.LPWStr)]
    <span class="kwd">public string</span> pwszServerPrincName;
    <span class="kwd">public uint</span> dwAuthnLevel;
    <span class="kwd">public uint</span> dwImpersonationLevel;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pAuthIdentityData;
    <span class="kwd">public uint</span> dwCapabilities;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _COSERVERINFO
{
    <span class="kwd">public uint</span> dwReserved1;
    [MarshalAs(UnmanagedType.LPWStr)]
    <span class="kwd">public string</span> pwszName;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pAuthInfo;
    <span class="kwd">public uint</span> dwReserved2;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _DOCHOSTUIINFO
{
    <span class="kwd">public uint</span> cbSize;
    <span class="kwd">public uint</span> dwFlags;
    <span class="kwd">public uint</span> dwDoubleClick;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pchHostCss;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pchHostNS;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _FILETIME
{
    <span class="kwd">public uint</span> dwLowDateTime;
    <span class="kwd">public uint</span> dwHighDateTime;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _FLAGGED_BYTE_BLOB
{
    <span class="kwd">public uint</span> fFlags;
    <span class="kwd">public uint</span> clSize;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr abData;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _GDI_OBJECT
{
    <span class="kwd">public uint</span> ObjectType;
    <span class="kwd">public</span> __MIDL_IAdviseSink_0002 u;
}

[StructLayout(LayoutKind.Sequential, Pack = 8)]
<span class="kwd">public struct</span> _LARGE_INTEGER
{
    <span class="kwd">public long</span> QuadPart;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _POINTL
{
    <span class="kwd">public int</span> x;
    <span class="kwd">public int</span> y;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _RECTL
{
    <span class="kwd">public int</span> left;
    <span class="kwd">public int</span> top;
    <span class="kwd">public int</span> right;
    <span class="kwd">public int</span> bottom;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _RemotableHandle
{
    <span class="kwd">public int</span> fContext;
    <span class="kwd">public</span> __MIDL_IWinTypes_0009 u;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _remoteMETAFILEPICT
{
    <span class="kwd">public int</span> mm;
    <span class="kwd">public int</span> xExt;
    <span class="kwd">public int</span> yExt;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr hMF;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _STGMEDIUM_UNION
{
    <span class="kwd">public uint</span> tymed;
    <span class="kwd">public</span> __MIDL_IAdviseSink_0003 u;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _tagOLECMD
{
    <span class="kwd">public uint</span> cmdID;
    <span class="kwd">public uint</span> cmdf;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _tagOLECMDTEXT
{
    <span class="kwd">public uint</span> cmdtextf;
    <span class="kwd">public uint</span> cwActual;
    <span class="kwd">public uint</span> cwBuf;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr rgwz;
}

[StructLayout(LayoutKind.Sequential, Pack = 8)]
<span class="kwd">public struct</span> _ULARGE_INTEGER
{
    <span class="kwd">public ulong</span> QuadPart;
}

[StructLayout(LayoutKind.Sequential, Pack = 4), ComConversionLoss]
<span class="kwd">public struct</span> _userBITMAP
{
    <span class="kwd">public int</span> bmType;
    <span class="kwd">public int</span> bmWidth;
    <span class="kwd">public int</span> bmHeight;
    <span class="kwd">public int</span> bmWidthBytes;
    <span class="kwd">public ushort</span> bmPlanes;
    <span class="kwd">public ushort</span> bmBitsPixel;
    <span class="kwd">public uint</span> cbSize;
    [ComConversionLoss]
    <span class="kwd">public</span> IntPtr pBuffer;
}

[<a href="http://www.download100.cn">StructLayout</a>(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _userCLIPFORMAT
{
    <span class="kwd">public int</span> fContext;
    <span class="kwd">public</span> __MIDL_IWinTypes_0001 u;
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
<span class="kwd">public struct</span> _userFLAG_STGMEDIUM
{
    <span class="kwd">public int</span> ContextFlags;
    <span class="kwd">public int</span> fPassOwnership;
    <span class="kwd">public</span> _userSTGMEDIUM Stgmed;
}

[StructLayout(LayoutKind.Sequential, Pack = 8)]
<span class="kwd">public struct</span> _userHBITMAP
{
    <span class="kwd">public int</span> fCon