W
wakelion
Unregistered / Unconfirmed
GUEST, unregistred user!
第一次提问,我写了一个dll文件.代码先给大家看一下<br>//********* DLL文件代码如下<br>unit Unit1;<br><br>interface<br>uses<br>Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,<br> 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> 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> first unit in your library's USES clause AND your project's (select<br> Project-View Source) USES clause if your DLL exports any procedures or<br> functions that pass strings as parameters or function results. This<br> applies to all strings passed to and from your DLL--even those that<br> are nested in records and classes. ShareMem is the interface unit to<br> the BORLNDMM.DLL shared memory manager, which must be deployed along<br> with your DLL. To avoid using BORLNDMM.DLL, pass string information<br> using PChar or ShortString parameters. }<br><br>uses<br> SysUtils,<br> Classes,<br> 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> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> private<br> LibHandle: THandle;<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if LibHandle = 0 then<br> LibHandle := LoadLibrary('Project2.dll')<br> else<br> ;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>LibHandle :=0;<br>end;<br><br>end.<br><br>我的问题是,现在为什么不能定时触发showmessage('完全成功了'); 哪位高手帮我把dll文件的源码修改一下,不胜感激,出价 100 @_@