﻿<?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博客-射手的博客-随笔分类-Windows API 函数</title><link>http://www.cnitblog.com/Archer/category/8229.html</link><description>学习Delphi,需要一个记录学习的博客,</description><language>zh-cn</language><lastBuildDate>Wed, 28 Sep 2011 14:38:52 GMT</lastBuildDate><pubDate>Wed, 28 Sep 2011 14:38:52 GMT</pubDate><ttl>60</ttl><item><title>Windows API 函数: SetClassLong</title><link>http://www.cnitblog.com/Archer/archive/2009/04/13/56305.html</link><dc:creator>Archer</dc:creator><author>Archer</author><pubDate>Mon, 13 Apr 2009 03:21:00 GMT</pubDate><guid>http://www.cnitblog.com/Archer/archive/2009/04/13/56305.html</guid><wfw:comment>http://www.cnitblog.com/Archer/comments/56305.html</wfw:comment><comments>http://www.cnitblog.com/Archer/archive/2009/04/13/56305.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Archer/comments/commentRss/56305.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Archer/services/trackbacks/56305.html</trackback:ping><description><![CDATA[<span  style="color: rgb(0, 0, 102); font-family: verdana; "><div class="posttitle" style="padding-top: 5px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; "><br></div><p style="font-size: small; color: rgb(0, 0, 0); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; word-wrap: break-word; ">&nbsp;SetClassLong&nbsp;&nbsp;<span style="font-size: 10pt; font-family: 'Comic Sans MS'; ">常用于替换光标样式,增添美观性;</span></p><div style="padding-right: 5px; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: rgb(204, 204, 204); width: 777px; word-break: break-all; padding-top: 4px; height: 114px; background-color: rgb(238, 238, 238); "><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><span style="color: rgb(0, 0, 0); ">DWORD&nbsp;SetClassLong(<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;HWND&nbsp;hWnd,&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">&nbsp;handle&nbsp;of&nbsp;window&nbsp;(窗口句柄)</span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255); ">int</span><span style="color: rgb(0, 0, 0); ">&nbsp;nIndex,&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">&nbsp;index&nbsp;of&nbsp;value&nbsp;to&nbsp;change (设置的属性)</span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">&nbsp;&nbsp;&nbsp;&nbsp;LONG&nbsp;dwNewLong&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">&nbsp;new&nbsp;value (设置的属性的值)</span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">&nbsp;&nbsp;&nbsp;);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span></div><br><div style="padding-right: 5px; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: rgb(204, 204, 204); width: 777px; word-break: break-all; padding-top: 4px; background-color: rgb(238, 238, 238); "><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><span style="color: rgb(0, 0, 0); ">nlndex&nbsp;&nbsp;属性索引</span></div><div style="padding-right: 5px; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: rgb(204, 204, 204); width: 777px; word-break: break-all; padding-top: 4px; background-color: rgb(238, 238, 238); "><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><span>　　GCL_CBCLSEXTRA：<br>//设置与类相关的尺寸的字节大小。设定该值不改变己分配的额外字节数。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">　　GCL_CBWNDEXTRA：<br>//设置与类中的每一个窗口相关的尺寸的字节大小。设定该值不改变已分配额外字节数。查看如何进入该内存，参看SetWindowLOng。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">　　GCL_HERBACKGROUND：<br>//替换与类有关的背景刷子的句柄。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">　　GCL_HCURSOR：<br>//替换与类有关的光标的句柄。<span style="color: red; ">{替换指定窗口中的光标图标,dwNewLong 读取光标位置 如 '1.ani'}</span><br>GCL_HICON：<br>//替换与类有关的图标的句柄。&nbsp;<span style="color: rgb(255, 0, 0); ">{<font color="#ff0000">替换指定窗口中的程序图标,dwNewLong 读取图标位置 如 '1.ico'</font>}</span>　　<br>GCL_HMODULE：<br>//替换注册类的模块的句柄。<br>GCL_STYLE：<br>//替换窗口类的风格位。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">　　CGL_MENUNAME&nbsp;：<br>//替换菜单名字符串的地址。该字符串标识与类有关的菜单资源。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">　　GCL_WNDPROC&nbsp;：<br>//替换与窗口类有关的窗口过程的地址。<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span></div><p style="font-size: small; color: rgb(0, 0, 0); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; word-wrap: break-word; ">例:<br></p><p style="font-size: small; color: rgb(0, 0, 0); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; word-wrap: break-word; ">&nbsp;</p><div style="padding-right: 5px; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: rgb(204, 204, 204); width: 777px; word-break: break-all; padding-top: 4px; background-color: rgb(238, 238, 238); "><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><span style="color: rgb(0, 0, 0); ">unit&nbsp;Unit1;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 255); ">interface</span><span style="color: rgb(0, 0, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">uses<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;Windows,&nbsp;Messages,&nbsp;SysUtils,&nbsp;Classes,&nbsp;Graphics,&nbsp;Controls,&nbsp;Forms,&nbsp;Dialogs,<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;StdCtrls,&nbsp;jpeg,&nbsp;ExtCtrls,xpman;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">type<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;TForm1&nbsp;</span><span style="color: rgb(0, 0, 0); ">=</span><span style="color: rgb(0, 0, 0); ">&nbsp;</span><span style="color: rgb(0, 0, 255); ">class</span><span style="color: rgb(0, 0, 0); ">(TForm)<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Button1:&nbsp;TButton;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Image1:&nbsp;TImage;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Image2:&nbsp;TImage;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;FormCreate(Sender:&nbsp;TObject);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;Button1Click(Sender:&nbsp;TObject);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255); ">private</span><span style="color: rgb(0, 0, 0); "><br><img id="Codehighlighter1_333_356_Open_Image" onclick="this.style.display='none'; Codehighlighter1_333_356_Open_Text.style.display='none'; Codehighlighter1_333_356_Closed_Image.style.display='inline'; Codehighlighter1_333_356_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_333_356_Open_Text"><span style="color: rgb(0, 0, 0); ">{&nbsp;Private&nbsp;declarations&nbsp;}</span></span><span style="color: rgb(0, 0, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255); ">public</span><span style="color: rgb(0, 0, 0); "><br><img id="Codehighlighter1_371_393_Open_Image" onclick="this.style.display='none'; Codehighlighter1_371_393_Open_Text.style.display='none'; Codehighlighter1_371_393_Closed_Image.style.display='inline'; Codehighlighter1_371_393_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_371_393_Open_Text"><span style="color: rgb(0, 0, 0); ">{&nbsp;Public&nbsp;declarations&nbsp;}</span></span><span style="color: rgb(0, 0, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;end;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">var<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;Form1:&nbsp;TForm1;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">implementation<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img id="Codehighlighter1_439_448_Open_Image" onclick="this.style.display='none'; Codehighlighter1_439_448_Open_Text.style.display='none'; Codehighlighter1_439_448_Closed_Image.style.display='inline'; Codehighlighter1_439_448_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span id="Codehighlighter1_439_448_Open_Text"><span style="color: rgb(0, 0, 0); ">{$R&nbsp;</span><span style="color: rgb(0, 0, 0); ">*</span><span style="color: rgb(0, 0, 0); ">.DFM}</span></span><span style="color: rgb(0, 0, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">procedure&nbsp;TForm1.FormCreate(Sender:&nbsp;TObject);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">var<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;HNewCursor:&nbsp;Hcursor;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">begin<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;HNewcursor:</span><span style="color: rgb(0, 0, 0); ">=</span><span style="color: rgb(0, 0, 0); ">LoadCursorfromfile(</span><span style="color: rgb(0, 0, 0); ">'</span><span style="color: rgb(0, 0, 0); ">1.ANI</span><span style="color: rgb(0, 0, 0); ">'</span><span style="color: rgb(0, 0, 0); ">);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">调用API函数装载动画光标文件,ANI文件路径请根据自己的实际情况进行调整</span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">&nbsp;&nbsp;SetClassLong(Form1.Handle,GCL_HCURSOR,<span style="color: rgb(128, 0, 0); ">HNEWCURSOR</span>);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">替换光标为制定光标.</span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">end;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">procedure&nbsp;TForm1.Button1Click(Sender:&nbsp;TObject);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">begin<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;HoldCursor:</span><span style="color: rgb(0, 0, 0); ">=</span><span style="color: rgb(0, 0, 0); ">SetClassLong(Form1.Handle,GCL_HCURSOR,</span><span style="color: rgb(128, 0, 0); ">0</span><span style="color: rgb(0, 0, 0); ">);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;Close;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0); ">//</span><span style="color: rgb(0, 128, 0); ">在结束程序前一定不要忘记恢复光标,<span style="color: rgb(128, 0, 0); ">属性值0我的理解应该是还原为系统光标</span></span><span style="color: rgb(0, 128, 0); "><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "></span><span style="color: rgb(0, 0, 0); ">end;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">end.</span></div><p style="font-size: small; color: rgb(0, 0, 0); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; word-wrap: break-word; ">&nbsp;</p></span>
<img src ="http://www.cnitblog.com/Archer/aggbug/56305.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Archer/" target="_blank">Archer</a> 2009-04-13 11:21 <a href="http://www.cnitblog.com/Archer/archive/2009/04/13/56305.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>API函数 LoadLibrary,GetPorcAddress,FreeLibrary 函数 理解</title><link>http://www.cnitblog.com/Archer/archive/2009/03/28/55831.html</link><dc:creator>Archer</dc:creator><author>Archer</author><pubDate>Sat, 28 Mar 2009 13:49:00 GMT</pubDate><guid>http://www.cnitblog.com/Archer/archive/2009/03/28/55831.html</guid><wfw:comment>http://www.cnitblog.com/Archer/comments/55831.html</wfw:comment><comments>http://www.cnitblog.com/Archer/archive/2009/03/28/55831.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Archer/comments/commentRss/55831.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Archer/services/trackbacks/55831.html</trackback:ping><description><![CDATA[
<p>*HMODULE*&nbsp;这3个函数中相同的函数.我理解的含义.<br>&nbsp; 此函数得到一个将 动态链接库 载入 内存 后得到的地址;<br>&nbsp; 内存地址是16进制的.编译器自动转换为10进制数, 所以得到一个10进制的"内存地址". <br>&nbsp; 我们称这样指向一个动态链接库的叫做''模块句柄'',其实就是一个指针.<br>LoadLibrary 函数,将一个指定的动态链接库加载到当前程序中.</p>
<div><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top">function&nbsp;LoadLibrary(lpLibFileName:&nbsp;PChar):&nbsp;HMODULE;&nbsp;stdcall;</div>
<br>&nbsp;-------<br>&nbsp;lpLibFileName:&nbsp;PChar 指定要载入的动态链接库的名称 <br>&nbsp;-------&nbsp;&nbsp;<br>&nbsp;Windows.pas&nbsp;下<br>&nbsp;&nbsp; HMODULE = System.HMODULE;<br>&nbsp; system.pas 下&nbsp;<br>&nbsp; HMODULE = HINST;<br>&nbsp;-------- <br>&nbsp;HINST = THandle;<br>&nbsp;--------<br>&nbsp; THandle = LongWord;&nbsp; {0..4294967295}<br>&nbsp; 最后此函数返回一个LongWord值,返回指定的动态链接库 ("DLL") 在程序当中的映像地址.(指当前调用此函数的程序).<br>-----------------------------------------------------------------------------------------------------------------------------------------<br>GetProcAddress 指定返回一个在动态链接库中的例程地址.<br>
<div><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top">function&nbsp;GetProcAddress(hModule:&nbsp;HMODULE;&nbsp;lpProcName:&nbsp;LPCSTR):&nbsp;FARPROC;&nbsp;stdcall;</div>
<p>&nbsp;&nbsp;&nbsp; Hmodule:HMODULE; //指定一个<span style="COLOR: red">已经加载到程序中</span>的动态链接库映像地址.</p>
<p>&nbsp;&nbsp;--------------</p>
<p>&nbsp;&nbsp; lpProcName:&nbsp;LPCSTR;&nbsp; // {LPCSTR = PAnsiChar;} 指定一个在动态链接库中的例程名;<br>&nbsp;---------------<br>&nbsp; FARPROC;//{&nbsp;FARPROC = Pointer; } 返回一个指向此例程的指针.</p>
-----------------------------------------------------------------------------------------------------------------------------------------<br>&nbsp; Freelibrary 释放指定的动态链接库，此动态链接库必须被LoadLibrary函数 加载到程序内存当中.<br>
<div style="padding-right: 5px; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left-color: rgb(204, 204, 204); width: 98%; word-break: break-all; padding-top: 4px; background-color: rgb(238, 238, 238); "><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align="top"><span style="COLOR: #000000">function&nbsp;FreeLibrary(hLibModule:&nbsp;HMODULE):&nbsp;BOOL;&nbsp;stdcall;</span></div>
&nbsp;&nbsp; hLibModule:&nbsp;HMODULE ////指定一个<span style="COLOR: red">已经加载到程序中</span>的动态链接库映像地址. <br>-----------<br>&nbsp;&nbsp; BOOL; //{ BOOL = LongBool&nbsp;; } 0 作为 False,非 0 作为 True。&nbsp; 当非零时则为释放成功,为零则释放失败! <img src ="http://www.cnitblog.com/Archer/aggbug/55831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Archer/" target="_blank">Archer</a> 2009-03-28 21:49 <a href="http://www.cnitblog.com/Archer/archive/2009/03/28/55831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>