⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delp007.html

📁 对于学习很有帮助
💻 HTML
字号:
<html><!-- #BeginTemplate "/Templates/fwolf001.dwt" --><head><!-- #BeginEditable "doctitle" --> <title>独孤之所 - 利用Dll实现通用密码验证框</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><!-- #EndEditable --> <style type="text/css"><!--body {  font-family: "宋体"; font-size: 9pt}td {  font-family: "宋体"; font-size: 9pt}a:hover {  text-decoration: underline}a {  text-decoration: none}input {  font-family: "宋体"; font-size: 9pt}select {  font-family: "宋体"; font-size: 9pt}--></style></head><body><!-- #BeginEditable "2%C7%F8" --> <!-- #EndEditable --><div align="left">  <table width="98%" border="0" align="center">    <tr>       <td width="33%"><a href="../../../index.html"><img src="../../../logos/fwolf9.gif" width="271" height="60" alt="独孤之所首页" border="0"></a></td>      <td width="67%">         <div align="center"> </div>      </td>    </tr>  </table>  </div><table width="100%" border="0" align="center" cellspacing="1" bgcolor="#66FF66">  <tr>     <td width="90%"><a href="../../../index2.html">独孤之所</a> > </td>    <td width="10%">       <div align="center"><a href="javascript:window.close()">[关闭窗口]</a></div>    </td>  </tr></table><hr size="1"><!-- #BeginEditable "old%20data" --><!-- #EndEditable --> <br><table width="584" border="0" align="center" cellspacing="1">  <tr>     <td width="582"> <font color="#FF3333">       <div align="center"><!-- #BeginEditable "%B1%EA%CC%E2" --> <!-- #EndEditable --></div>      </font> </td>  </tr>  <tr>     <td width="582">       <div align="center"><!-- #BeginEditable "%D7%F7%D5%DF" --><!-- #EndEditable --></div>    </td>  </tr>  <tr>     <td width="582"><!-- #BeginEditable "%CE%C4%B1%BE%C7%F8" -->       <center>        <font color="#0000c0"> <font color="#FF3333">利用Dll实现通用密码验证框</font><br>        </font>夏青虫       </center>      <p><font color="#ffffff">----</font> 在我们编制Delphi应用程序,常常需要提供一个密码验证框,对应用程序的使用者进行身份核对。如果能有一个通用的密码验证框,便能够为我们的工作节约不少的时间,更能使我们编制的程序小而快。以下的程序为你提供了这样的一个DLL文件。       <pre>//文件名为CheckPasswordForm.dpr;编译此文件生成CheckPasswordForm.dll    library CheckPasswordForm;    uses      XcqCheck in 'XcqCheck.pas' {XcqForm};    exports      CheckPassword name 'CheckPassword';//dll入口    begin    end.    //文件名为XcqCheck.pas    unit XcqCheck;    interface    uses      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,      StdCtrls, Mask, Menus;    type      TXcqForm = class(TForm)      XcqEdit: TMaskEdit;//密码输入框      OkBtn: TButton;      procedure OkBtnClick(Sender: TObject);    end;    var      XcqForm: TXcqForm;      Check: Boolean;//验证输入密码的正确性      function CheckPassword: Boolean;export;//本dll文件的关键实现    implementation    {$R *.DFM}    procedure TXcqForm.OkBtnClick(Sender: TObject);    begin      if XcqEdit.Text = 'xcq' then        Check := True;      Close;    end;    function CheckPassword;export;    begin      Check := False;      XcqForm := TXcqForm.Create(Application);//创建密码输入框      XcqForm.ShowModal;//显示密码输入框; 注意:不能用XcqForm.Show!Result := Check;//返回给调用本dll的应用程序判断XcqForm.Free;//释放本dll文件所占资源    end;    end.</pre>      <font color="#ffffff">----</font> 在调用以上dll中CheckPassword函数的应用程序中只需加入以下语句在implementation       后,function CheckPassword: Boolean; external 'CheckPasswordForm.dll' name       'CheckPassword';在需要进行密码验证的地方加入下面的条件语句就完全实现了密码验证的功能。       <pre>    if CheckPassword then     begin      ...//如XcqQuery.Open;    end;</pre>      <font color="#ffffff">----</font> 上面的程序只是一个简单的密码验证框,我们可以将密码以写入注册表或文件的方式保存,动态修改,更可以利用算术算法对密码进行简单的加密等,使要保密的数据更安全。       <p><font color="#ffffff">----</font> 其实,上文中如何在dll中实现窗口让我走了不少弯路,我觉得此法对大家更有意义,这是避免程序庞大的一种有效方法,不妨试试。       <p><font color="#ffffff">----</font> 以上程序在Windows98/Delphi3下编译通过。欢迎大家批评指正。       <!-- #EndEditable --></td>  </tr>  <tr>    <td width="582"><!-- #BeginEditable "%B1%B8%D7%A2" --><!-- #EndEditable --></td>  </tr></table><br><hr size="1"><table width="25%" border="1" align="center" cellspacing="0" cellpadding="0" bordercolorlight="#CCCCFF" bordercolordark="#000033" bordercolor="#6666FF">  <tr align="center">     <td> 转载请注明出于 <a href="http://fwolf.yeah.net" target="_blank">独孤之所</a><!--Fwolf出品fwolf001@163.nethttp://fwolf.yeah.net --> </td>  </tr>  <tr align="center">     <td>       <script>document.write("<a href=http://www.topcn.com/siteinfo.asp?UserName=fwolf2000&SiteType=0 target=_blank><img src=http://www1.topcn.com:8081/statistics.asp?fwolf2000&referURL="+escape(top.document.referrer)+"&curURL="+escape(top.document.URL)+"&imgStyle=0"+" border=0 alt='Top中文网站龙虎榜' ></a>");</script>      <script>document.write("<a href=http://www.textclick.com/viewmain.asp?name=fwolf2000 target=_blank><img src=http://ad.t2t2.com/stat.asp?user=fwolf2000&refer="+escape(document.referrer)+"&cur="+escape(document.URL)+" alt=太极统计 border=0></a>");</script>    </td>  </tr></table><table width="100%" border="0" align="center" cellspacing="1" bgcolor="#66FF66">  <tr>     <td width="10%"><a href="javascript:window.close()">[关闭窗口]</a></td>    <td width="90%">       <div align="left"></div>    </td>  </tr></table><div id="Layer1" style="position:absolute; width:470px; height:60; z-index:1; left: 293px; top: 13px; overflow: hidden">   <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60">    <tr>       <td><a href="http://202.99.67.100/adclick2/click/random.cgi?job=go&id=1490" target="_blank"><img src="http://202.99.67.100/adclick2/click/random.cgi?id=1490" border="0" width="468" height="60"></a>       </td>    </tr>  </table></div><div align="center"></div><p align="center"> <script language="JavaScript1.1" src=http://ad.t2t2.com/textclick.asp?user=fwolf&style=4&bkcolor=no></script></p><p align="center">&nbsp; </p></body><!-- #EndTemplate --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -