delphi中与VB“当前窗口指针”相当的是什么?(100分)

S

shy_cm

Unregistered / Unconfirmed
GUEST, unregistred user!
TScreen.ActiveForm
 
不是好块,是100块!
可今天的网络真是慢!!!
 
当前窗口的handle,相当于一个指正。
leechange100块赚的快。
 
self是当前窗口指针
 
慢点,再加点难度。
一个DLL调用中,需返回一个当前窗口指针,应如何定义?
 
Screen.ActiveForm.Handle
 
是否是这样写
function readdata(var t:integer;
s:screen.activeform.handle):longint;far;external"xxx.dll";
 
VB中是form1.hwnd
delphi中是form1.handle
 
no
申明的时候这样写:
function readdat(var t:integer;
h :HWND):longint;far;external"xxx.dll";
调用的时候:
readdat(t,Screen.ActiveForm.Handle);
 
sorry;
s:integer;
or s:hwnd;
 
下面这段当如何是好?
Private Declare Function BehindCollectAndSave Lib "xxx.dll" (ByVal hDevice As Long, Parameter As PARA, ByVal SourceFileName As String, ByVal Words As Long, ByVal CallbackRoutine As Long, hwnd As Any, ByRef ErrorCode As Long) As Boolean
 
在delphi:
type PARA=record
...
end;

Function BehindCollectAndSave(hDevice:Long;
Parameter:pARA;SourceFileName:pChar;Words:Long;CallbackRoutine:Long;
hwnd_ :HWND ,ErrorCode:Long):Boolean;external "xxx.dll";
 
改一点:
在delphi:
type PARA=record
...
end;

Function BehindCollectAndSave(hDevice:Long;
Parameter:pARA;SourceFileName:pChar;Words:Long;CallbackRoutine:Long;
hwnd_ :HWND ;ErrorCode:Long):Boolean;stdcall;external "xxx.dll";
 
上面的有问题,再改一点:
在delphi:
type PARA=record
...
end;

type PPARA=^PARA;
Function BehindCollectAndSave(hDevice:Long;
Parameter:pPARA;SourceFileName:pChar;Words:Long;CallbackRoutine:Long;
hwnd_ :HWND ;ErrorCode:Long):Boolean;stdcall;external "xxx.dll";
“Parameter:pPARA” 和 “var Parameter:pARA” 都可以,编译成
汇编代码是一样的,只是写起delphi代码来有点不同。
 
“Parameter:pPARA” 和 “var Parameter:pARA” 都可以,
编译成汇编代码是一样的,只是写起delphi代码来有点不同。
"Parameter:pARA" 则是错误的
 
pipi:看来真是此道高手,多谢相助。我还不懂的是,括号中的值不需要var 一下吗?值怎么返回呢?
 
如果是变量是指针型,就无需Var一下啦
 
顶部