📄 能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--it科技频道.htm
字号:
document.search.action='http://www.no1edu.net/news/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1015){
document.search.action='http://www.no1edu.net/It/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1017){
document.search.action='http://www.no1edu.net/English/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1019){
document.search.action='http://www.no1edu.net/School/search.asp';
document.search.Field.value='SoftName';
}
else if(ChannelID==1023){
document.search.action='http://www.no1edu.net/Ms/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1004){
document.search.action='http://www.no1edu.net/Health/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1012){
document.search.action='http://www.no1edu.net/download/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1025){
document.search.action='http://www.no1edu.net/art/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1021){
document.search.action='http://www.no1edu.net/design/search.asp';
document.search.Field.value='Title';
}
else if(ChannelID==1024){
document.search.action='http://www.no1edu.net/pic/search.asp';
document.search.Field.value='Title';
}
return false;
}
</SCRIPT>
</TD></TR></TBODY></TABLE></TD></TR></TABLE><!--导航代码结束--><!-- ********网页顶部代码结束******** --><!-- ********网页中部代码开始******** -->
<TABLE class=center_tdbgall style="WORD-BREAK: break-all" cellSpacing=0
cellPadding=0 width=760 align=center border=0>
<TBODY>
<TR>
<TD vAlign=top width=*><!--网页中部左栏文章内容代码开始-->
<TABLE style="WORD-BREAK: break-all" cellSpacing=0 cellPadding=0
width="100%" align=center border=0>
<TBODY>
<TR>
<TD class=main_title_282 vAlign=center width="3%"><IMG height=28
src="能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--IT科技频道.files/ad_dh.gif"
width=29 align=absMiddle></TD>
<TD class=main_title_282 width="66%">能否详细讲述一下什么是回调函数以及如何使用回调函数.</TD>
<TD class=main_title_282
align=middle> <FONT
color=#009999></FONT></TD></TR></TBODY></TABLE>
<TABLE class=main_tdbg_575 style="WORD-BREAK: break-all" cellSpacing=0
cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR vAlign=center align=middle>
<TD class=main_ArticleTitle style="WORD-BREAK: break-all"
background="能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--IT科技频道.files/ad_dybg2.gif"
colSpan=2 height=48>能否详细讲述一下什么是回调函数以及如何使用回调函数.</TD></TR>
<TR vAlign=center align=middle>
<TD style="WORD-BREAK: break-all" bgColor=#f8f8f8 colSpan=2
height=22><A href="http://it.no1edu.net/"><FONT
color=#ff6600>it.no1edu.net</FONT></A> 佚名 不详 2006-11-25
23:23:07</TD></TR>
<TR align=middle>
<TD colSpan=2 height=24> </TD></TR>
<TR>
<TD colSpan=2 height=6></TD></TR>
<TR>
<TD colSpan=2></TD></TR>
<TR>
<TD id=fontzoom style="WORD-BREAK: break-all" vAlign=top colSpan=2
height=600>
<P>THX ALL <BR><BR>callback <BR>The callback attribute declares a
static callback function that exists on the client side of the
distributed application. Callback functions provide a way for the
server to execute code on the client. <BR><BR>[callback [ ,
function-attr-list] ] type-specifier [ptr-declarator] function-name(
<BR>[ [attribute-list] ] type-specifier [declarator] <BR>, ...);
<BR><BR>function-attr-list <BR>Specifies zero or more attributes
that apply to the function. Valid function attributes are local; the
pointer attribute ref, unique, or ptr; and the usage attributes
string, ignore, and context_handle. Separate multiple attributes
with commas. <BR>type-specifier <BR>Specifies a base_type, struct,
union, enum type, or type identifier. An optional storage
specification can precede type-specifier. <BR>ptr-declarator
<BR>Specifies zero or more pointer declarators. A pointer declarator
is the same as the pointer declarator used in C; it is constructed
from the * designator, modifiers such as far, and the qualifier
const. <BR>function-name <BR>Specifies the name of the remote
procedure. <BR>attribute-list <BR>Specifies zero or more directional
attributes, field attributes, usage attributes, and pointer
attributes appropriate for the specified parameter type. Separate
multiple attributes with commas. <BR>declarator <BR>Specifies a
standard C declarator such as identifiers, pointer declarators, and
array declarators. For more information, see Array and Sized-Pointer
Attributes, arrays, and Arrays and Pointers. The parameter-name
identifier is optional. <BR>Remarks <BR>The callback function is
useful when the server must obtain information from the client. If
server applications were supported on Windows 3.x, the server could
make a call to a remote procedure on the Windows 3.x server to
obtain the needed information. The callback function accomplishes
the same purpose and lets the server query the client for
information in the context of the original call. <BR><BR>Callbacks
are special cases of remote calls that execute as part of a single
thread. A callback is issued in the context of a remote call. Any
remote procedure defined as part of the same interface as the static
callback function can call the callback function. <BR><BR>Only the
connection-oriented and local protocol sequences support the
callback attribute. If an RPC interface uses a connectionless
(datagram) protocol sequence, calls to procedures with the callback
attribute will fail. <BR><BR>Handles cannot be used as parameters in
callback functions. Because callbacks always execute in the context
of a call, the binding handle used by the client to make the call to
the server is also used as the binding handle from the server to the
client. <BR><BR>Callbacks can nest to any depth. <BR><BR>Example
<BR>[callback] HRESULT DisplayString([in, string] char * p1);
<BR><BR><BR><BR>回调函数是由系统多次调用的函数, <BR>举个例子,一台PC有一 RIVA128,和一Voodoo2
<BR>系统默认会使用RIVA128,我们如何使用Voodoo2呢, <BR>这时要使用回调函数进行查找,
<BR><BR>定义全局变量保存我们想要的GUID: GUID voodooGUID = NULL; <BR>定义回调函数:
<BR>BOOL WINAPI DDEnumCallback( <BR>GUID FAR *lpGUID, <BR>LPSTR
lpDriverDescription, <BR>LPSTR lpDriverName, <BR>LPVOID lpContext
<BR>) <BR>{ <BR>if(*lpDriverName == RIVA_128) // 注:这里的设备名只是举例而已
<BR>return FALSE; // 继续查找 <BR><BR>if*(lpDriverName == Voodoo2) <BR>{
<BR>// 正是我们想要的 <BR>voodooGUID = *lpGUID; <BR>return TRUE; // 结束查找
<BR>} <BR>} <BR><BR>主程序:
<BR>if(DirectDrawEnumerate(DDEnumCallback,NULL) == DD_OK) <BR>{
<BR>// 函数成功返回,已获得Voodoo2的GUID <BR>// 使用Voodoo2的GUID建立DirectDraw
<BR>DirectDrawCreate(&voodoo2GUID,lplpDD,NULL); <BR>}
<BR>也就是说系统将多次自动调用回调函数查找每一张显卡,直到找完或由你结束. <BR>这只是回调函数的一个典型例子.
<BR><BR></P>
<P align=left>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-7770235465895867";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "E1771E";
google_color_text = "3D81EE";
google_color_url = "008000";
//--></SCRIPT>
<SCRIPT
src="能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--IT科技频道.files/show_ads.js"
type=text/javascript>
</SCRIPT>
</P></TD></TR>
<TR>
<TD class=left_tdbgall align=right colSpan=2
height=24>文章录入:紫水晶 责任编辑:紫水晶 </TD></TR>
<TR>
<TD width=5></TD>
<TD width=787>
<P align=center><!-- Search Google -->
<CENTER>
<FORM action=http://www.no1edu.net/search.asp method=get
target=_top>
<TABLE bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top noWrap align=left height=32><A
href="http://www.google.com/"><IMG alt=Google
src="能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--IT科技频道.files/Logo_25wht.gif"
align=middle border=0></IMG></A> <INPUT maxLength=255 size=22
name=q></INPUT> <INPUT type=submit value=搜索 name=sa></INPUT>
<INPUT type=hidden value=pub-7770235465895867
name=client></INPUT> <INPUT type=hidden value=1
name=forid></INPUT> <INPUT type=hidden value=GB2312
name=ie></INPUT> <INPUT type=hidden value=GB2312
name=oe></INPUT> <INPUT type=hidden
value=GALT:#006600;GL:1;DIV:#FFFFFF;VLC:FF3300;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:FF3300;LC:FF3300;T:000000;GFNT:CCCCFF;GIMP:CCCCFF;LH:0;LW:0;L:http://www.no1edu.net/images/logo.gif;S:http://;LP:1;FORID:11
name=cof></INPUT> <INPUT type=hidden value=zh-CN
name=hl></INPUT> </TD></TR></TBODY></TABLE></FORM></CENTER><!-- Search Google -->
<P></P>
<P align=center>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-7770235465895867";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as_rimg";
google_cpa_choice = "CAAQycb8zwEaCNrmdvgKt1bFKJnA93M";
//--></SCRIPT>
<SCRIPT
src="能否详细讲述一下什么是回调函数以及如何使用回调函数_ 中华学习网--IT科技频道.files/show_ads.js"
type=text/javascript>
</SCRIPT>
</P>
<P>
<LI>上一篇文章: <A class=LinkPrevArticle
title="文章标题:请教:如何在程序运行时锁定屏幕? 作 者:佚名 更新时间:2006-11-25 23:23:03"
href="http://www.no1edu.net/it/program/know/vcmfc/200611/193565.shtml">请教:如何在程序运行时锁定屏幕?</A><BR>
<LI>下一篇文章: <A class=LinkNextArticle
title="文章标题:请教:如何用VC5.0编写WEB浏览器 作 者:佚名 更新时间:2006-11-25 23:23:08"
href="http://www.no1edu.net/it/program/know/vcmfc/200611/193567.shtml">请教:如何用VC5.0编写WEB浏览器</A>
<P></P></LI></TD></TR>
<TR class=left_tdbgall align=right>
<TD colSpan=2 height=24>【字体:<A class=top_UserLogin
href="javascript:fontZoomA();">小</A> <A class=top_UserLogin
href="javascript:fontZoomB();">大</A>】【<A
href="http://www.no1edu.net/it/Comment.asp?ArticleID=193566"
target=_blank>发表评论</A>】【<A
href="http://www.no1edu.net/User/User_Favorite.asp?Action=Add&ChannelID=1015&InfoID=193566"
target=_blank>加入收藏</A>】【<A
href="http://www.no1edu.net/it/SendMail.asp?ArticleID=193566"
target=_blank>告诉好友</A>】【<A
href="http://www.no1edu.net/it/Print.asp?ArticleID=193566"
target=_blank>打印此文</A>】【<A
href="javascript:window.close();">关闭窗口</A>】 </TD></TR></TBODY></TABLE><!--网页中部左栏文章内容代码结束-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle height=70> </TD></TR></TBODY></TABLE></TD>
<TD style="BORDER-LEFT: #a7a9a7 1px solid" vAlign=top width=180
bgColor=#f8f8f8><!--网页中部右栏代码开始-->
<DIV align=center></DIV>
<DIV align=center></DIV>
<TABLE style="WORD-BREAK: break-all" cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR>
<TD class=left_title> </TD></TR>
<TR>
<TD class=left_tdbg1>
<DIV align=center>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-7770235465895867";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "E1771E";
google_color_text = "0066CC";
google_color_url = "008000";
//--></SCRIPT>
<SCRIPT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -