﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-金鳞-文章分类-C</title><link>http://www.cnitblog.com/chenxin9821/category/8079.html</link><description>目标-&gt;软件测试架构师</description><language>zh-cn</language><lastBuildDate>Sun, 02 Oct 2011 00:27:46 GMT</lastBuildDate><pubDate>Sun, 02 Oct 2011 00:27:46 GMT</pubDate><ttl>60</ttl><item><title>逆序单链表</title><link>http://www.cnitblog.com/chenxin9821/articles/56644.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Thu, 23 Apr 2009 06:55:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/56644.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/56644.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/56644.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/56644.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/56644.html</trackback:ping><description><![CDATA[<p>/*<br>Author：c++_cracker007小朋友<br>Date：200904023<br>*/<br>#include &lt;stdio.h&gt;<br>#include &lt;malloc.h&gt;</p>
<p>typedef struct node<br>{<br>&nbsp;&nbsp;&nbsp; char name[20];<br>&nbsp;&nbsp; &nbsp;struct node *link;<br>}stud; /*声明链表*/<br>&nbsp;&nbsp;&nbsp; <br>stud* ReverseList(stud* head) //反转链表的指向 <br>{<br>&nbsp;&nbsp;&nbsp; stud *p,*q,*r; /*辅助结点*/ <br>&nbsp;&nbsp;&nbsp; p = head;&nbsp; /*首结点赋给p*/ <br>&nbsp;&nbsp;&nbsp; q = p-&gt;link;&nbsp; /*p的下一个结点为q*/ <br>&nbsp;&nbsp;&nbsp; <br>/*<br>循环如下：<br>开始：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p-&gt;q-&gt;r<br>举例：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1-&gt;2-&gt;3<br>q -&gt;link = p; 之后：&nbsp;&nbsp;&nbsp;q-&gt;p<br>举例：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2-&gt;1<br>最后：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r-&gt;q<br>举例&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3-&gt;2<br>*/ <br>&nbsp;&nbsp;&nbsp; while (strcmp(q-&gt;name,"-1")) /*当q所指结点的数据域为-1时,退出这个循环*/ <br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r = q -&gt;link; /*q的下一个结点为r，也就是第三个结点为r*/<br>&nbsp;&nbsp;q -&gt;link = p; /*没有执行此句之前q-&gt;link为第三个结点r*/<br>&nbsp;&nbsp;/*执行此句之后，p变为q-&gt;link，p变成了q的下一个结点*/ <br>&nbsp;&nbsp;p = q;/*让q变成p，即第二个结点变成第一个结点*/ <br>&nbsp;&nbsp;q = r;/*让r变成q，即让第三个结点变成第二个结点*/ <br>&nbsp; }<br>&nbsp; free(q);/*释放q的内存*/ <br>&nbsp; head-&gt;link = NULL;/*原来的链头变成链尾*/<br>&nbsp; head = p;/*原来的链尾变成链头*/<br>&nbsp; return head;<br>}<br>&nbsp;&nbsp; &nbsp;&nbsp;<br>int main(int argc, char *argv[])<br>{ <br>&nbsp;&nbsp;&nbsp; stud* head=(stud*)malloc(sizeof(stud));/*给链表分配内存*/ <br>&nbsp;&nbsp;&nbsp; stud* p=head;<br>&nbsp;&nbsp;&nbsp; scanf("%s",p-&gt;name);<br>&nbsp;&nbsp;&nbsp; while(strcmp(p-&gt;name,"-1"))/*建立链表，遇到-1就跳出循环*/ <br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p-&gt;link=(stud*)malloc(sizeof(stud));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p=p-&gt;link;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scanf("%s",p-&gt;name);<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; head=ReverseList(head);<br>&nbsp;&nbsp;&nbsp; p=head;<br>&nbsp;&nbsp;&nbsp; while(p) /*输出链表*/ <br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%s\n",p-&gt;name);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p=p-&gt;link;<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; p=head-&gt;link;<br>&nbsp;&nbsp;&nbsp; while(p) /*释放链表*/<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; free(head);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; head=p;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p=p-&gt;link;<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; free(head);<br>&nbsp;&nbsp;&nbsp; system("PAUSE");&nbsp;<br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br></p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/56644.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-04-23 14:55 <a href="http://www.cnitblog.com/chenxin9821/articles/56644.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从字符串A中找到匹配字符串B的第一个子串的位置（c&amp;c++）</title><link>http://www.cnitblog.com/chenxin9821/articles/55657.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Mon, 23 Mar 2009 06:59:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55657.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55657.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55657.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55657.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55657.html</trackback:ping><description><![CDATA[<br>一 、 从别人的blog引用，如下：<br><br>从字符串A中找到匹配字符串B的第一个子串的位置，以下的代码经测试比Plauger的stl（VC7）中的<br>::std::string::find要快30%左右<br>// 仿函数版本<br>template &lt; class Character = char, class Size = int &gt;<br>struct StringFinder<br>{<br>&nbsp;typedef Size size_t;<br>&nbsp;typedef Character char_t;<br>&nbsp;size_t operator()( const char_t* lpszSource, const char_t* lpszSearch )<br>&nbsp;{<br>&nbsp; // maybe the processing of the following line can delay to the caller<br>&nbsp; if ( ( NULL == lpszSource ) || ( NULL == lpszSearch ) ) return -1;<br>&nbsp; const char_t&amp; cSource = *lpszSource;<br>&nbsp; const char_t&amp; cSearch = *lpszSearch;<br>&nbsp; for ( ; ; )<br>&nbsp; {<br>&nbsp;&nbsp; if ( 0 == *lpszSearch )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; return ( lpszSource - ( lpszSearch - &amp;cSearch ) - &amp;cSource );<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; if ( 0 == *lpszSource ) return -1;<br>&nbsp;&nbsp; if ( *lpszSource != *lpszSearch )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; lpszSource -= lpszSearch - &amp;cSearch - 1;<br>&nbsp;&nbsp;&nbsp; lpszSearch = &amp;cSearch;<br>&nbsp;&nbsp;&nbsp; continue;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; ++ lpszSource;<br>&nbsp;&nbsp; ++ lpszSearch;<br>&nbsp; }<br>&nbsp; return -1;<br>&nbsp;}<br>};<br><br>二、以上改成c，如下：<br><br>c++_cracker007&nbsp;&nbsp;&nbsp; 14:55:21<br>&nbsp;int find( const char* lpszSource, const char* lpszSearch )<br>&nbsp;{<br>&nbsp; if ( ( NULL == lpszSource ) || ( NULL == lpszSearch ) ) return -1;<br>&nbsp; const char* cSource = lpszSource;<br>&nbsp; const char* cSearch = lpszSearch;<br>&nbsp; for ( ; ; )<br>&nbsp; {<br>&nbsp;&nbsp; if ( 0 == *lpszSearch )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; return ( lpszSource - ( lpszSearch - cSearch ) - cSource );<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; if ( 0 == *lpszSource ) return -1;<br>&nbsp;&nbsp; if ( *lpszSource != *lpszSearch )<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; lpszSource -= lpszSearch - cSearch - 1;<br>&nbsp;&nbsp;&nbsp; lpszSearch = cSearch;<br>&nbsp;&nbsp;&nbsp; continue;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; ++ lpszSource;<br>&nbsp;&nbsp; ++ lpszSearch;<br>&nbsp; }<br>&nbsp; return -1;<br>&nbsp;}<br>c++_cracker007&nbsp;&nbsp; 14:55:28<br>这样就改成c的了。<br>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55657.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-23 14:59 <a href="http://www.cnitblog.com/chenxin9821/articles/55657.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>auto、register、static、extern等存储类修饰符的区别</title><link>http://www.cnitblog.com/chenxin9821/articles/55487.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Tue, 17 Mar 2009 05:50:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55487.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55487.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55487.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55487.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55487.html</trackback:ping><description><![CDATA[<h2>auto、register、static、extern等存储类修饰符的区别<span class=category> - [<a href="http://kimva.blogbus.com/c1466695/">C/C++编程</a>]</span></h2>
<div class=postBody>
<p class=cc-lisence style="LINE-HEIGHT: 180%"><a href="http://creativecommons.org/licenses/by/3.0/deed.zh" target=_blank><font color=#0099cc>版权声明</font></a>：转载时请以超链接形式标明文章原始出处和作者信息及<a href="http://bangzhuzhongxin.blogbus.com/logs/11205960.html" target=_blank><font color=#0099cc>本声明</font></a><br><a href="http://kimva.blogbus.com/logs/19329180.html"><font color=#0099cc>http://kimva.blogbus.com/logs/19329180.html</font></a><br><br></p>
<p><font face="'宋体', sans-serif" size=2>一、标识符的链接（linkage）</font></p>
<p><font face="'宋体', sans-serif" size=2>（1）外部链接<br>表示在整个程序中（多个程序文件）是相同的函数或对象。常见的有，在函数体外声明的extern变量。<br>（2）内部链接<br>表示只在当前程序文件中是相同的函数或对象。其它程序文件不能对其进行访问。常见的有，在函数体外声明的static变量。<br>（3）无链接<br>一般声明在函数内部的auto、register变量、还有函数的参数，都是无链接。它的作用域是函数内部。<br><br>二、对象的生存周期（lifetime）<br>（1）静态生存周期<br>具有静态生存周期的所有对象，都是在程序开始执行之前就被事先创建和初始化。它们的寿命覆盖整个程序的执行过程。如在函数内定义了一个static变量，那第一次调用该函数后，该变量的值将会被保留，当第二次被调用时，该变量的值还是第一次调用结束时的值。<br>（2）自动生存周期<br>自动生存周期的对象的寿命由&#8220;对象定义所处在的大括号{}&#8221;决定。每次程序执行流进入一个语句块，此语句块自动生存周期的对象就会被创建一个新实例，同时被初始化。<br><br>三、存储类修饰符<br>（1）auto<br>auto修饰符只能用在函数内的对象声明。声明中有auto修饰符的对象具有自动生存周期。<br>在ANSI C中，函数内的对象声明在默认情况下有自动生存周期，所以在函数内声明时auto可省略。<br><br>（2）register<br>当声明对象有自动生存周期时，可以使用register修饰符。因此，register也只能用在函数内的声明中。<br>此关键字告诉编译器：此对象的存取应该尽量快，最好存储在CPU的寄存器中。然而，编译器不见得会这么做。<br>另外要注意的是，当一个对象声明为register，就不可使用地址运算符&amp;了，因为它有可能被放到寄存器中。<br><br>（3）static<br>函数标识符如果被声明为static，就具有静态生命周期。<br>如果是定义在函数外，那么该对象具有内部链接，其它程序文件不能对其访问。<br>如果是定义在函数内，那么该对象具有无链接，函数外不能对其访问。<br>注意：static变量初始化时，只能用常量。<br><br>（4）extern<br>如果声明在函数外，那么该对象具有外部链接，能够在其它程序文件使用。但要注意它有可能会被函数内定义的重名的变量所隐藏起来。<br>如果声明在函数内，该对象具有何种链接取决于当前程序文件中定义在函数外的相同名字的对象。如果在函数外也定义了一下相同名字的static对象，则该函数内的对象具有无链接，否则具有外部链接。<br>extern的对象都具有静态生命周期。<br>使用extern时，注意不能重复定义，否则编译报错，如：<br>程序文件一：<br>extern int a = 10;&nbsp; //编译警告，extern的变量最好不要初始化<br>程序文件二：<br>extern int a = 20;&nbsp; //重复定义，应改为extern int a;<br>一般最好这样，如果需要初始化，可把extern修饰符去掉（但也不要重复定义），另外如果其它程序文件也需要用到该变量，可用extern来声明该变量。这样会比较清晰。<br><br>（5）缺</font><font face="'宋体', sans-serif" size=2>省修饰符<br>函数内，与auto相同；<br>函数外，与extern相同；<br></font></p>
<p><font face="'宋体', sans-serif" size=2>&nbsp; </font><!--
BODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"文鼎PL细上海宋Uni"; font-size:x-small }
-->
<table cellSpacing=0 border=0>
    <tbody>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle width=86 height=21><font face="'宋体', sans-serif" size=2><br></font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle width=86><font face="'宋体', sans-serif" size=2><br></font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle width=178><font face="'宋体', sans-serif" size=2>linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle width=86><font face="'宋体', sans-serif" size=2>lifetime</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle height=42 rowSpan=2><font face="'宋体', sans-serif" size=2>auto</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数内</font></td>
            <td vAlign=center align=middle><font face="'宋体', sans-serif" size=2>no linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>自动</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数外</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>语法错</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>语法错</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle height=42 rowSpan=2><font face="'宋体', sans-serif" size=2>register</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数内</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>no linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>自动</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数外</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>语法错</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>语法错</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle height=42 rowSpan=2><font face="'宋体', sans-serif" size=2>缺省</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数内</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>no linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>自动</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数外</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>external linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>静态</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle height=42 rowSpan=2><font face="'宋体', sans-serif" size=2>static</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数内</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>no linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>静态</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数外</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>internal linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>静态</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle height=42 rowSpan=2><font face="'宋体', sans-serif" size=2>extern</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数内</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>与它在函数外所声明的一致</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>静态</font></td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>函数外</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>external linkage</font></td>
            <td style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" vAlign=center align=middle><font face="'宋体', sans-serif" size=2>静态</font></td>
        </tr>
    </tbody>
