DELPHI请教(100分)

  • 主题发起人 主题发起人 jackyrong
  • 开始时间 开始时间
J

jackyrong

Unregistered / Unconfirmed
GUEST, unregistred user!
在一篇文章上说API有个未公开的API registerserviceprocess,<br>说通过调用可以隐藏任务,使CTRL+ALT+DEL时也看不到,<br>但给出的代码如下,却不能执行,为何?<br>unit winjingchen;<br><br>interface<br>function registerserviceprocess(dwprocessid,dwtype:integer):integer;<br>stdcall;<br>external 'kernel32.dll';<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<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>registerserviceprocess(getcurrentprocessid,0);<br><br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br>&nbsp; registerserviceprocess(getcurrentprocessid,1);<br><br>end;<br><br>end.<br>
 
如果用9x,加上 form1.visible:=False;<br>如果是NT,可能没戏
 
这个确实可以隐藏任务,但是不能隐藏窗体,所以还要用form.hide,或是<br>showwindow来
 
只适用于Win9x<br>进入菜单project-&gt;view source &nbsp; &nbsp; &nbsp; &nbsp;//Delphi5的菜单,Delphi4可能不一样<br>在Application.CreateForm(TForm1, Form1);后加入以下代码<br>&nbsp; Application.ShowMailForm := False;<br>
 
不行呀,它说‘declaration expected but uses found',<br>还有UNDECLARED identifier 'getcurrentprocessid',WHY?
 
win2k直接没戏。
 
不要使用 GetCurrentProcessID 这个函数,直接传 0 作为第一个参数就可以,就表示当前<br>的进程,在我的程序中通过。另外,RegisterServiceProcess 只在 Win9x 中有效,在 <br>WinNT/2000 中无效。
 
各位,还是不行呀,我用的是WIN98,它说API声明部分就错了,我是初学<br>者,DELPHI中API如何声明呀?各位帮忙测试下程序吧
 
在Uses中加入ShellAPi
 
各位大侠,能否给出DELPHI调用API的例子呀?我手头没这方面资料,谢谢了
 
错:<br>interface<br>function registerserviceprocess(dwprocessid,dwtype:integer):integer;<br>stdcall;<br>external 'kernel32.dll';<br>应为:<br><br>&nbsp; private<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>function registerserviceprocess(dwprocessid,dwtype:integer):integer;stdcall;external 'kernel32.dll';<br><br><br><br>
 
你写错了,应该是:<br>function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord;stdcall; external 'KERNEL32.DLL';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^^^^^ &nbsp; ^^^^^<br>还有应该加在implementation后面:)<br>
 
多人接受答案了。
 
后退
顶部