请帮我解释下下面这小段代码的含义``(30分)

W

wxj9527

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure DisableProcessWindowsGhosting;
var
_DisableProcessWindowsGhostingImp : procedure;
begin
//$ML-
@_DisableProcessWindowsGhostingImp := GetProcAddress(GetModuleHandle('user32.dll'), 'DisableProcessWindowsGhosting');
//$ML+
if @_DisableProcessWindowsGhostingImp <> nil then
begin
_DisableProcessWindowsGhostingImp;
end;
end;
 
Z

zzutrain

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure DisableProcessWindowsGhosting;
var
_DisableProcessWindowsGhostingImp : procedure;
//定义 _DisableProcessWindowsGhostingImp 为过程变量
begin
//$ML-
@_DisableProcessWindowsGhostingImp := GetProcAddress(GetModuleHandle('user32.dll'), 'DisableProcessWindowsGhosting');
//@_DisableProcessWindowsGhostingImp 设置过程为 user32.dll 中的过程
//$ML+
if @_DisableProcessWindowsGhostingImp <> nil then
//若过程存在, 则执行
begin
_DisableProcessWindowsGhostingImp;
end;
end;
 
W

wxj9527

Unregistered / Unconfirmed
GUEST, unregistred user!
意思是执行'user32.dll'中的DisableProcessWindowsGhosting过程吗??
何不直接调用user32.dll的DisableProcessWindowsGhosting??
这样写有什么好处??
 
Z

zzutrain

Unregistered / Unconfirmed
GUEST, unregistred user!
有可能 user32.dll 中没有这个过程, 这样写的话, 不会报错. 静态调用的话, 若过程不存在,就会异常, 程序不能执行.
 
W

wxj9527

Unregistered / Unconfirmed
GUEST, unregistred user!
能不能详细讲解下delphi中的过程变量?
 
Z

zzutrain

Unregistered / Unconfirmed
GUEST, unregistred user!
查一下 动态调用 dll , 学习学习去, 咋感觉啥都不懂呢?
 
W

wxj9527

Unregistered / Unconfirmed
GUEST, unregistred user!
接受答案了.
 

Similar threads

S
Replies
0
Views
259
SUNSTONE的Delphi笔记
S
S
Replies
0
Views
197
SUNSTONE的Delphi笔记
S
Top Bottom