</table>
</p>
<p>&nbsp;</p>
<p><font face="'宋体', sans-serif" size=2>例子：<br>int func1(void);&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//func1具有外部链接；<br>int a = 10;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //a具有外部链接，静态生存周期；<br>extern int b = 1;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; //b具有外部链接，静态生存周期。但编译会有警告extern变量不应初始化，同时也要注意是否会重复定义；<br>static int c;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; //c具有内部链接，静态生存周期；<br>static int e;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; //e具有内部链接，静态生存周期；<br>static void func2(int d){&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //func2具有内部链接；参数d具有无链接，自动生存周期；<br>&nbsp;&nbsp; &nbsp;extern int a;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//a与上面的a一样（同一变量），具有外部链接，静态生存周期。注意这里的不会被默认初始为0,它只是个声明；<br>&nbsp;&nbsp; &nbsp;int b = 2;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//b具有无链接，自动生存同期。并且将上面声明的b隐藏起来；<br>&nbsp;&nbsp; &nbsp;extern int c;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//c与上面的c一样，维持内部链接，静态生存周期。注意这里的不会被默认初始为0,它只是个声明；<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; //如果去掉了extern修饰符，就跟b类似了，无链接，自动生存周期，把上面声明的c隐藏起来；<br>&nbsp;&nbsp; &nbsp;static int e;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//e具有无链接，静态生存周期。并且将上面声明的e隐藏起来；初始化值为0；<br>&nbsp;&nbsp; &nbsp;static int f;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//f具有无链接，静态生存周期；<br>}</font></p>
<br>暂时还看不懂...<br></div>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55487.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-17 13:50 <a href="http://www.cnitblog.com/chenxin9821/articles/55487.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>突然找到一个注释的很全面的程序</title><link>http://www.cnitblog.com/chenxin9821/articles/55295.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Thu, 12 Mar 2009 02:16:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55295.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55295.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55295.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55295.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55295.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;1//&nbsp;win32.cpp&nbsp;:&nbsp;Defines&nbsp;the&nbsp;entry&nbsp;point&nbsp;for&nbsp;the&nbsp;application.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;<a href='http://www.cnitblog.com/chenxin9821/articles/55295.html'>阅读全文</a><img src ="http://www.cnitblog.com/chenxin9821/aggbug/55295.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-12 10:16 <a href="http://www.cnitblog.com/chenxin9821/articles/55295.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>（转）Windows API函数大全</title><link>http://www.cnitblog.com/chenxin9821/articles/55265.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Wed, 11 Mar 2009 02:07:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55265.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55265.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55265.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55265.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55265.html</trackback:ping><description><![CDATA[<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">1. API之网络函数 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetAddConnection 创建同一个网络资源的永久性连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetAddConnection2 创建同一个网络资源的连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetAddConnection3 创建同一个网络资源的连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetCancelConnection 结束一个网络连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetCancelConnection2 结束一个网络连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetCloseEnum 结束一次枚举操作 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetConnectionDialog 启动一个标准对话框，以便建立同网络资源的连接</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;WNetDisconnectDialog 启动一个标准对话框，以便断开同网络资源的连接 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetEnumResource 枚举网络资源 WNetGetConnection 获取本地或已连接的一个资源的网络名称 WNetGetLastError 获取网络错误的扩展错误信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetGetUniversalName 获取网络中一个文件的远程名称以及/或者UNC（统一命名规范）名称 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WNetGetUser 获取一个网络资源用以连接的名字 WNetOpenEnum 启动对网络资源进行枚举的过程 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"></div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">2. API之消息函数 BroadcastSystemMessage 将一条系统消息广播给系统中所有的顶级窗口&nbsp;</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetMessagePos 取得消息队列中上一条消息处理完毕时的鼠标指针屏幕位置 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetMessageTime 取得消息队列中上一条消息处理完毕时的时间 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">PostMessage 将一条消息投递到指定窗口的消息队列</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;PostThreadMessage 将一条消息投递给应用程序 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegisterWindowMessage 获取分配给一个字串标识符的消息编号 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">ReplyMessage 答复一个消息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SendMessage 调用一个窗口的窗口函数，将一条消息发给那个窗口 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SendMessageCallback 将一条消息发给窗口 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SendMessageTimeout 向窗口发送一条消息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SendNotifyMessage 向窗口发送一条消息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"></div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">3. API之文件处理函数 CloseHandle 关闭一个内核对象。其中包括文件、文件映射、进程、线程、安全和同步对象等 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CompareFileTime 对比两个文件的时间 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CopyFile 复制文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateDirectory 创建一个新目录 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateFile 打开和创建文件、管道、邮槽、通信服务、设备以及控制台 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateFileMapping 创建一个新的文件映射对象 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">DeleteFile 删除指定文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">DeviceIoControl 对设备执行指定的操作 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">DosDateTimeToFileTime 将DOS日期和时间值转换成一个 win32 FILETIME 值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FileTimeToDosDateTime 将一个 win32 FILETIME 值转换成DOS日期和时间值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FileTimeToLocalFileTime 将一个FILETIME结构转换成本地时间 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FileTimeToSystemTime 根据一个FILETIME结构的内容，装载一个SYSTEMTIME结构 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FindClose 关闭由FindFirstFile函数创建的一个搜索句柄 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FindFirstFile 根据文件名查找文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FindNextFile 根据调用FindFirstFile函数时指定的一个文件名查找下一个文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FlushFileBuffers 针对指定的文件句柄，刷新内部文件缓冲区 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">FlushViewOfFile 将写入文件映射缓冲区的所有数据都刷新到磁盘 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetBinaryType 判断文件是否可以执行 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetCompressedFileSize 判断一个压缩文件在磁盘上实际占据的字节数 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetCurrentDirectory 在一个缓冲区中装载当前目录 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetDiskFreeSpace 获取与一个磁盘的组织有关的信息，以及了解剩余空间的容量</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;GetDiskFreeSpaceEx 获取与一个磁盘的组织以及剩余空间容量有关的信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetDriveType 判断一个磁盘驱动器的类型 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetExpandedName 取得一个压缩文件的全名 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileAttributes 判断指定文件的属性 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileInformationByHandle 这个函数提供了获取文件信息的一种机制 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileSize 判断文件长度 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileTime 取得指定文件的时间信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileType 在给出文件句柄的前提下，判断文件类型 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileVersionInfo 从支持版本标记的一个模块里获取文件版本信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetFileVersionInfoSize 针对包含了版本资源的一个文件，判断容纳文件版本信息需要一个多大的缓冲区 GetFullPathName 获取指定文件的完整路径名 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetLogicalDrives 判断系统中存在哪些逻辑驱动器字母 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetLogicalDriveStrings 获取一个字串，其中包含了当前所有逻辑驱动器的根驱动器路径 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetOverlappedResult 判断一个重叠操作当前的状态 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetPrivateProfileInt 为初始化文件（.ini文件）中指定的条目获取一个整数值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetPrivateProfileSection 获取指定小节（在.ini文件中）所有项名和值的一个列表 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetPrivateProfileString 为初始化文件中指定的条目取得字串 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetProfileInt 取得win.ini初始化文件中指定条目的一个整数值 G</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">etProfileSection 获取指定小节（在win.ini文件中）所有项名和值的一个列表 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetProfileString 为win.ini初始化文件中指定的条目取得字串 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetShortPathName 获取指定文件的短路径名 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetSystemDirectory 取得Windows系统目录（即System目录）的完整路径名 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetTempFileName 这个函数包含了一个临时文件的名字，它可由应用程序使用 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetTempPath 获取为临时文件指定的路径 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetVolumeInformation 获取与一个磁盘卷有关的信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetWindowsDirectory 获取Windows目录的完整路径名 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">hread 参考lread </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">hwrite 参考lwrite函数 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">lclose 关闭指定的文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">lcreat 创建一个文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">llseek 设置文件中进行读写的当前位置 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LockFile 锁定文件的某一部分，使其不与其他应用程序共享 LockFileEx 与LockFile相似，只是它提供了更多的功能</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;lopen 以二进制模式打开指定的文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">lread 将文件中的数据读入内存缓冲区</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;lwrite 将数据从内存缓冲区写入一个文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LZClose 关闭由LZOpenFile 或 LZInit函数打开的一个文件</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;LZCopy 复制一个文件 LZInit 这个函数用于初始化内部缓冲区 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LZOpenFile 该函数能执行大量不同的文件处理，而且兼容于压缩文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LZRead 将数据从文件读入内存缓冲区 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LZSeek 设置一个文件中进行读写的当前位置 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">MapViewOfFile 将一个文件映射对象映射到当前应用程序的地址空间 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">MoveFile 移动文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">OpenFile 这个函数能执行大量不同的文件操作</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;OpenFileMapping 打开一个现成的文件映射对象 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">QueryDosDevice 在Windows NT中，DOS设备名会映射成NT系统设备名。该函数可判断当前的设备映射情况 ReadFile 从文件中读出数据</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;ReadFileEx 与ReadFile相似，只是它只能用于异步读操作，并包含了一个完整的回调 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegCloseKey 关闭系统注册表中的一个项（或键） RegConnectRegistry 访问远程系统的部分注册表 RegCreateKey 在指定的项下创建或打开一个项 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegCreateKeyEx 在指定项下创建新项的更复杂的方式。在Win32环境中建议使用这个函数 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegDeleteKey 删除现有项下方一个指定的子项 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegDeleteValue 删除指定项下方的一个值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegEnumKey 枚举指定项的子项。在Win32环境中应使用RegEnumKeyEx RegEnumKeyEx 枚举指定项下方的子项 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegEnumValue 枚举指定项的值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegFlushKey 将对项和它的子项作出的改动实际写入磁盘</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RegGetKeySecurity 获取与一个注册表项有关的安全信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegLoadKey 从以前用RegSaveKey函数创建的一个文件里装载注册表信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegNotifyChangeKeyValue 注册表项或它的任何一个子项发生变化时，用这个函数提供一种通知机制 RegOpenKey 打开一个现有的注册表项 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegOpenKeyEx 打开一个现有的项。在win32下推荐使用这个函数</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RegQueryInfoKey 获取与一个项有关的信息</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RegQueryValue 取得指定项或子项的默认（未命名）值</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RegQueryValueEx 获取一个项的设置值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegReplaceKey 用一个磁盘文件保存的信息替换注册表信息；并创建一个备份，在其中包含当前注册表信息 RegRestoreKey 从一个磁盘文件恢复注册表信息 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegSaveKey 将一个项以及它的所有子项都保存到一个磁盘文件</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RegSetKeySecurity 设置指定项的安全特性 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegSetValue 设置指定项或子项的默认值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegSetValueEx 设置指定项的值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegUnLoadKey 卸载指定的项以及它的所有子项</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;RemoveDirectory 删除指定目录 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SearchPath 查找指定文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetCurrentDirectory 设置当前目录 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetEndOfFile 针对一个打开的文件，将当前文件位置设为文件末尾 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetFileAttributes 设置文件属性 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetFilePointer 在一个文件中设置当前的读写位置 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetFileTime 设置文件的创建、访问及上次修改时间 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetHandleCount 这个函数不必在win32下使用；即使使用，也不会有任何效果 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SetVolumeLabel 设置一个磁盘的卷标（Label） </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">SystemTimeToFileTime 根据一个FILETIME结构的内容，载入一个SYSTEMTIME结构 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">UnlockFile 解除对一个文件的锁定 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">UnlockFileEx 解除对一个文件的锁定 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">UnmapViewOfFile 在当前应用程序的内存地址空间解除对一个文件映射对象的映射 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">VerFindFile 用这个函数决定一个文件应安装到哪里 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">VerInstallFile 用这个函数安装一个文件</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;VerLanguageName 这个函数能根据16位语言代码获取一种语言的名称 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">VerQueryValue 这个函数用于从版本资源中获取信息</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;WriteFile 将数据写入一个文件 WriteFileEx 与WriteFile类似，只是它只能用于异步写操作，并包括了一个完整的回调 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WritePrivateProfileSection 为一个初始化文件（.ini）中指定的小节设置所有项名和值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WritePrivateProfileString 在初始化文件指定小节内设置一个字串 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WriteProfileSection 为Win.ini初始化文件中一个指定的小节设置所有项名和值 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">WriteProfileString 在Win.ini初始化文件指定小节内设置一个字串 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"></div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">4. API之打印函数 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">AbortDoc 取消一份文档的打印 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">AbortPrinter 删除与一台打印机关联在一起的缓冲文件 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">AddForm 为打印机的表单列表添加一个新表单 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">AddJob 用于获取一个有效的路径名，以便用它为作业创建一个后台打印文件。它也会为作业分配一个作业编号 AddMonitor 为系统添加一个打印机监视器 </div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">AddPort 启动"添加端口"对话框，允许用户在系统可用端口列表中加入一个新端口</div>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">&nbsp;AddPrinter 在系统中添加一台新打印机 AddPrinterConnection 连接指定的打印机 AddPrinterDriver 为指定的系统添加一个打印驱动程序 AddPrintProcessor 为指定的系统添加一个打印处理器 AddPrintProvidor 为系统添加一个打印供应商 AdvancedDocumentProperties 启动打印机文档设置对话框 ClosePrinter 关闭一个打开的打印机对象 ConfigurePort 针对指定的端口，启动一个端口配置对话框 ConnectToPrinterDlg 启动连接打印机对话框，用它同访问网络的打印机连接 DeleteForm 从打印机可用表单列表中删除一个表单 DeleteMonitor 删除指定的打印监视器 DeletePort 启动"删除端口"对话框，允许用户从当前系统删除一个端口 DeletePrinter 将指定的打印机标志为从系统中删除 DeletePrinterConnection 删除与指定打印机的连接 DeletePrinterDriver 从系统删除一个打印机驱动程序 DeletePrintProcessor 从指定系统删除一个打印处理器 DeletePrintProvidor 从系统中删除一个打印供应商 DeviceCapabilities 利用这个函数可获得与一个设备的能力有关的信息 DocumentProperties 打印机配置控制函数 EndDocAPI 结束一个成功的打印作业 EndDocPrinter 在后台打印程序的级别指定一个文档的结束 EndPage 用这个函数完成一个页面的打印，并准备设备场景，以便打印下一个页 EndPagePrinter 指定一个页在打印作业中的结尾 EnumForms 枚举一台打印机可用的表单 EnumJobs 枚举打印队列中的作业 EnumMonitors 枚举可用的打印监视器 EnumPorts 枚举一个系统可用的端口 EnumPrinterDrivers 枚举指定系统中已安装的打印机驱动程序 EnumPrinters 枚举系统中安装的打印机 EnumPrintProcessorDatatypes 枚举由一个打印处理器支持的数据类型 EnumPrintProcessors 枚举系统中可用的打印处理器 Escape 设备控制函数 FindClosePrinterChangeNotification 关闭用FindFirstPrinterChangeNotification函数获取的一个打印机通告对象 FindFirstPrinterChangeNotification 创建一个新的改变通告对象，以便我们注意打印机状态的各种变化 FindNextPrinterChangeNotification 用这个函数判断触发一次打印机改变通告信号的原因 FreePrinterNotifyInfo 释放由FindNextPrinterChangeNotification函数分配的一个缓冲区 GetForm 取得与指定表单有关的信息 GetJob 获取与指定作业有关的信息 GetPrinter 取得与指定打印机有关的信息 GetPrinterData 为打印机设置注册表配置信息 GetPrinterDriver 针对指定的打印机，获取与打印机驱动程序有关的信息 GetPrinterDriverDirectory 判断指定系统中包含了打印机驱动程序的目录是什么 GetPrintProcessorDirectory 判断指定系统中包含了打印机处理器驱动程序及文件的目录 OpenPrinter 打开指定的打印机，并获取打印机的句柄 PrinterMessageBox 在拥有指定打印作业的系统上显示一个打印机出错消息框 PrinterProperties 启动打印机属性对话框，以便对打印机进行配置 ReadPrinter 从打印机读入数据 ResetDC 重设一个设备场景 ResetPrinter 改变指定打印机的默认数据类型及文档设置 ScheduleJob 提交一个要打印的作业 SetAbortProc 为Windows指定取消函数的地址 SetForm 为指定的表单设置信息 SetJob 对一个打印作业的状态进行控制 SetPrinter 对一台打印机的状态进行控制 SetPrinterData 设置打印机的注册表配置信息 StartDoc 开始一个打印作业 StartDocPrinter 在后台打印的级别启动一个新文档 StartPage 打印一个新页前要先调用这个函数 StartPagePrinter 在打印作业中指定一个新页的开始 WritePrinter 将发送目录中的数据写入打印机 5. API之文本和字体函数 AddFontResource 在Windows系统中添加一种字体资源 CreateFont 用指定的属性创建一种逻辑字体 CreateFontIndirect 用指定的属性创建一种逻辑字体 CreateScalableFontResource 为一种TureType字体创建一个资源文件，以便能用API函数AddFontResource将其加入Windows系统 DrawText 将文本描绘到指定的矩形中 DrawTextEx 与DrawText相似，只是加入了更多的功能 EnumFontFamilies 列举指定设备可用的字体 EnumFontFamiliesEx 列举指定设备可用的字体 EnumFonts 列举指定设备可用的字体 ExtTextOut 经过扩展的文本描绘函数。也请参考SetTextAlign函数 GetAspectRatioFilterEx 用SetMapperFlags要求Windows只选择与设备当前纵横比相符的光栅字体时，本函数可判断纵横比大小 GetCharABCWidths 判断TureType字体中一个或多个字符的A-B-C大小 GetCharABCWidthsFloat 查询一种字体中一个或多个字符的A-B-C尺寸 GetCharacterPlacement 该函数用于了解如何用一个给定的字符显示一个字串 GetCharWidth 调查字体中一个或多个字符的宽度 GetFontData 接收一种可缩放字体文件的数据 GetFontLanguageInfo 返回目前选入指定设备场景中的字体的信息 GetGlyphOutline 取得TureType字体中构成一个字符的曲线信息 GetKerningPairs 取得指定字体的字距信息 GetOutlineTextMetrics 接收与TureType字体内部特征有关的详细信息 GetRasterizerCaps 了解系统是否有能力支持可缩放的字体 GetTabbedTextExtent 判断一个字串占据的范围，同时考虑制表站扩充的因素 GetTextAlign 接收一个设备场景当前的文本对齐标志 GetTextCharacterExtra 判断额外字符间距的当前值 GetTextCharset 接收当前选入指定设备场景的字体的字符集标识符 GetTextCharsetInfo 获取与当前选定字体的字符集有关的详细信息 GetTextColor 判断当前字体颜色。通常也称为"前景色" GetTextExtentExPoint 判断要填入指定区域的字符数量。也用一个数组装载每个字符的范围信息 GetTextExtentPoint 判断一个字串的大小（范围） GetTextFace 获取一种字体的字样名 GetTextMetrics 获取与选入一种设备场景的物理字体有关的信息 GrayString 描绘一个以灰色显示的字串。通常由Windows用于标识禁止状态 PolyTextOut 描绘一系列字串 RemoveFontResource 从Windows系统中删除一种字体资源 SetMapperFlags Windows对字体进行映射时，可用该函数选择与目标设备的纵横比相符的光栅字体 SetTextAlign 设置文本对齐方式，并指定在文本输出过程中使用设备场景的当前位置 SetTextCharacterExtra 描绘文本的时候，指定要在字符间插入的额外间距 SetTextColor 设置当前文本颜色。这种颜色也称为"前景色" SetTextJustification 通过指定一个文本行应占据的额外空间，可用这个函数对文本进行两端对齐处理 TabbedTextOut 支持制表站的一个文本描绘函数 TextOut 文本绘图函数 6. API之菜单函数 AppendMenu 在指定的菜单里添加一个菜单项 CheckMenuItem 复选或撤消复选指定的菜单条目 CheckMenuRadioItem 指定一个菜单条目被复选成"单选"项目 CreateMenu 创建新菜单 CreatePopupMenu 创建一个空的弹出式菜单 DeleteMenu 删除指定的菜单条目 DestroyMenu 删除指定的菜单 DrawMenuBar 为指定的窗口重画菜单 EnableMenuItem 允许或禁止指定的菜单条目 GetMenu 取得窗口中一个菜单的句柄 GetMenuCheckMarkDimensions 返回一个菜单复选符的大小 GetMenuContextHelpId 取得一个菜单的帮助场景ID GetMenuDefaultItem 判断菜单中的哪个条目是默认条目 GetMenuItemCount 返回菜单中条目（菜单项）的数量 GetMenuItemID 返回位于菜单中指定位置处的条目的菜单ID GetMenuItemInfo 取得（接收）与一个菜单条目有关的特定信息 GetMenuItemRect 在一个矩形中装载指定菜单条目的屏幕坐标信息 GetMenuState 取得与指定菜单条目状态有关的信息 GetMenuString 取得指定菜单条目的字串 GetSubMenu 取得一个弹出式菜单的句柄，它位于菜单中指定的位置 GetSystemMenu 取得指定窗口的系统菜单的句柄 HiliteMenuItem 控制顶级菜单条目的加亮显示状态 InsertMenu 在菜单的指定位置处插入一个菜单条目，并根据需要将其他条目向下移动 InsertMenuItem 插入一个新菜单条目 IsMenu 判断指定的句柄是否为一个菜单的句柄 LoadMenu 从指定的模块或应用程序实例中载入一个菜单 LoadMenuIndirect 载入一个菜单 MenuItemFromPoint 判断哪个菜单条目包含了屏幕上一个指定的点 ModifyMenu 改变菜单条目 RemoveMenu 删除指定的菜单条目 SetMenu 设置窗口菜单 SetMenuContextHelpId 设置一个菜单的帮助场景ID SetMenuDefaultItem 将一个菜单条目设为默认条目 SetMenuItemBitmaps 设置一幅特定位图，令其在指定的菜单条目中使用，代替标准的复选符号（&#8730;） SetMenuItemInfo 为一个菜单条目设置指定的信息 TrackPopupMenu 在屏幕的任意地方显示一个弹出式菜单 TrackPopupMenuEx 与TrackPopupMenu相似，只是它提供了额外的功能 7. API之位图、图标和光栅运算函数 BitBlt 将一幅位图从一个设备场景复制到另一个 CopyIcon 制作指定图标或鼠标指针的一个副本。这个副本从属于发出调用的应用程序 CopyImage 复制位图、图标或指针，同时在复制过程中进行一些转换工作 CreateBitmap 按照规定的格式创建一幅与设备有关位图 CreateBitmapIndirect 创建一幅与设备有关位图 CreateCompatibleBitmap 创建一幅与设备有关位图，它与指定的设备场景兼容 CreateCursor 创建一个鼠标指针 CreateDIBitmap 根据一幅与设备无关的位图创建一幅与设备有关的位图 CreateDIBSection 创建一个DIBSection CreateIcon 创建一个图标 CreateIconIndirect 创建一个图标 DestroyCursor 清除指定的鼠标指针，并释放它占用的所有系统资源 DestroyIcon 清除图标 DrawIcon 在指定的位置画一个图标 DrawIconEx 描绘一个图标或鼠标指针。与DrawIcon相比，这个函数提供了更多的功能 ExtractAssociatedIcon 判断一个可执行程序或DLL中是否存在图标，或是否有图标与系统注册表中指定的文件存在关联并提取之 ExtractIcon 判断一个可执行文件或DLL中是否有图标存在，并将其提取出来 GetBitmapBits 将来自位图的二进制位复制到一个缓冲区 GetBitmapDimensionEx 取得一幅位图的宽度和高度 GetDIBColorTable 从选入设备场景的DIBSection中取得颜色表信息 GetDIBits 将来自一幅位图的二进制位复制到一幅与设备无关的位图里 GetIconInfo 取得与图标有关的信息 GetStretchBltMode 判断StretchBlt 和 StretchDIBits函数采用的伸缩模式 LoadBitmap 从指定的模块或应用程序实例中载入一幅位图 LoadCursor 从指定的模块或应用程序实例中载入一个鼠标指针 LoadCursorFromFile 在一个指针文件或一个动画指针文件的基础上创建一个指针 LoadIcon 从指定的模块或应用程序实例中载入一个图标 LoadImage 载入一个位图、图标或指针 MaskBlt 执行复杂的图象传输，同时进行掩模（MASK）处理 PatBlt 在当前选定的刷子的基础上，用一个图案填充指定的设备场景 PlgBlt 复制一幅位图，同时将其转换成一个平行四边形。利用它可对位图进行旋转处理 SetBitmapBits 将来自缓冲区的二进制位复制到一幅位图 SetBitmapDimensionEx 设置一幅位图的宽度。以一毫米的十分之一为单位 SetDIBColorTable 设置选入设备场景的一个DIBSection的颜色表信息 SetDIBits 将来自与设备无关位图的二进制位复制到一幅与设备有关的位图里 SetDIBitsToDevice 将一幅与设备无关位图的全部或部分数据直接复制到一个设备 SetStretchBltMode 指定StretchBlt 和 StretchDIBits函数的伸缩模式 StretchBlt 将一幅位图从一个设备场景复制到另一个 StretchDIBits 将一幅与设备无关位图的全部或部分数据直接复制到指定的设备场景 8. API之绘图函数 AbortPath 抛弃选入指定设备场景中的所有路径。也取消目前正在进行的任何路径的创建工作 AngleArc 用一个连接弧画一条线 Arc 画一个圆弧 BeginPath 启动一个路径分支 CancelDC 取消另一个线程里的长时间绘图操作 Chord 画一个弦 CloseEnhMetaFile 关闭指定的增强型图元文件设备场景，并将新建的图元文件返回一个句柄 CloseFigure 描绘到一个路径时，关闭当前打开的图形 CloseMetaFile 关闭指定的图元文件设备场景，并向新建的图元文件返回一个句柄 CopyEnhMetaFile 制作指定增强型图元文件的一个副本（拷贝） CopyMetaFile 制作指定（标准）图元文件的一个副本 CreateBrushIndirect 在一个LOGBRUSH数据结构的基础上创建一个刷子 CreateDIBPatternBrush 用一幅与设备无关的位图创建一个刷子，以便指定刷子样式（图案） CreateEnhMetaFile 创建一个增强型的图元文件设备场景 CreateHatchBrush 创建带有阴影图案的一个刷子 CreateMetaFile 创建一个图元文件设备场景 CreatePatternBrush 用指定了刷子图案的一幅位图创建一个刷子 CreatePen 用指定的样式、宽度和颜色创建一个画笔 CreatePenIndirect 根据指定的LOGPEN结构创建一个画笔 CreateSolidBrush 用纯色创建一个刷子 DeleteEnhMetaFile 删除指定的增强型图元文件 DeleteMetaFile 删除指定的图元文件 DeleteObject 删除GDI对象，对象使用的所有系统资源都会被释放 DrawEdge 用指定的样式描绘一个矩形的边框 DrawEscape 换码（Escape）函数将数据直接发至显示设备驱动程序 DrawFocusRect 画一个焦点矩形 DrawFrameControl 描绘一个标准控件 DrawState 为一幅图象或绘图操作应用各式各样的效果 Ellipse 描绘一个椭圆，由指定的矩形围绕 EndPath 停止定义一个路径 EnumEnhMetaFile 针对一个增强型图元文件，列举其中单独的图元文件记录 EnumMetaFile 为一个标准的windows图元文件枚举单独的图元文件记录 EnumObjects 枚举可随同指定设备场景使用的画笔和刷子 ExtCreatePen 创建一个扩展画笔（装饰或几何） ExtFloodFill 在指定的设备场景里，用当前选择的刷子填充一个区域 FillPath 关闭路径中任何打开的图形，并用当前刷子填充 FillRect 用指定的刷子填充一个矩形 FlattenPath 将一个路径中的所有曲线都转换成线段 FloodFill 用当前选定的刷子在指定的设备场景中填充一个区域 FrameRect 用指定的刷子围绕一个矩形画一个边框 GdiComment 为指定的增强型图元文件设备场景添加一条注释信息 GdiFlush 执行任何未决的绘图操作 GdiGetBatchLimit 判断有多少个GDI绘图命令位于队列中 GdiSetBatchLimit 指定有多少个GDI绘图命令能够进入队列 GetArcDirection 画圆弧的时候，判断当前采用的绘图方向 GetBkColor 取得指定设备场景当前的背景颜色 GetBkMode 针对指定的设备场景，取得当前的背景填充模式 GetBrushOrgEx 判断指定设备场景中当前选定刷子起点 GetCurrentObject 获得指定类型的当前选定对象 GetCurrentPositionEx 在指定的设备场景中取得当前的画笔位置 GetEnhMetaFile 取得磁盘文件中包含的一个增强型图元文件的图元文件句柄 GetEnhMetaFileBits 将指定的增强型图元文件复制到一个内存缓冲区里 GetEnhMetaFileDescription 返回对一个增强型图元文件的说明 GetEnhMetaFileHeader 取得增强型图元文件的图元文件头 GetEnhMetaFilePaletteEntries 取得增强型图元文件的全部或部分调色板 GetMetaFile 取得包含在一个磁盘文件中的图元文件的图元文件句柄 GetMetaFileBitsEx 将指定的图元文件复制到一个内存缓冲区 GetMiterLimit 取得设备场景的斜率限制（Miter）设置 GetNearestColor 根据设备的显示能力，取得与指定颜色最接近的一种纯色 GetObjectAPI 取得对指定对象进行说明的一个结构 GetObjectType 判断由指定句柄引用的GDI对象的类型 GetPath 取得对当前路径进行定义的一系列数据 GetPixel 在指定的设备场景中取得一个像素的RGB值 GetPolyFillMode 针对指定的设备场景，获得多边形填充模式 GetROP2 针对指定的设备场景，取得当前的绘图模式 GetStockObject 取得一个固有对象（Stock） GetSysColorBrush 为任何一种标准系统颜色取得一个刷子 GetWinMetaFileBits 通过在一个缓冲区中填充用于标准图元文件的数据，将一个增强型图元文件转换成标准windows图元文件 InvertRect 通过反转每个像素的值，从而反转一个设备场景中指定的矩形 LineDDA 枚举指定线段中的所有点 LineTo 用当前画笔画一条线，从当前位置连到一个指定的点 MoveToEx 为指定的设备场景指定一个新的当前画笔位置 PaintDesk 在指定的设备场景中描绘桌面墙纸图案 PathToRegion 将当前选定的路径转换到一个区域里 Pie 画一个饼图 PlayEnhMetaFile 在指定的设备场景中画一个增强型图元文件 PlayEnhMetaFileRecord 回放单独一条增强型图元文件记录 PlayMetaFile 在指定的设备场景中回放一个图元文件 PlayMetaFileRecord 回放来自图元文件的单条记录 PolyBezier 描绘一条或多条贝塞尔（Bezier）曲线 PolyDraw 描绘一条复杂的曲线，由线段及贝塞尔曲线组成 Polygon 描绘一个多边形 Polyline 用当前画笔描绘一系列线段 PolyPolygon 用当前选定画笔描绘两个或多个多边形 PolyPolyline 用当前选定画笔描绘两个或多个多边形 Rectangle 用当前选定的画笔描绘矩形，并用当前选定的刷子填充 RoundRect 用当前选定的画笔画一个圆角矩形，并用当前选定的刷子在其中填充 SelectClipPath 将设备场景当前的路径合并到剪切区域里 SelectObject 为当前设备场景选择图形对象 SetArcDirection 设置圆弧的描绘方向 SetBkColor 为指定的设备场景设置背景颜色 SetBkMode 指定阴影刷子、虚线画笔以及字符中的空隙的填充方式 SetBrushOrgEx 为指定的设备场景设置当前选定刷子的起点 SetEnhMetaFileBits 用指定内存缓冲区内包含的数据创建一个增强型图元文件 SetMetaFileBitsEx 用包含在指定内存缓冲区内的数据结构创建一个图元文件 SetMiterLimit 设置设备场景当前的斜率限制 SetPixel 在指定的设备场景中设置一个像素的RGB值 SetPixelV 在指定的设备场景中设置一个像素的RGB值 SetPolyFillMode 设置多边形的填充模式 SetROP2 设置指定设备场景的绘图模式。与vb的DrawMode属性完全一致 SetWinMetaFileBits 将一个标准Windows图元文件转换成增强型图元文件 StrokeAndFillPath 针对指定的设备场景，关闭路径上打开的所有区域 StrokePath 用当前画笔描绘一个路径的轮廓。打开的图形不会被这个函数关闭 UnrealizeObject 将一个刷子对象选入设备场景之前，如刷子的起点准备用SetBrushOrgEx修改，则必须先调用本函数 WidenPath 根据选定画笔的宽度，重新定义当前选定的路径 9. API之设备场景函数 CombineRgn 将两个区域组合为一个新区域 CombineTransform 驱动世界转换。它相当于依顺序进行两次转换 CreateCompatibleDC 创建一个与特定设备场景一致的内存设备场景 CreateDC 为专门设备创建设备场景 CreateEllipticRgn 创建一个椭圆 CreateEllipticRgnIndirect 创建一个内切于特定矩形的椭圆区域 CreateIC 为专用设备创建一个信息场景 CreatePolygonRgn 创建一个由一系列点围成的区域 CreatePolyPolygonRgn 创建由多个多边形构成的区域。每个多边形都应是封闭的 CreateRectRgn 创建一个矩形区域 CreateRectRgnIndirect 创建一个矩形区域 CreateRoundRectRgn 创建一个圆角矩形 DeleteDC 删除专用设备场景或信息场景，释放所有相关窗口资源 DPtoLP 将点阵从设备坐标转换到专用设备场景逻辑坐标 EqualRgn 确定两个区域是否相等 ExcludeClipRect 从专用设备场景的剪裁区中去掉一个矩形区。矩形内不能进行绘图 ExcludeUpdateRgn 从专用设备场景剪裁区去掉指定窗口的刷新区域 ExtCreateRegion 根据世界转换修改区域 ExtSelectClipRgn 将指定区域组合到设备场景的当前剪裁区 FillRgn 用指定刷子填充指定区域 FrameRgn 用指定刷子围绕指定区域画一个外框 GetBoundsRect 获取指定设备场景的边界矩形 GetClipBox 获取完全包含指定设备场景剪裁区的最小矩形 GetClipRgn 获取设备场景当前剪裁区 GetDC 获取指定窗口的设备场景 GetDCEx 为指定窗口获取设备场景。相比GetDC，本函数提供了更多的选项 GetDCOrgEx 获取指定设备场景起点位置（以屏幕坐标表示） GetDeviceCaps 根据指定设备场景代表的设备的功能返回信息 GetGraphicsMode 确定是否允许增强图形模式（世界转换） GetMapMode 为特定设备场景调入映象模式 GetRegionData 装入描述一个区域信息的RgnData结构或缓冲区 GetRgnBox 获取完全包含指定区域的最小矩形 GetUpdateRgn 确定指定窗口的刷新区域。该区域当前无效，需要刷新 GetViewportExtEx 获取设备场景视口（viewport）范围 GetViewportOrgEx 获取设备场景视口起点 GetWindowDC 获取整个窗口（包括边框、滚动条、标题栏、菜单等）的设备场景 GetWindowExtEx 获取指定设备场景的窗口范围 GetWindowOrgEx 获取指定设备场景的逻辑窗口的起点 GetWindowRgn 获取窗口区域 GetWorldTransform 如果有世界转换，为设备场景获取当前世界转换 IntersectClipRect 为指定设备定义一个新的剪裁区 InvalidateRgn 使窗口指定区域不活动，并将它加入窗口刷新区，使之可随后被重画 InvertRgn 通过颠倒每个像素值反转设备场景指定区域 LPtoDP 将点阵从指定设备场景逻辑坐标转换为设备坐标 ModifyWorldTransform 根据指定的模式修改世界转换 OffsetClipRgn 按指定量平移设备场景剪裁区 OffsetRgn 按指定偏移量平移指定区域 OffsetViewportOrgEx 平移设备场景视口区域 OffsetWindowOrgEx 平移指定设备场景窗口起点 PaintRgn 用当前刷子背景色填充指定区域 PtInRegion 确定点是否在指定区域内 PtVisible 确定指定点是否可见（即，点是否在设备场景剪裁区内） RectInRegion 确定矩形是否有部分在指定区域内 RectVisible 确定指定矩形是否有部分可见（是否在设备场景剪裁区内） ReleaseDC 释放由调用GetDC或GetWindowDC函数获取的指定设备场景 RestoreDC 从设备场景堆栈恢复一个原先保存的设备场景 SaveDC 将指定设备场景状态保存到Windows设备场景堆栈 ScaleViewportExtEx 缩放设备场景视口的范围 ScaleWindowExtEx 缩放指定设备场景窗口范围 ScrollDC 在窗口（由设备场景代表）中水平和（或）垂直滚动矩形 SelectClipRgn 为指定设备场景选择新的剪裁区 SetBoundsRect 设置指定设备场景的边界矩形 SetGraphicsMode 允许或禁止增强图形模式，以提供某些支持（包括世界转换） SetMapMode 设置指定设备场景的映射模式 SetRectRgn 设置区域为指定的矩形 SetViewportExtEx 设置设备场景视口范围 SetViewportOrgEx 设置设备场景视口起点 SetWindowExtEx 设置指定设备场景窗口范围 SetWindowOrgEx 设置指定设备场景窗口起点 SetWindowRgn 设置窗口区域 SetWorldTransform 设置世界转换 ValidateRgn 激活窗口中指定区域，把它从刷新区移走 WindowFromDC 取回与某一设备场景相关的窗口的句柄10. API之硬件与系统函数 ActivateKeyboardLayout 激活一个新的键盘布局。键盘布局定义了按键在一种物理性键盘上的位置与含义 Beep 用于生成简单的声音 CharToOem 将一个字串从ANSI字符集转换到OEM字符集 ClipCursor 将指针限制到指定区域 ConvertDefaultLocale 将一个特殊的地方标识符转换成真实的地方ID CreateCaret 根据指定的信息创建一个插入符（光标），并将它选定为指定窗口的默认插入符 DestroyCaret 清除（破坏）一个插入符 EnumCalendarInfo 枚举在指定"地方"环境中可用的日历信息 EnumDateFormats 列举指定的"当地"设置中可用的长、短日期格式 EnumSystemCodePages 枚举系统中已安装或支持的代码页 EnumSystemLocales 枚举系统已经安装或提供支持的"地方"设置 EnumTimeFormats 枚举一个指定的地方适用的时间格式 ExitWindowsEx 退出windows，并用特定的选项重新启动 ExpandEnvironmentStrings 扩充环境字串 FreeEnvironmentStrings 翻译指定的环境字串块 GetACP 判断目前正在生效的ANSI代码页 GetAsyncKeyState 判断函数调用时指定虚拟键的状态 GetCaretBlinkTime 判断插入符光标的闪烁频率 GetCaretPos 判断插入符的当前位置 GetClipCursor 取得一个矩形，用于描述目前为鼠标指针规定的剪切区域 GetCommandLine 获得指向当前命令行缓冲区的一个指针 GetComputerName 取得这台计算机的名称 GetCPInfo 取得与指定代码页有关的信息 GetCurrencyFormat 针对指定的"地方"设置，根据货币格式格式化一个数字 GetCursor 获取目前选择的鼠标指针的句柄 GetCursorPos 获取鼠标指针的当前位置 GetDateFormat 针对指定的"当地"格式，对一个系统日期进行格式化 GetDoubleClickTime 判断连续两次鼠标单击之间会被处理成双击事件的间隔时间 GetEnvironmentStrings 为包含了当前环境字串设置的一个内存块分配和返回一个句柄 GetEnvironmentVariable 取得一个环境变量的值 GetInputState 判断是否存在任何待决（等待处理）的鼠标或键盘事件 GetKBCodePage 由GetOEMCP取代，两者功能完全相同 GetKeyboardLayout 取得一个句柄，描述指定应用程序的键盘布局 GetKeyboardLayoutList 获得系统适用的所有键盘布局的一个列表 GetKeyboardLayoutName 取得当前活动键盘布局的名称 GetKeyboardState 取得键盘上每个虚拟键当前的状态 GetKeyboardType 了解与正在使用的键盘有关的信息 GetKeyNameText 在给出扫描码的前提下，判断键名 GetKeyState 针对已处理过的按键，在最近一次输入信息时，判断指定虚拟键的状态 GetLastError 针对之前调用的api函数，用这个函数取得扩展错误信息 GetLocaleInfo 取得与指定"地方"有关的信息 GetLocalTime 取得本地日期和时间 GetNumberFormat 针对指定的"地方"，按特定的格式格式化一个数字 GetOEMCP 判断在OEM和ANSI字符集间转换的windows代码页 GetQueueStatus 判断应用程序消息队列中待决（等待处理）的消息类型 GetSysColor 判断指定windows显示对象的颜色 GetSystemDefaultLangID 取得系统的默认语言ID GetSystemDefaultLCID 取得当前的默认系统"地方" GetSystemInfo 取得与底层硬件平台有关的信息 GetSystemMetrics 返回与windows环境有关的信息 GetSystemPowerStatus 获得与当前系统电源状态有关的信息 GetSystemTime 取得当前系统时间，这个时间采用的是"协同世界时间"（即UTC，也叫做GMT）格式 GetSystemTimeAdjustment 使内部系统时钟与一个外部的时钟信号源同步 GetThreadLocale 取得当前线程的地方ID GetTickCount 用于获取自windows启动以来经历的时间长度（毫秒） GetTimeFormat 针对当前指定的"地方"，按特定的格式格式化一个系统时间 GetTimeZoneInformation 取得与系统时区设置有关的信息 GetUserDefaultLangID 为当前用户取得默认语言ID GetUserDefaultLCID 取得当前用户的默认"地方"设置 GetUserName 取得当前用户的名字 GetVersion 判断当前运行的Windows和DOS版本 GetVersionEx 取得与平台和操作系统有关的版本信息 HideCaret 在指定的窗口隐藏插入符（光标） IsValidCodePage 判断一个代码页是否有效 IsValidLocale 判断地方标识符是否有效 keybd_event 这个函数模拟了键盘行动 LoadKeyboardLayout 载入一个键盘布局 MapVirtualKey 根据指定的映射类型，执行不同的扫描码和字符转换 MapVirtualKeyEx 根据指定的映射类型，执行不同的扫描码和字符转换 MessageBeep 播放一个系统声音。系统声音的分配方案是在控制面板里决定的 mouse_event 模拟一次鼠标事件 OemKeyScan 判断OEM字符集中的一个ASCII字符的扫描码和Shift键状态 OemToChar 将OEM字符集的一个字串转换到ANSI字符集 SetCaretBlinkTime 指定插入符（光标）的闪烁频率 SetCaretPos 指定插入符的位置 SetComputerName 设置新的计算机名 SetCursor 将指定的鼠标指针设为当前指针 SetCursorPos 设置指针的位置 SetDoubleClickTime 设置连续两次鼠标单击之间能使系统认为是双击事件的间隔时间 SetEnvironmentVariable 将一个环境变量设为指定的值 SetKeyboardState 设置每个虚拟键当前在键盘上的状态 SetLocaleInfo 改变用户"地方"设置信息 SetLocalTime 设置当前地方时间 SetSysColors 设置指定窗口显示对象的颜色 SetSystemCursor 改变任何一个标准系统指针 SetSystemTime 设置当前系统时间 SetSystemTimeAdjustment 定时添加一个校准值使内部系统时钟与一个外部的时钟信号源同步 SetThreadLocale 为当前线程设置地方 SetTimeZoneInformation 设置系统时区信息 ShowCaret 在指定的窗口里显示插入符（光标） ShowCursor 控制鼠标指针的可视性 SwapMouseButton 决定是否互换鼠标左右键的功能 SystemParametersInfo 获取和设置数量众多的windows系统参数 SystemTimeToTzSpecificLocalTime 将系统时间转换成地方时间 ToAscii 根据当前的扫描码和键盘信息，将一个虚拟键转换成ASCII字符 ToUnicode 根据当前的扫描码和键盘信息，将一个虚拟键转换成Unicode字符 UnloadKeyboardLayout 卸载指定的键盘布局 VkKeyScan 针对Windows字符集中一个ASCII字符，判断虚拟键码和Shift键的状态 11. API之进程和线程函数 CancelWaitableTimer 这个函数用于取消一个可以等待下去的计时器操作 CallNamedPipe 这个函数由一个希望通过管道通信的一个客户进程调用 ConnectNamedPipe 指示一台服务器等待下去，直至客户机同一个命名管道连接 CreateEvent 创建一个事件对象 CreateMailslot 创建一个邮路。返回的句柄由邮路服务器使用（收件人） CreateMutex 创建一个互斥体（MUTEX） CreateNamedPipe 创建一个命名管道。返回的句柄由管道的服务器端使用 CreatePipe 创建一个匿名管道 CreateProcess 创建一个新进程（比如执行一个程序） CreateSemaphore 创建一个新的信号机 CreateWaitableTimer 创建一个可等待的计时器对象 DisconnectNamedPipe 断开一个客户与一个命名管道的连接 DuplicateHandle 在指出一个现有系统对象当前句柄的情况下，为那个对象创建一个新句柄 ExitProcess 中止一个进程 FindCloseChangeNotification 关闭一个改动通知对象 FindExecutable 查找与一个指定文件关联在一起的程序的文件名 FindFirstChangeNotification 创建一个文件通知对象。该对象用于监视文件系统发生的变化 FindNextChangeNotification 重设一个文件改变通知对象，令其继续监视下一次变化 FreeLibrary 释放指定的动态链接库 GetCurrentProcess 获取当前进程的一个伪句柄 GetCurrentProcessId 获取当前进程一个唯一的标识符 GetCurrentThread 获取当前线程的一个伪句柄 GetCurrentThreadId 获取当前线程一个唯一的线程标识符 GetExitCodeProces 获取一个已中断进程的退出代码 GetExitCodeThread 获取一个已中止线程的退出代码 GetHandleInformation 获取与一个系统对象句柄有关的信息 GetMailslotInfo 获取与一个邮路有关的信息 GetModuleFileName 获取一个已装载模板的完整路径名称 GetModuleHandle 获取一个应用程序或动态链接库的模块句柄 GetPriorityClass 获取特定进程的优先级别 GetProcessShutdownParameters 调查系统关闭时一个指定的进程相对于其它进程的关闭早迟情况 GetProcessTimes 获取与一个进程的经过时间有关的信息 GetProcessWorkingSetSize 了解一个应用程序在运行过程中实际向它交付了多大容量的内存 GetSartupInfo 获取一个进程的启动信息 GetThreadPriority 获取特定线程的优先级别 GetTheardTimes 获取与一个线程的经过时间有关的信息 GetWindowThreadProcessId 获取与指定窗口关联在一起的一个进程和线程标识符 LoadLibrary 载入指定的动态链接库，并将它映射到当前进程使用的地址空间 LoadLibraryEx 装载指定的动态链接库，并为当前进程把它映射到地址空间 LoadModule 载入一个Windows应用程序，并在指定的环境中运行 MsgWaitForMultipleObjects 等侯单个对象或一系列对象发出信号。如返回条件已经满足，则立即返回 SetPriorityClass 设置一个进程的优先级别 SetProcessShutdownParameters 在系统关闭期间，为指定进程设置他相对于其它程序的关闭顺序 SetProcessWorkingSetSize 设置操作系统实际划分给进程使用的内存容量 SetThreadPriority 设定线程的优先级别 ShellExecute 查找与指定文件关联在一起的程序的文件名 TerminateProcess 结束一个进程 WinExec 运行指定的程序 12. API之控件与消息函数 AdjustWindowRect 给定一种窗口样式，计算获得目标客户区矩形所需的窗口大小 AnyPopup 判断屏幕上是否存在任何弹出式窗口 ArrangeIconicWindows 排列一个父窗口的最小化子窗口 AttachThreadInput 连接线程输入函数 BeginDeferWindowPos 启动构建一系列新窗口位置的过程 BringWindowToTop 将指定的窗口带至窗口列表顶部 CascadeWindows 以层叠方式排列窗口 ChildWindowFromPoint 返回父窗口中包含了指定点的第一个子窗口的句柄 ClientToScreen 判断窗口内以客户区坐标表示的一个点的屏幕坐标 CloseWindow 最小化指定的窗口 CopyRect 矩形内容复制 DeferWindowPos 该函数为特定的窗口指定一个新窗口位置 DestroyWindow 清除指定的窗口以及它的所有子窗口 DrawAnimatedRects 描绘一系列动态矩形 EnableWindow 指定的窗口里允许或禁止所有鼠标及键盘输入 EndDeferWindowPos 同时更新DeferWindowPos调用时指定的所有窗口的位置及状态 EnumChildWindows 为指定的父窗口枚举子窗口 EnumThreadWindows 枚举与指定任务相关的窗口 EnumWindows 枚举窗口列表中的所有父窗口 EqualRect 判断两个矩形结构是否相同 FindWindow 寻找窗口列表中第一个符合指定条件的顶级窗口 FindWindowEx 在窗口列表中寻找与指定条件相符的第一个子窗口 FlashWindow 闪烁显示指定窗口 GetActiveWindow 获得活动窗口的句柄 GetCapture 获得一个窗口的句柄，这个窗口位于当前输入线程，且拥有鼠标捕获（鼠标活动由它接收） GetClassInfo 取得WNDCLASS结构（或WNDCLASSEX结构）的一个副本，结构中包含了与指定类有关的信息 GetClassLong 取得窗口类的一个Long变量条目 GetClassName 为指定的窗口取得类名 GetClassWord 为窗口类取得一个整数变量 GetClientRect 返回指定窗口客户区矩形的大小 GetDesktopWindow 获得代表整个屏幕的一个窗口（桌面窗口）句柄 GetFocus 获得拥有输入焦点的窗口的句柄 GetForegroundWindow 获得前台窗口的句柄 GetLastActivePopup 获得在一个给定父窗口中最近激活过的弹出式窗口的句柄 GetParent 判断指定窗口的父窗口 GetTopWindow 搜索内部窗口列表，寻找隶属于指定窗口的头一个窗口的句柄 GetUpdateRect 获得一个矩形，它描叙了指定窗口中需要更新的那一部分 GetWindow 获得一个窗口的句柄，该窗口与某源窗口有特定的关系 GetWindowContextHelpId 取得与窗口关联在一起的帮助场景ID GetWindowLong 从指定窗口的结构中取得信息 GetWindowPlacement 获得指定窗口的状态及位置信息 GetWindowRect 获得整个窗口的范围矩形，窗口的边框、标题栏、滚动条及菜单等都在这个矩形内 GetWindowText 取得一个窗体的标题（caption）文字，或者一个控件的内容 GetWindowTextLength 调查窗口标题文字或控件内容的长短 GetWindowWord 获得指定窗口结构的信息 InflateRect 增大或减小一个矩形的大小 IntersectRect 这个函数在lpDestRect里载入一个矩形，它是lpSrc1Rect与lpSrc2Rect两个矩形的交集 InvalidateRect 屏蔽一个窗口客户区的全部或部分区域 IsChild 判断一个窗口是否为另一窗口的子或隶属窗口 IsIconic 判断窗口是否已最小化 IsRectEmpty 判断一个矩形是否为空 IsWindow 判断一个窗口句柄是否有效 IsWindowEnabled 判断窗口是否处于活动状态 IsWindowUnicode 判断一个窗口是否为Unicode窗口。这意味着窗口为所有基于文本的消息都接收Unicode文字 IsWindowVisible 判断窗口是否可见 IsZoomed 判断窗口是否最大化 LockWindowUpdate 锁定指定窗口，禁止它更新 MapWindowPoints 将一个窗口客户区坐标的点转换到另一窗口的客户区坐标系统 MoveWindow 改变指定窗口的位置和大小 OffsetRect 通过应用一个指定的偏移，从而让矩形移动起来 OpenIcon 恢复一个最小化的程序，并将其激活 PtInRect 判断指定的点是否位于矩形内部 RedrawWindow 重画全部或部分窗口 ReleaseCapture 为当前的应用程序释放鼠标捕获 ScreenToClient 判断屏幕上一个指定点的客户区坐标 ScrollWindow 滚动窗口客户区的全部或一部分 ScrollWindowEx 根据附加的选项，滚动窗口客户区的全部或部分 SetActiveWindow 激活指定的窗口 SetCapture 将鼠标捕获设置到指定的窗口 SetClassLong 为窗口类设置一个Long变量条目 SetClassWord 为窗口类设置一个条目 SetFocusAPI 将输入焦点设到指定的窗口。如有必要，会激活窗口 SetForegroundWindow 将窗口设为系统的前台窗口 SetParent 指定一个窗口的新父 SetRect 设置指定矩形的内容 SetRectEmpty 将矩形设为一个空矩形 SetWindowContextHelpId 为指定的窗口设置帮助场景（上下文）ID SetWindowLong 在窗口结构中为指定的窗口设置信息 SetWindowPlacement 设置窗口状态和位置信息 SetWindowPos 为窗口指定一个新位置和状态 SetWindowText 设置窗口的标题文字或控件的内容 SetWindowWord 在窗口结构中为指定的窗口设置信息 ShowOwnedPopups 显示或隐藏由指定窗口所有的全部弹出式窗口 ShowWindow 控制窗口的可见性 ShowWindowAsync 与ShowWindow相似 SubtractRect 装载矩形lprcDst，它是在矩形lprcSrc1中减去lprcSrc2得到的结果 TileWindows 以平铺顺序排列窗口 UnionRect 装载一个lpDestRect目标矩形，它是lpSrc1Rect和lpSrc2Rect联合起来的结果 UpdateWindow 强制立即更新窗口 ValidateRect 校验窗口的全部或部分客户区 WindowFromPoint 返回包含了指定点的窗口的句柄。忽略屏蔽、隐藏以及透明窗口。</div>
<p class="right articalinfo" style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">原文：<a href="http://blog.csdn.net/hsyouxishe/archive/2008/05/05/2392907.aspx">http://blog.csdn.net/hsyouxishe/archive/2008/05/05/2392907.aspx</a><a title=permalink href=""><u><font color=#336699></font></u></a></p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-11 10:07 <a href="http://www.cnitblog.com/chenxin9821/articles/55265.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>常用的Win32函数清单</title><link>http://www.cnitblog.com/chenxin9821/articles/55264.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Wed, 11 Mar 2009 02:02:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55264.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55264.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55264.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55264.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55264.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>1、限制程序功能函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">EnableMenuItem 允许、禁止或变灰指定的菜单条目<br>EnableWindow 允许或禁止鼠标和键盘控制指定窗口和条目（禁止时菜单变灰）</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>2、对话框函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateDialog 从资源模板建立一非模态对话窗<br>CreateDialogParam 从资源模板建立一非模态对话窗<br>CreateDialogIndirect 从内存模板建立一非模态对话窗<br>CreateDialogIndirectParam 从内存模板建立一非模态对话窗</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">DialogBox 从资源模板建立一模态对话窗<br>DialogBoxParam 从资源模板建立一模态对话窗<br>DialogBoxIndirect 从内存模板建立一模态对话窗<br>DialogBoxIndirectParam 从内存模板建立一模态对话窗<br>EndDialog 结束一模态对话窗</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">MessageBox 显示一信息对话框<br>MessageBoxEx 显示一信息对话框<br>MessageBoxIndirect 显示一定制信息对话框</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetDlgItemInt 得指定输入框整数值<br>GetDlgItemText 得指定输入框输入字符串<br>GetDlgItemTextA 得指定输入框输入字符串<br>Hmemcpy 内存复制 （非应用程序直接调用）<br><strong><br>3、磁盘处理函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetDiskFreeSpaceA 获取与一个磁盘的组织有关的信息，以及了解剩余空间的容量<br>GetDiskFreeSpaceExA 获取与一个磁盘的组织以及剩余空间容量有关的信息<br>GetDriveTypeA 判断一个磁盘驱动器的类型<br>GetLogicalDrives 判断系统中存在哪些逻辑驱动器字母<br>GetFullPathNameA 获取指定文件的详细路径<br>GetVolumeInformationA 获取与一个磁盘卷有关的信息<br>GetWindowsDirectoryA 获取Windows目录的完整路径名<br>GetSystemDirectoryA 取得Windows系统目录（即System目录）的完整路径名</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>4、文件处理函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateFileA 打开和创建文件、管道、邮槽、通信服务、设备以及控制台<br>OpenFile 这个函数能执行大量不同的文件操作<br>ReadFile 从文件中读出数据<br>ReadFileEx 与ReadFile相似，只是它只能用于异步读操作，并包含了一个完整的回调<br>WriteFile 将数据写入一个文件<br>WriteFileEx 与WriteFile类似，只是它只能用于异步写操作，并包括了一个完整的回调<br>SetFilePointer 在一个文件中设置当前的读写位置<br>SetEndOfFile 针对一个打开的文件，将当前文件位置设为文件末尾<br>CloseHandle 关闭一个内核对象。其中包括文件、文件映射、进程、线程、安全和同步对象等</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">_lcreat 创建一个文件<br>_lopen 以二进制模式打开指定的文件<br>_lread 将文件中的数据读入内存缓冲区<br>_lwrite 将数据从内存缓冲区写入一个文件<br>_llseek 设置文件中进行读写的当前位置<br>_lclose 关闭指定的文件<br>_hread 将文件中的数据读入内存缓冲区<br>_hwrite 将数据从内存缓冲区写入一个文件</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">OpenFileMappingA 打开一个现成的文件映射对象<br>CreateFileMappingA 创建一个新的文件映射对象<br>MapViewOfFile 将一个文件映射对象映射到当前应用程序的地址空间<br>MapViewOfFileEx （内容同上）</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateDirectoryA 创建一个新目录<br>CreateDirectoryExA 创建一个新目录<br>RemoveDirectoryA 删除指定目录<br>SetCurrentDirectoryA 设置当前目录</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">MoveFileA 移动文件<br>DeleteFileA 删除指定文件<br>CopyFileA 复制文件<br>CompareFileTime 对比两个文件的时间<br>SetFileAttributesA 设置文件属性<br>SetFileTime 设置文件的创建、访问及上次修改时间<br>FindFirstFileA 根据文件名查找文件<br>FindNextFileA 根据调用FindFirstFile函数时指定的一个文件名查找下一个文件<br>FindClose 关闭由FindFirstFile函数创建的一个搜索句柄<br>SearchPathA 查找指定文件</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">GetBinaryTypeA 判断文件是否可以执行<br>GetFileAttributesA 判断指定文件的属性<br>GetFileSize 判断文件长度<br>GetFileTime 取得指定文件的时间信息<br>GetFileType 在给出文件句柄的前提下，判断文件类型</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>5、注册表处理函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">RegOpenKeyA 打开一个现有的注册表项<br>RegOpenKeyExA 打开一个现有的注册表项<br>RegCreateKeyA 在指定的项下创建或打开一个项<br>RegCreateKeyExA 在指定项下创建新项的更复杂的方式<br>RegDeleteKeyA 删除现有项下方一个指定的子项<br>RegDeleteValueA 删除指定项下方的一个值<br>RegQueryValueA 获取一个项的设置值<br>RegQueryValueExA 获取一个项的设置值<br>RegSetValueA 设置指定项或子项的值<br>RegSetValueExA 设置指定项的值<br>RegCloseKey 关闭系统注册表中的一个项（或键）</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>6、时间处理函数<br></strong><br>CompareFileTime 比较两文件时间<br>GetFileTime 得文件建立，最后访问，修改时间<br>GetLocalTime 得当前本地时间<br>GetSystemTime 得当前系统时间<br>GetTickCount 得windows启动至现时毫秒<br>SetFileTime 设置文件时间<br>SetLocalTime 设置本地时间<br>SetSystemTime 设置系统时间</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier"><strong>7、进程函数</strong></p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">CreateProcessA 创建一个新进程<br>ExitProcess 以干净的方式关闭一个进程<br>FindExecutableA 查找与一个指定文件关联在一起的程序的文件名<br>FreeLibray 释放指定的动态链库<br>GetCurrentProcess 获取当前进程的一个伪句柄<br>GetCurrentProcessId 获取当前进程一个唯一的标识符<br>GetCurrentThread 获取当前线程的一个伪句柄<br>GetExitCodeProces 获取一个已结束进程的退出代码<br>GetExitCodeThread 获取一个已结束线程的退出代码<br>GetModuleHandleA 获取一个应用程序或动态链接库的模块句柄<br>GetPriorityClassA 获取特定进程的优先级别</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">LoadLibraryA 载入指定的动态链接库，并将它映射到当前进程使用的地址空间<br>LoadLibraryExA 装载指定的动态链接库，并为当前进程把它映射到地址空间<br>LoadModule 载入一个windows应用程序，并在指定的环境中运行</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">TerminateProcess 结束一个进程</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">详细函数信息和参数信息大家可能需要参考API手册了。</p>
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">Win32函数远不只这些， 但很多都极不常用，完全不必理会。 以上这些若能自如运用， 你已经可以搞软件破解了&#8230;&#8230;<br><br>引自：<br><a href="http://czsilence.yo2.cn/articles/%E5%B8%B8%E7%94%A8%E7%9A%84win32%E5%87%BD%E6%95%B0%E6%B8%85%E5%8D%95.html">http://czsilence.yo2.cn/articles/%E5%B8%B8%E7%94%A8%E7%9A%84win32%E5%87%BD%E6%95%B0%E6%B8%85%E5%8D%95.html</a></p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55264.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-11 10:02 <a href="http://www.cnitblog.com/chenxin9821/articles/55264.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>typedef</title><link>http://www.cnitblog.com/chenxin9821/articles/55253.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Tue, 10 Mar 2009 08:53:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55253.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55253.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55253.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55253.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55253.html</trackback:ping><description><![CDATA[<span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">（转）（精）typedef用法小结 <br><br>这两天在看程序的时候,发现很多地方都用到typedef,在结构体定义,还有一些数组等地方都大量的用到.但是有些地方还不是很清楚,今天下午,就想好好研究一下.上网搜了一下,有不少资料.归纳一下: <br>来源一:Using typedef to Curb Miscreant Code <br>Typedef 声明有助于创建平台无关类型，甚至能隐藏复杂和难以理解的语法。不管怎样，使用 typedef 能为代码带来意想不到的好处，通过本文你可以学习用 typedef 避免缺欠，从而使代码更健壮。 <br>typedef 声明，简称 typedef，为现有类型创建一个新的名字。比如人们常常使用 typedef 来编写更美观和可读的代码。所谓美观，意指 typedef 能隐藏笨拙的语法构造以及平台相关的数据类型，从而增强可移植性和以及未来的可维护性。本文下面将竭尽全力来揭示 typedef 强大功能以及如何避免一些常见的陷阱。 <br>如何创建平台无关的数据类型，隐藏笨拙且难以理解的语法? <br><br>使用 typedefs 为现有类型创建同义字。 <br><br>定义易于记忆的类型名 <br>　　typedef 使用最多的地方是创建易于记忆的类型名，用它来归档程序员的意图。类型出现在所声明的变量名字中，位于 ''typedef'' 关键字右边。例如： <br>typedef int size; <br>　　此声明定义了一个 int 的同义字，名字为 size。注意 typedef 并不创建新的类型。它仅仅为现有类型添加一个同义字。你可以在任何需要 int 的上下文中使用 size： <br>void measure(size * psz); <br>size array[4]; <br>size len = file.getlength(); <br>std::vector <size></size>vs; <br>　　typedef 还可以掩饰符合类型，如指针和数组。例如，你不用象下面这样重复定义有 81 个字符元素的数组： <br>char line[81]; <br>char text[81]; <br>定义一个 typedef，每当要用到相同类型和大小的数组时，可以这样： <br>typedef char Line[81]; <br>Line text, secondline; <br>getline(text); <br>同样，可以象下面这样隐藏指针语法： <br>typedef char * pstr; <br>int mystrcmp(pstr, pstr); <br>　　这里将带我们到达第一个 typedef 陷阱。标准函数 strcmp()有两个&#8216;const char *'类型的参数。因此，它可能会误导人们象下面这样声明 mystrcmp()： <br>int mystrcmp(const pstr, const pstr); <br>　　这是错误的，按照顺序，&#8216;const pstr'被解释为&#8216;char * const'（一个指向 char 的常量指针），而不是&#8216;const char *'（指向常量 char 的指针）。这个问题很容易解决： <br>typedef const char * cpstr; <br>int mystrcmp(cpstr, cpstr); // 现在是正确的 <br>记住：不管什么时候，只要为指针声明 typedef，那么都要在最终的 typedef 名称中加一个 const，以使得该指针本身是常量，而不是对象。 <br><br>代码简化 <br>　　上面讨论的 typedef 行为有点像 #define 宏，用其实际类型替代同义字。不同点是 typedef 在编译时被解释，因此让编译器来应付超越预处理器能力的文本替换。例如： <br>typedef int (*PF) (const char *, const char *); <br>　　这个声明引入了 PF 类型作为函数指针的同义字，该函数有两个 const char * 类型的参数以及一个 int 类型的返回值。如果要使用下列形式的函数声明，那么上述这个 typedef 是不可或缺的： <br>PF Register(PF pf); <br>　　Register() 的参数是一个 PF 类型的回调函数，返回某个函数的地址，其署名与先前注册的名字相同。做一次深呼吸。下面我展示一下如果不用 typedef，我们是如何实现这个声明的： <br>int (*Register (int (*pf)(const char *, const char *))) <br>(const char *, const char *); <br>　　很少有程序员理解它是什么意思，更不用说这种费解的代码所带来的出错风险了。显然，这里使用 typedef 不是一种特权，而是一种必需。持怀疑态度的人可能会问："OK，有人还会写这样的代码吗？"，快速浏览一下揭示 signal()函数的头文件 <csinal></csinal>，一个有同样接口的函数。 <br><br>typedef 和存储类关键字（storage class specifier） <br>　　这种说法是不是有点令人惊讶，typedef 就像 auto，extern，mutable，static，和 register 一样，是一个存储类关键字。这并是说 typedef 会真正影响对象的存储特性；它只是说在语句构成上，typedef 声明看起来象 static，extern 等类型的变量声明。下面将带到第二个陷阱： <br>typedef register int FAST_COUNTER; // 错误 <br>　　编译通不过。问题出在你不能在声明中有多个存储类关键字。因为符号 typedef 已经占据了存储类关键字的位置，在 typedef 声明中不能用 register（或任何其它存储类关键字）。 <br><br>促进跨平台开发 <br>　　typedef 有另外一个重要的用途，那就是定义机器无关的类型，例如，你可以定义一个叫 REAL 的浮点类型，在目标机器上它可以i获得最高的精度： <br>typedef long double REAL; <br>在不支持 long double 的机器上，该 typedef 看起来会是下面这样： <br>typedef double REAL; <br>并且，在连 double 都不支持的机器上，该 typedef 看起来会是这样： 、 <br>typedef float REAL; <br>　 　你不用对源代码做任何修改，便可以在每一种平台上编译这个使用 REAL 类型的应用程序。唯一要改的是 typedef 本身。在大多数情况下，甚至这个微小的变动完全都可以通过奇妙的条件编译来自动实现。不是吗? 标准库广泛地使用 typedef 来创建这样的平台无关类型：size_t，ptrdiff 和 fpos_t 就是其中的例子。此外，象 std::string 和 std::ofstream 这样的 typedef 还隐藏了长长的，难以理解的模板特化语法，例如：basic_string，allocator<char></char>&gt; 和 basic_ofstream&gt;。 <br><br>作者简介 <br>　　Danny Kalev 是一名通过认证的系统分析师，专攻 C++ 和形式语言理论的软件工程师。1997 年到 2000 年期间，他是 C++ 标准委员会成员。最近他以优异成绩完成了他在普通语言学研究方面的硕士论文。 业余时间他喜欢听古典音乐，阅读维多利亚时期的文学作品，研究 Hittite、Basque 和 Irish Gaelic 这样的自然语言。其它兴趣包括考古和地理。Danny 时常到一些 C++ 论坛并定期为不同的 C++ 网站和杂志撰写文章。他还在教育机构讲授程序设计语言和应用语言课程。 <br>来源二：(http://www.ccfans.net/bbs/dispbbs.asp?boardid=30&amp;id=4455) <br>C语言中typedef用法 <br>1. 基本解释 <br><br>　　typedef为C语言的关键字，作用是为一种数据类型定义一个新名字。这里的数据类型包括内部数据类型（int,char等）和自定义的数据类型（struct等）。 <br><br>　　在编程中使用typedef目的一般有两个，一个是给变量一个易记且意义明确的新名字，另一个是简化一些比较复杂的类型声明。 <br><br>　　至于typedef有什么微妙之处，请你接着看下面对几个问题的具体阐述。 <br>　2. typedef &amp; 结构的问题 <br><br>　　当用下面的代码定义一个结构时，编译器报了一个错误，为什么呢？莫非C语言不允许在结构中包含指向它自己的指针吗？请你先猜想一下，然后看下文说明： <br>typedef struct tagNode <br>{ <br>　char *pItem; <br>　pNode pNext; <br>} *pNode; <br>　　答案与分析： <br><br>　　1、typedef的最简单使用 <br>typedef long byte_4; <br>　　给已知数据类型long起个新名字，叫byte_4。 <br><br>　　2、 typedef与结构结合使用 <br>typedef struct tagMyStruct <br>{ <br>　int iNum; <br>　long lLength; <br>} MyStruct; <br>　　这语句实际上完成两个操作： <br><br>　　1) 定义一个新的结构类型 <br>struct tagMyStruct <br>{ <br>　int iNum; <br>　long lLength; <br>}; <br>　　分析：tagMyStruct称为&#8220;tag&#8221;，即&#8220;标签&#8221;，实际上是一个临时名字，struct 关键字和tagMyStruct一起，构成了这个结构类型，不论是否有typedef，这个结构都存在。 <br>　　我们可以用struct tagMyStruct varName来定义变量，但要注意，使用tagMyStruct varName来定义变量是不对的，因为struct 和tagMyStruct合在一起才能表示一个结构类型。 <br>　　2) typedef为这个新的结构起了一个名字，叫MyStruct。 <br>typedef struct tagMyStruct MyStruct; <br>　　因此，MyStruct实际上相当于struct tagMyStruct，我们可以使用MyStruct varName来定义变量。 <br>　　答案与分析 <br>　　C语言当然允许在结构中包含指向它自己的指针，我们可以在建立链表等数据结构的实现上看到无数这样的例子，上述代码的根本问题在于typedef的应用。 <br>　　根据我们上面的阐述可以知道：新结构建立的过程中遇到了pNext域的声明，类型是pNode，要知道pNode表示的是类型的新名字，那么在类型本身还没有建立完成的时候，这个类型的新名字也还不存在，也就是说这个时候编译器根本不认识pNode。 <br><br>　　解决这个问题的方法有多种： <br><br>　　1)、 <br>typedef struct tagNode <br>{ <br>　char *pItem; <br>　struct tagNode *pNext; <br>} *pNode; <br><br>　　2)、 <br>typedef struct tagNode *pNode; <br>struct tagNode <br>{ <br>　char *pItem; <br>　pNode pNext; <br>}; <br>　　注意：在这个例子中，你用typedef给一个还未完全声明的类型起新名字。C语言编译器支持这种做法。 <br><br>　　3)、规范做法： <br>struct tagNode <br>{ <br>　char *pItem; <br>　struct tagNode *pNext; <br>}; <br>typedef struct tagNode *pNode; <br>　3. typedef &amp; #define的问题 <br><br>　　有下面两种定义pStr数据类型的方法，两者有什么不同？哪一种更好一点？ <br>typedef char *pStr; <br>#define pStr char *; <br>　　答案与分析： <br>　　通常讲，typedef要比#define要好，特别是在有指针的场合。请看例子： <br>typedef char *pStr1; <br>#define pStr2 char *; <br>pStr1 s1, s2; <br>pStr2 s3, s4; <br>　　在上述的变量定义中，s1、s2、s3都被定义为char *，而s4则定义成了char，不是我们所预期的指针变量，根本原因就在于#define只是简单的字符串替换而typedef则是为一个类型起新名字。 <br><br>　　#define用法例子： <br>#define f(x) x*x <br>main( ) <br>{ <br>　int a=6，b=2，c； <br>　c=f(a) / f(b)； <br>　printf("%d \\n"，c)； <br>} <br>　　以下程序的输出结果是: 36。 <br>　　因为如此原因，在许多C语言编程规范中提到使用#define定义时，如果定义中包含表达式，必须使用括号，则上述定义应该如下定义才对： <br>#define f(x) (x*x) <br><br>　　当然，如果你使用typedef就没有这样的问题。 <br>　　4. typedef &amp; #define的另一例 <br><br>　　下面的代码中编译器会报一个错误，你知道是哪个语句错了吗？ <br>typedef char * pStr; <br>char string[4] = "abc"; <br>const char *p1 = string; <br>const pStr p2 = string; <br>p1++; <br>p2++; <br>　　答案与分析： <br>　 　是p2++出错了。这个问题再一次提醒我们：typedef和#define不同，它不是简单的文本替换。上述代码中const pStr p2并不等于const char * p2。const pStr p2和const long x本质上没有区别，都是对变量进行只读限制，只不过此处变量p2的数据类型是我们自己定义的而不是系统固有类型而已。因此，const pStr p2的含义是：限定数据类型为char *的变量p2为只读，因此p2++错误。 <br><br>　　#define与typedef引申谈 <br>　　1) #define宏定义有一个特别的长处：可以使用 #ifdef ,#ifndef等来进行逻辑判断，还可以使用#undef来取消定义。 <br>　　2) typedef也有一个特别的长处：它符合范围规则，使用typedef定义的变量类型其作用范围限制在所定义的函数或者文件内（取决于此变量定义的位置），而宏定义则没有这种特性。 <br>　　5. typedef &amp; 复杂的变量声明 <br>　　在编程实践中，尤其是看别人代码的时候，常常会遇到比较复杂的变量声明,使用typedef作简化自有其价值，比如： <br>　　下面是三个变量的声明，我想使用typdef分别给它们定义一个别名，请问该如何做？ <br>&gt;1：int *(*a[5])(int, char*); <br>&gt;2：void (*b[10]) (void (*)()); <br>&gt;3. doube(*)() (*pa)[9]; <br>　　答案与分析： <br><br>　　对复杂变量建立一个类型别名的方法很简单，你只要在传统的变量声明表达式里用类型名替代变量名，然后把关键字typedef加在该语句的开头就行了。 <br>&gt;1：int *(*a[5])(int, char*); <br>//pFun是我们建的一个类型别名 <br>typedef int *(*pFun)(int, char*); <br>//使用定义的新类型来声明对象，等价于int* (*a[5])(int, char*); <br>pFun a[5]; <br><br>&gt;2：void (*b[10]) (void (*)()); <br>//首先为上面表达式蓝色部分声明一个新类型 <br>typedef void (*pFunParam)(); <br>//整体声明一个新类型 <br>typedef void (*pFun)(pFunParam); <br>//使用定义的新类型来声明对象，等价于void (*b[10]) (void (*)()); <br>pFun b[10]; <br><br>&gt;3. doube(*)() (*pa)[9]; <br>//首先为上面表达式蓝色部分声明一个新类型 <br>typedef double(*pFun)(); <br>//整体声明一个新类型 <br>typedef pFun (*pFunParam)[9]; <br>//使用定义的新类型来声明对象，等价于doube(*)() (*pa)[9]; <br>pFunParam pa</span>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55253.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-10 16:53 <a href="http://www.cnitblog.com/chenxin9821/articles/55253.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BOOL和bool的区别 </title><link>http://www.cnitblog.com/chenxin9821/articles/55250.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Tue, 10 Mar 2009 07:20:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55250.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55250.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55250.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55250.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55250.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 10pt; FONT-FAMILY: Courier">一、 <br>1、类型不同 <br>BOOL为int型 <br>bool为布尔型 <br>2、长度不同 <br>bool只有一个字节 <br>BOOL长度视实际环境来定，一般可认为是4个字节 <br>3、取值不同 <br>bool取值false和true，是0和1的区别 <br>BOOL取值FALSE和TRUE，是0和非0的区别 <br><br>二： <br>bool是标准C++数据类型，可取值true和false。单独占一个字节， <br>如果数个bool对象列在一起，可能会各占一个bit，这取决于编译器。 <br><br>BOOL是微软定义的typedef int BOOL。与bool不同，它是一个三值逻辑， <br>TRUE/FALSE/ERROR，返回值为&gt;0的整数为TRUE，0为FALSE，-1为ERROR。 <br>Win32 API中很多返回值为BOOL的函数都是三值逻辑。比如GetMessage(). <br><br>三： 例子 <br>bool x=3;&nbsp; //告警 <br>bool x=1;&nbsp; //正确 <br>BOOL x=3;&nbsp; //正确 <br>BOOL x=3.3;&nbsp; //告警 <br>注：windows为了兼容问题定义的基础变量。 <br>typedef unsigned long&nbsp; &nbsp; &nbsp; &nbsp; DWORD; <br>typedef int&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BOOL; <br>typedef unsigned char&nbsp; &nbsp; &nbsp; &nbsp; BYTE; <br>typedef unsigned short&nbsp; &nbsp; &nbsp; WORD; <br>typedef float&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLOAT; <br>typedef FLOAT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *PFLOAT; <br>typedef BOOL near&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *PBOOL; <br>typedef BOOL far&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *LPBOOL; <br>typedef BYTE near&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *PBYTE; <br>typedef BYTE far&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *LPBYTE; <br>typedef int near&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *PINT; <br>typedef int far&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *LPINT; </p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55250.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-10 15:20 <a href="http://www.cnitblog.com/chenxin9821/articles/55250.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>#ifdef</title><link>http://www.cnitblog.com/chenxin9821/articles/55249.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Tue, 10 Mar 2009 07:09:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55249.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55249.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55249.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55249.html</trackback:ping><description><![CDATA[<div>这几个宏是为了进行条件编译。一般情况下，源程序中所有的行都参加编译。但是有时希望对其中一部分内容只在满足一定条件才进行编译，也就是对一部分内容指定编译的条件，这就是&#8220;条件编译&#8221;。有时，希望当满足某条件时对一组语句进行编译，而当条件不满足时则编译另一组语句。 <br>&nbsp;&nbsp;&nbsp; 条件编译命令最常见的形式为： <br>&nbsp;&nbsp;&nbsp; #ifdef 标识符 <br>&nbsp;&nbsp;&nbsp; 程序段1 <br>&nbsp;&nbsp;&nbsp; #else <br>&nbsp;&nbsp;&nbsp; 程序段2 <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 它的作用是：当标识符已经被定义过(一般是用#define命令定义)，则对程序段1进行编译，否则编译程序段2。 <br>&nbsp;&nbsp;&nbsp; 其中#else部分也可以没有，即： <br>&nbsp;&nbsp;&nbsp; #ifdef <br>&nbsp;&nbsp;&nbsp; 程序段1 <br>&nbsp;&nbsp;&nbsp; #denif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 这里的&#8220;程序段&#8221;可以是语句组，也可以是命令行。这种条件编译可以提高C源程序的通用性。如果一个C源程序在不同计算机系统上系统上运行，而不同的计算机又有一定的差异。例如，我们有一个数据类型，在Windows平台中，应该使用long类型表示，而在其他平台应该使用float表示，这样往往需要对源程序作必要的修改，这就降低了程序的通用性。可以用以下的条件编译： <br>&nbsp;&nbsp;&nbsp; #ifdef WINDOWS <br>&nbsp;&nbsp;&nbsp; #define MYTYPE long <br>&nbsp;&nbsp;&nbsp; #else <br>&nbsp;&nbsp;&nbsp; #define MYTYPE float <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 如果在Windows上编译程序，则可以在程序的开始加上 <br>&nbsp;&nbsp;&nbsp; #define WINDOWS <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 这样则编译下面的命令行： <br>&nbsp;&nbsp;&nbsp; #define MYTYPE long <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 如果在这组条件编译命令之前曾出现以下命令行： <br>&nbsp;&nbsp;&nbsp; #define WINDOWS 0 <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 则预编译后程序中的MYTYPE都用float代替。这样，源程序可以不必作任何修改就可以用于不同类型的计算机系统。当然以上介绍的只是一种简单的情况，可以根据此思路设计出其它的条件编译。 <br>&nbsp;&nbsp;&nbsp; 例如，在调试程序时，常常希望输出一些所需的信息，而在调试完成后不再输出这些信息。可以在源程序中插入以下的条件编译段： <br>&nbsp;&nbsp;&nbsp; #ifdef DEBUG <br>&nbsp;&nbsp;&nbsp; print ("device_open(%p)\n", file); <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 如果在它的前面有以下命令行： <br>&nbsp;&nbsp;&nbsp; #define DEBUG <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 则在程序运行时输出file指针的值，以便调试分析。调试完成后只需将这个define命令行删除即可。有人可能觉得不用条件编译也可达此目的，即在调试时加一批printf语句，调试后一一将printf语句删除去。的确，这是可以的。但是，当调试时加的printf语句比较多时，修改的工作量是很大的。用条件编译，则不必一一删改printf语句，只需删除前面的一条&#8220;#define DEBUG&#8221;命令即可，这时所有的用DEBUG作标识符的条件编译段都使其中的printf语句不起作用，即起统一控制的作用，如同一个&#8220;开关&#8221;一样。 <br>&nbsp;&nbsp;&nbsp; 有时也采用下面的形式： <br>&nbsp;&nbsp;&nbsp; #ifndef 标识符 <br>&nbsp;&nbsp;&nbsp; 程序段1 <br>&nbsp;&nbsp;&nbsp; #else <br>&nbsp;&nbsp;&nbsp; 程序段2 <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 只是第一行与第一种形式不同：将&#8220;ifdef&#8221;改为&#8220;ifndef&#8221;。它的作用是：若标识符未被定义则编译程序段1，否则编译程序段2。这种形式与第一种形式的作用相反。 <br>&nbsp;&nbsp;&nbsp; 以上两种形式用法差不多，根据需要任选一种，视方便而定。 <br>&nbsp;&nbsp;&nbsp; 还有一种形式，就是#if后面的是一个表达式，而不是一个简单的标识符： <br>&nbsp;&nbsp;&nbsp; #if 表达式 <br>&nbsp;&nbsp;&nbsp; 程序段1 <br>&nbsp;&nbsp;&nbsp; #else <br>&nbsp;&nbsp;&nbsp; 程序段2 <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 它的作用是：当指定的表达式值为真（非零）时就编译程序段1，否则编译程序段2。可以事先给定一定条件，使程序在不同的条件下执行不同的功能。 <br>&nbsp;&nbsp;&nbsp; 例如：输入一行字母字符，根据需要设置条件编译，使之能将字母全改为大写输出，或全改为小写字母输出。 <br>&nbsp;&nbsp;&nbsp; #define LETTER 1 <br>&nbsp;&nbsp;&nbsp; main() <br>&nbsp;&nbsp;&nbsp; { <br>&nbsp;&nbsp;&nbsp; char str[20]="C Language",c; <br>&nbsp;&nbsp;&nbsp; int i=0; <br>&nbsp;&nbsp;&nbsp; while((c=str[i])!='\0'){ <br>&nbsp;&nbsp;&nbsp; i++; <br>&nbsp;&nbsp;&nbsp; #if LETTER <br>&nbsp;&nbsp;&nbsp; if(c&gt;='a'&amp;&amp;c&lt;='z') c=c-32; <br>&nbsp;&nbsp;&nbsp; #else <br>&nbsp;&nbsp;&nbsp; if(c&gt;='A'&amp;&amp;c&lt;='Z') c=c+32; <br>&nbsp;&nbsp;&nbsp; #endif <br>&nbsp;&nbsp;&nbsp; printf("%c",c); <br>&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 运行结果为：C LANGUAGE <br>&nbsp;&nbsp;&nbsp; 现在先定义LETTER为1，这样在预处理条件编译命令时，由于LETTER为真（非零），则对第一个if语句进行编译，运行时使小写字母变大写。如果将程序第一行改为： <br>&nbsp;&nbsp;&nbsp; #define LETTER 0 <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 则在预处理时，对第二个if语句进行编译处理，使大写字母变成小写字母（大写字母与相应的小写字母的ASCII代码差32）。此时运行情况为： <br>&nbsp;&nbsp;&nbsp; c language <br>&nbsp;&nbsp;&nbsp; 有人会问：不用条件编译命令而直接用if语句也能达到要求，用条件编译命令有什么好处呢？的确，此问题完全可以不用条件编译处理，但那样做目标程序长（因为所有语句都编译），而采用条件编译，可以减少被编译的语句，从而减少目标的长度。当条件编译段比较多时，目标程序长度可以大大减少。</div>
<strong><font color=#000099>原文地址</font></strong> <a href="http://hi.baidu.com/liang1983/blog/item/b59a2c737edf961c8701b0e0.html" target=_blank>http://hi.baidu.com/liang1983/blog/item/b59a2c737edf961c8701b0e0.html</a> 
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-10 15:09 <a href="http://www.cnitblog.com/chenxin9821/articles/55249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hInstance</title><link>http://www.cnitblog.com/chenxin9821/articles/55247.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Tue, 10 Mar 2009 06:43:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/articles/55247.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/55247.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/articles/55247.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/55247.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/55247.html</trackback:ping><description><![CDATA[<span style="FONT-SIZE: 10pt">1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 熟悉C编程的人都知道main函数带有2个参数：arc和argv，完整的main函数定义是：int main(int argc, char *argv[])。argc指示程序启动时命令行参数的个数，argv则包含具体的参数字符串。</span>
<p style="FONT-SIZE: 10pt">&nbsp; 如果有程序叫&#8220;hello.exe&#8221;，直接启动时，argc=1, argv[0]=hello.exe。</p>
<p style="FONT-SIZE: 10pt">&nbsp; 如果以&#8220;hello.exe&nbsp; readme.txt&#8221;的形式启动，argc=2, argv[0]=hello.exe, argv[1]=readme.txt</p>
<p style="FONT-SIZE: 10pt">&nbsp; 通过这两个参数，程序可以获知自身在启动时的命令行信息。</p>
<p style="FONT-SIZE: 10pt">&nbsp;2. &nbsp;&nbsp;&nbsp; 而在WinMain函数中，带有4个参数，分别是：hInstance, hPrevInstance, lpCmdLine, nShowCmd。今天就探讨hInstance的含义。</p>
<p style="FONT-SIZE: 10pt">hInstance是程序的当前实例的句柄(进程句柄)。在Windows这样的多任务操作系统中，一个程序可以同时运行多个实例。不同的实例间需要彼此区别，句柄就是干这个的。<br><br>3.&nbsp;此外，<br><br>&nbsp; HINSTANCE &nbsp; 是进程句柄； &nbsp; <br>&nbsp; HANDLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是对象句柄； &nbsp; <br>&nbsp; CWnd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是MFC的一个类，所有窗口类从其派生； &nbsp; <br>&nbsp; HWND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是窗口的句柄。</p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/55247.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-03-10 14:43 <a href="http://www.cnitblog.com/chenxin9821/articles/55247.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>