100分问题,先到先得~~怎样在DLL文件中定时触发一个事件?(100分)

  • 主题发起人 主题发起人 wakelion
  • 开始时间 开始时间
W

wakelion

Unregistered / Unconfirmed
GUEST, unregistred user!
第一次提问,我写了一个dll文件.代码先给大家看一下<br>//********* &nbsp;DLL文件代码如下<br>unit Unit1;<br><br>interface<br>uses<br>Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,<br> &nbsp;Dialogs, ExtCtrls,shellapi ,registry;<br><br>procedure fOnTimer(theWnd : HWND; msg, idTimer : Cardinal; dwTime : DWORD);far pascal; <br>procedure main;stdcall;<br>var<br>fTimerID: Cardinal;<br> hThreadHandle: Dword;<br> &nbsp;dwThreadID: Dword;<br><br>implementation<br><br><br>procedure main;stdcall;<br>begin<br>showmessage('第一步成功');<br>fTimerID := SetTimer(0, 0, 5000, @fOnTimer);//开始使用timer<br>end;<br><br><br>procedure fOnTimer(theWnd : HWND; msg, idTimer : Cardinal; dwTime : DWORD);far pascal; <br>begin<br>showmessage('完全成功了');//要完成的事件<br>end;<br><br>end.<br><br>//*******************************<br>library Project2;<br><br>{ Important note about DLL memory management: ShareMem must be the<br> &nbsp;first unit in your library's USES clause AND your project's (select<br> &nbsp;Project-View Source) USES clause if your DLL exports any procedures or<br> &nbsp;functions that pass strings as parameters or function results. This<br> &nbsp;applies to all strings passed to and from your DLL--even those that<br> &nbsp;are nested in records and classes. ShareMem is the interface unit to<br> &nbsp;the BORLNDMM.DLL shared memory manager, which must be deployed along<br> &nbsp;with your DLL. To avoid using BORLNDMM.DLL, pass string information<br> &nbsp;using PChar or ShortString parameters. }<br><br>uses<br> &nbsp;SysUtils,<br> &nbsp;Classes,<br> &nbsp;Unit1 in 'Unit1.pas';<br><br>{$R *.res}<br><br>begin<br>main;<br>end.<br><br>调用DLL文件的exe文件代码如下:<br>unit Unit1;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, StdCtrls;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;Button1: TButton;<br> &nbsp; &nbsp;procedure Button1Click(Sender: TObject);<br> &nbsp; &nbsp;procedure FormCreate(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;LibHandle: THandle;<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if LibHandle = 0 then<br> &nbsp; &nbsp;LibHandle := LoadLibrary('Project2.dll')<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp;;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>LibHandle :=0;<br>end;<br><br>end.<br><br>我的问题是,现在为什么不能定时触发showmessage('完全成功了'); 哪位高手帮我把dll文件的源码修改一下,不胜感激,出价 &nbsp;100 &nbsp;@_@
 
在线等呢,帮忙啊,UP一下!
 
怎么只有人看,没有人说啊,我的问题难道问的不明白吗??
 
后退
顶部