我在dpr中是这样写的:implementation
{$R *.DFM}
function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord; stdcall; external 'KERNEL32.DLL';procedure Tclient.FormCreate(Sender: TObject);
begin
Application.Initialize;
if GetSystemVer_Lqb='Windows 9x' then //自定义函数,判断操作系统类型
RegisterServiceProcess(GetCurrentProcessID,1); //隐藏进程
Application.Run;
end; 在 98 中运行没问题;
但是在 2000 中运行时总是有这样的错误:
无法定位程序输入点refisterserviceprocess于动态链接库kernel32.dll上.请问这是怎么回事呢?
为什么加了操作系统类型判断还会有这样的错误信息啊?
{$R *.DFM}
function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord; stdcall; external 'KERNEL32.DLL';procedure Tclient.FormCreate(Sender: TObject);
begin
Application.Initialize;
if GetSystemVer_Lqb='Windows 9x' then //自定义函数,判断操作系统类型
RegisterServiceProcess(GetCurrentProcessID,1); //隐藏进程
Application.Run;
end; 在 98 中运行没问题;
但是在 2000 中运行时总是有这样的错误:
无法定位程序输入点refisterserviceprocess于动态链接库kernel32.dll上.请问这是怎么回事呢?
为什么加了操作系统类型判断还会有这样的错误信息啊?
function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord; stdcall; external 'KERNEL32.DLL';
{$ENDIF}
...
procedure Tclient.FormCreate(Sender: TObject);
begin
Application.Initialize;
{$IFDEF _WIN32}
RegisterServiceProcess(GetCurrentProcessID,1); //隐藏进程
{$ENDIF}
Application.Run;
end;
好像只有先判断windows版本,如果是win9x,可以动态加载.
RegisterServiceProcess = function(dwProcessID, dwType: DWord) : DWord; stdcall; procedure Tclient.FormCreate(Sender: TObject);
var
Handle:word;
begin
Application.Initialize;
if GetSystemVer_Lqb='Windows 9x' then //自定义函数,判断操作系统类型
begin
Handle:=LoadLibrary('Kernel32.dll');
if Handle>32 then
begin
@RegisterServiceProcess:=GetProcAddress(Handle,"RegisterServiceProcess");
RegisterServiceProcess(GetCurrentProcessID,1); //隐藏进程
FreeLibrary(Handle);
end;
end;
Application.Run;
end;
我个人觉得这个函数的风格就是9x的,不适合NT;---前天晚上我debug了半个钟头,最后发现GetThreadId函数只存在于win2003里,sigh啊!
>>有没有谁研究一下 aiirii(ari-爱的眼睛) 的方法啊?好象不管用哦.
什麼意思???
manfeng() 的方法可行,不过他的代码好象有一处错误。下面代码DELPHI 5.0 中编译通过:unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
RegisterServiceProcess : function(dwProcessID, dwType: DWord) : DWord; stdcall;
implementation
uses Unit_Share_Lqb;
{$R *.DFM}
procedure Tform1.FormCreate(Sender: TObject);
var
Handle:THandle;
begin
if GetSystemVer_Lqb='Windows 9x' then //自定义函数,判断操作系统类型
begin
Handle:=LoadLibrary('KERNEL32.DLL');
if Handle>32 then
begin
@RegisterServiceProcess:=GetProcAddress(Handle,'RegisterServiceProcess');
RegisterServiceProcess(GetCurrentProcessID,1); //隐藏进程
FreeLibrary(Handle);
end;
end;
end;
end.
我的方法, 应该与
>>manfeng() 的方法可行一样, 只是简单一些吧??