比如一个程序1.exe我注入到了1.exe,达到了键盘勾子,按F12后能创建我的DLL里的窗体并且呼出.有什么办法在不呼出dllform的时候能循环执行我的一段代码要求100毫秒执行一次
就好象建立正常程序里用timer一样.我知道DLL里也可以用timer,但是我的DLL注入到1.exe ,那时还没有创建窗体,所以不能使用 Timer控件.求助. 100毫秒执行一次 一个过程函数
刚学DELPHI 语言表达不好请见谅
就好象建立正常程序里用timer一样.我知道DLL里也可以用timer,但是我的DLL注入到1.exe ,那时还没有创建窗体,所以不能使用 Timer控件.求助. 100毫秒执行一次 一个过程函数
刚学DELPHI 语言表达不好请见谅
解决方案 »
- 如何将字符串用md5加密为32位的字符串?
- try except跟try finally合一起不能运行except后的内容
- 如何按某列内容拆分,使该列内容都在一张sheet里,且保证同一内容都在同一张sheet里?
- 有人有sha1.pas文件吗?不要base64
- 同步问题,高难度问题。
- 如何使保存的记录的主键字段的值唯一?高手请进,常见问题
- 在线等待-20分求个问题 大家帮忙看看为什么我的Delphi7.0 System页下看属性有FilterComboBox,但是单击System页却看不到,当然就加不到
- 请教获取IE版本号和office版本号的方法?
- 关于刷新的问题.请多指教!
- 依时利 调用EastRiver.DLL的DeleteAllowedCard 删除白名单
- serverSocket的多线程编程的问题,请各位指点
- 急,如何读取HTM格式文件内容
建一个类:
type Tmyclass=class
public
procedure mytimer(Sender: TObject);
end;procedure Tmyclass.mytimer(Sender: TObject);
begin
ShowMessage('ok'); //这个仅是测试,可以写你的代码
end;程序中:
var
t:ttimer;
m: Tmyclass;
begin
m:= Tmyclass.Create;
t:=ttimer.Create(nil);
t.Interval:=2000;
t.OnTimer:= m.mytimer;
t.enabled=true; //2秒执行上面的代码
注意,程序最后要
m.free;
t.free;
Sleep函数用来使程序的执行延时给定的时间值。Sleep的调用形式为Sleep(milliseconds),暂停当前的进程milliseconds毫秒。Sleep的实现方法其实也是调用Windows API的Sleep函数。例如:
sleep(1000); //延迟1000毫秒
Sleep会引起程序停滞,如果你延迟的时间较长的话,你的程序将不能够响应延时期间的发生的其他消息,所以程序看起来好像暂时死机。---------------------------------你尝试这个函数:
procedure Delay(dwMilliseconds:DWORD); // Longint
var
iStart,iStop:DWORD;
begin
iStart := GetTickCount;
repeat
iStop := GetTickCount;
Application.ProcessMessages;
until (iStop - iStart) >= dwMilliseconds;
end;
library Project2;uses
windows,
SysUtils,
Classes;
{$R *.res}Procedure tanmessage;StdCall;
begin
messagebox(0,'0','0',0) ;
end;exports tanmessage;begin
end.我刚把你的代码放进去出错,就是创建类的代码.
请教
把SetTimer加到我的DLL里
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
SysUtils,
Classes,
windows,ExtCtrls
;type Tmyclass=class
public
procedure mytimer(Sender: TObject);
end; procedure Tmyclass.mytimer(Sender: TObject);
begin
messagebox(0,'0','0',0) ;end; {$R *.res}
Procedure tanmessage;StdCall;
var
t:ttimer;
m: Tmyclass;
begin
m:= Tmyclass.Create;
t:=ttimer.Create(nil);
t.Interval:=2000;
t.OnTimer:= m.mytimer;
t.enabled:=true;
end;exports tanmessage;
begin
end.
这样无效呢..求教.
uses
SysUtils,
Classes,
windows,ExtCtrls
;type Tmyclass=class
public
procedure mytimer(Sender: TObject);
end; procedure Tmyclass.mytimer(Sender: TObject);
begin
messagebox(0,'0','0',0) ;end; var
t:ttimer;
m: Tmyclass;
{$R *.res}
Procedure tanmessage;StdCall;
begin
m:= Tmyclass.Create;
t:=ttimer.Create(nil);
t.Interval:=2000;
t.OnTimer:= m.mytimer;
t.enabled:=true;
end;Procedure endtanmessage;StdCall;
begin
t.Enabled:=false;
t.Free;
m.Free;
end;exports tanmessage,endtanmessage;
begin
end.
在使用时,开始用 tanmessage;结束时用:endtanmessage;
只是没加 t.Free;
m.Free;
谢谢了 结贴