📄 115989.htm
字号:
<html xmlns="http://www.w3.org/TR/xhtml1/strict"> <head> <title>天极网</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></meta> <meta http-equiv="Pragma" content="no-cache"></meta> <meta http-equiv="expires" content="Mon,12 May 1998 00:36:05 GMT"></meta> <link rel="stylesheet" href="/xslimages/css/cpcw.css"></link> </head> <style>.nava { font-size: 9pt}.font1{font-size: 10.5pt}</style> <body bgcolor="#FFFFFF" topmargin="2"><table width="760" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td width="20%" rowspan="3" valign="top" align="center"><table width="95%" border="1" cellspacing="0" cellpadding="0" height="60" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF"><tr valign="middle" align="center"><td><div align="center"><span class="nava">天极硬件,新闻及时<br>资料详尽,敬请关注<br><a href="/33554432/35651584/yingjian.htm">www.myhard.com</a></span></div></td></tr></table></td><td width="57%" valign="bottom" rowspan="3" align="center"><div align="center"><script language="JavaScript" src="http://ad.cpcw.com/js/school.js"></script></div></td><td width="20%" valign="top" rowspan="3" align="center"><table width="95%" border="1" cellspacing="0" cellpadding="0" height="60" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF"><tr valign="middle" align="center"><td><div align="center"><span class="nava">好又多电子商务<br>让您一点动心<br><a href="http://www.hoyodo.com">www.hoyodo.com</a></span></div></td></tr></table></td></tr><tr></tr><tr></tr></table><table width="760" border="0" cellspacing="0" cellpadding="0" height="70" align="center"><tr><td width="145" valign="bottom" rowspan="3"><img src="/xslimages/content/logo.gif" width="140" height="60"></img></td><td colspan="3" width="100%" height="33" align="center"><a href="/" target="_blank">首页</a>| <a href="/33554432/36700160/news.htm" target="_blank">新闻中心</a>| <a href="/33554432/50331648/business.htm" target="_blank">企业中心</a>| <a href="/33554432/41943040/caijing.htm" target="_blank">财经中心</a>| <a href="/33554432/39845888/fashion.htm" target="_blank">时尚中心</a>| <a href="/33554432/35651584/yingjian.htm" target="_blank">硬件中心</a>| <a href="/33554432/34603008/school.htm" target="_blank">学习中心</a>| <a href="/33554432/37748736/game.htm" target="_blank">游戏中心</a>| <a href="/33554432/38797312/ziyuan.htm" target="_blank">资源中心</a>| <a href="http://www.hoyodo.com/" target="_blank">社区</a>| <a href="http://training.yesky.com/" target="_blank">网校</a></td></tr><tr><td colspan="3" width="78%" height="20" align="right"><b>中心栏目:<a href="http://www.mydown.com" target="_blank"><font color="#FF0000"><u>红辣椒软件下载</u></font></a></b><a href="http://soft.yesky.com" target="_blank"> 软件之窗 </a><a href="http://desktop.yesky.com" target="_blank">天极桌面网 </a><a href="http://art.yesky.com" target="_blank">美工教室 </a><a href="http://itdreamer.yesky.com" target="_blank">程序方舟 </a><a href="http://homepage.yesky.com" target="_blank">网页陶吧 </a><a href="http://safe.yesky.com" target="_blank">安全之路</a><a href="http://soft.yesky.com" target="_blank"></a></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" width="760"><tbody><tr bgcolor="#333333"><td colspan="2" height="1"></td></tr><tr><td bgcolor="#ff9900" height="16" valign="bottom" width="72%"><font color="#000000"><b><font color="#ffffff">学 习 中 心</font></b></font></td><td bgcolor="#6699cc" height="16" width="28%"><div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#ffffff">N E T S C H O O L</font></b></font></div></td></tr><tr bgcolor="#333333"><td colspan="2" height="1"></td></tr></tbody></table><table align="center" border="0" cellpadding="0" cellspacing="0" width="760" bgcolor="#eeeeee"><td colspan="2" height="28"><div align="center"><a href="/33554432/34603008/34635776/34636800/34636832/schoolinverse1.htm" target="_blank"><font color="#000000">HTML</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34635776/34636800/34636864/schoolinverse1.htm" target="_blank"><font color="#000000">JavaScript</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34635776/34636800/34636928/schoolinverse1.htm" target="_blank"><font color="#000000">CSS</font></a><font color="#000000"> _ <a href="/33554432/34603008/34635776/34637824/34637952/schoolinverse1.htm" target="_blank"><font color="#000000"> PHP </font></a><font color="#000000"> _ </font></font><a href="/33554432/34603008/34635776/34637824/34637888/schoolinverse1.htm" target="_blank"><font color="#000000">ASP</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/33554432/34603008/34635776/34637824/34637920/schoolinverse1.htm" target="_blank"><font color="#000000">Perl</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34635776/34638848/34638880/schoolinverse1.htm" target="_blank"><font color="#000000">Dreamweaver</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34635776/34639872/34639904/schoolinverse1.htm" target="_blank"><font color="#000000">XML</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/33554432/34603008/34734080/schoolinverse2.htm" target="_blank"><font color="#000000">病毒</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/67108864/68157440/68419584/inverse2.htm" target="_blank"><font color="#000000">程序开发</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/33554432/34603008/34799616/34800640/schoolinverse1.htm" target="_blank"><font color="#000000">Email</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/33554432/34603008/34897920/34898944/schoolinverse1.htm" target="_blank"><font color="#000000">Windows 9x</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34897920/34900992/schoolinverse1.htm" target="_blank"><font color="#000000">Linux</font></a><font color="#000000"> _</font><a href="/33554432/34603008/34963456/34966528/schoolinverse1.htm" target="_blank"><font color="#000000">WPS</font></a><font color="#000000"> _</font><a href="http://www.yesky.com/33554432/34603008/34963456/34964480/schoolinverse1.htm" target="_blank"><font color="#000000">Word</font></a></div></td></table><table width="760" border="0" cellspacing="0" cellpadding="0" height="30" align="center"><tr><td align="left" valign="bottom"><span class="nava"><span class="nava"><a href="/index.htm">首页</a>→ <a href="/33554432/34603008/school.htm">学习中心</a>→ <a href="/33554432/34603008/34668544/schoolinverse2-pro.htm">程序方舟</a>→ <a href="/33554432/34603008/34668544/34672640/schoolinverse2.htm">技巧经验</a>→ <a href="/33554432/34603008/34668544/34672640/34672672/schoolinverse1.htm">DELPHI技巧</a>→ </span></span></td><td width="2%"></td></tr></table><table width="760" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td colspan="3" valign="top" width="75%"><table width="98%" border="0" cellspacing="1" cellpadding="1" bgcolor="#000000"><tr bgcolor="#FFFFFF"><td width="100%" colspan="4" align="left"><table width="95%" align="center"><tr><td class="font1"><p align="center"><br><font size="3">在Delphi程序中调用控制面板设置功能</font><br><span class="nava"><font color="#CC9933">2000-09-20· 王发军·Delphi技术网</font></span></p> 应用程序运行时,有时需要对系统环境有特殊要求。例如,在Delphi数据库应用程序中可能需要进行BDE(Borland Database Engine)或ODBC数据源名称(DSN:Data Source Name)的设置;在网络应用程序中可能需要进行网络配置设置、Modem属性设置或用户拨号连接的帐号和密码的设置并保存在系统中;在CTI(Computer-Telephony Integration)应用程序中可能需要进行电话拨号属性的设置;在游戏程序中可能需要对多媒体或游戏控制器进行设置;等等。这时候就需要改变Windows系统的环境设置,以适应应用程序正常运行的要求。当应用程序不能自行进行环境设置时,可能需要软件用户来参与、协助完成设置。<p> Win9X/NT的大多数系统设置是在控制面板中进行的。我们可以要求用户自己打开控制面板寻找相应的项目进行设置,此时要求用户对控制面板相当熟悉;也可以在程序中自动为用户打开控制面板并选择相应的项目,此时用户所做的只是进行设置。后一种方法无疑更具有友好性,更能提高用户的工作效率。</p><p> 控制面板的大多数项目设置,都对应Windows的System目录下的一个CPL文件,如“Internet”属性对应的文件为InetCpl.cpl、“多媒体”属性对应的文件为MmSys.cpl等。通过调用这些文件可以打开相应的属性设置窗口,甚至可以跳到相应的属性页如“Internet”属性的“连接”属性页,有效减少软件用户的操作步骤。</p><p> CPL文件的调用格式为“RunDLL32.exe Shell32.dll,Control_RunDLL CPLFile.cpl,,ItemNo”(可参见注册表中HKEY_CLASSES_ROOT\cplfile\shell\cplopen\command的默认值),其中CPLFile.cpl为CPL文件,ItemNo为项目编号。在Delphi程序中,可以用WinExec或CreateProcess函数来实现CPL文件调用,从而实现对控制面板的设置项目的调用。如进行拨号连接的帐号和密码设置要调用“Internet”属性的“连接”属性页,可以用语句“WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,3’,, SW_SHOWNORMAL);”;解决2000年问题中对两位年份输入的解释要调用“区域设置”的“日期”属性页,可以用语句:“WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Intl.cpl,,4’,, SW_SHOWNORMAL);”。<br> 控制面板各项目设置调用所对应的语句列表如下:</p><p>//打开控制面板<br>WinExec(’RunDLL.exe Shell32.DLL,Control_RunDLL’,SW_SHOWNORMAL);</p><p>//32位ODBC数据源管理器,ODBC数据源、ODBC驱动程序设置<br>//没有提供参数区分“用户DSN”“系统DSN”“文件DSN”“ODBC驱动程序”“跟踪”“关于”六个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL ODBCCP32.CPL’,SW_SHOWNORMAL);</p><p>//BDE Adminstrator<br>//没有提供参数区分“Databases”和“Configuration”两个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL BdeAdmin.CPL’,SW_SHOWNORMAL);</p><p>//Internet 属性,可有ItemNo参数<br>//“常规”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,0’, SW_SHOWNORMAL);<br>//“安全”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,1’, SW_SHOWNORMAL);<br>//“内容”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,2’, SW_SHOWNORMAL);<br>//“连接”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,3’, SW_SHOWNORMAL);<br>//“程序”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,4’, SW_SHOWNORMAL);<br>//“高级”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL InetCpl.cpl,,5’, SW_SHOWNORMAL);</p><p>//电话拨号属性,没有提供参数区分“我的位置”和“电话语音驱动程序”两个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Telephon.cpl’, SW_SHOWNORMAL);</p><p>//电源管理设置,没有提供参数区分“电源方案”和“高级”两个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL PowerCfg.cpl’, SW_SHOWNORMAL);</p><p>//调制解调器设置,没有提供参数区分“常规”和“诊断”两个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Modem.cpl’, SW_SHOWNORMAL);</p><p>//多媒体设置,可有ItemNo参数<br>//“音频”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Mmsys.cpl,,0’, SW_SHOWNORMAL);<br>//“视频”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Mmsys.cpl,,1’, SW_SHOWNORMAL);<br>//“MIDI”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Mmsys.cpl,,2’, SW_SHOWNORMAL);<br>//“CD音乐”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Mmsys.cpl,,3’, SW_SHOWNORMAL);<br>//“设备”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Mmsys.cpl,,4’, SW_SHOWNORMAL);</p><p>//辅助选项设置,可有ItemNo参数<br>//“键盘”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL access.cpl,,1’,SW_SHOWNORMAL);<br>//“声音”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL access.cpl,,2’, SW_SHOWNORMAL);<br>//“显示”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL access.cpl,,3’, SW_SHOWNORMAL);<br>//“鼠标”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL access.cpl,,4’, SW_SHOWNORMAL);<br>//“常规”属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL access.cpl,,5’, SW_SHOWNORMAL);</p><p>//密码设置,没有提供参数区分“更改密码”和“修改用户配置”两个属性页<br>WinExec(’RunDLL32.exe Shell32.dll,Control_RunDLL Password.cpl’, SW_SHOWNORMAL);</p><p>//区域设置,可有ItemNo参数<br>//“区域设置”属性页<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -