S
setttt
Unregistered / Unconfirmed
GUEST, unregistred user!
以下函数,在,Application 与Active Form工程中可以正常,但放到 ActiveX Contorl中时编绎就报错.
[red]
[Error] WebCtrlImpl1.pas(537): Unknown directive: 'NCB'
[Error] WebCtrlImpl1.pas(549): Undeclared identifier: 'NCB'
[Error] WebCtrlImpl1.pas(550): Missing operator or semicolon
...
..
[/red]
是什么原因啊..全力放分..
[red]
[Error] WebCtrlImpl1.pas(537): Unknown directive: 'NCB'
[Error] WebCtrlImpl1.pas(549): Undeclared identifier: 'NCB'
[Error] WebCtrlImpl1.pas(550): Missing operator or semicolon
...
..
[/red]
代码:
uses nb30;
function GetMAC(CardNo: integer): string;
//CardNo指定多个网卡适配器中的哪一个0,1,2...
var
NCB: TNCB;
// Netbios control block file://NetBios控制块
ADAPTER: TADAPTERSTATUS;
// Netbios adapter status//取网卡状态
LANAENUM: TLANAENUM;
// Netbios lana
intIdx: Integer;
// Temporary work value//临时变量
cRC: Char;
// Netbios return code//NetBios返回值
strTemp: string;
// Temporary string//临时变量
begin
// Initialize
Result := '';
try
ZeroMemory(@NCB, SizeOf(NCB));
// Zero control blocl
NCB.ncb_command := Chr(NCBENUM);
// Issue enum command
cRC := NetBios(@NCB);
NCB.ncb_buffer := @LANAENUM;
// Reissue enum command
NCB.ncb_length := SizeOf(LANAENUM);
cRC := NetBios(@NCB);
if Ord(cRC) <> 0 then
Exit;
ZeroMemory(@NCB, SizeOf(NCB));
// Reset adapter
NCB.ncb_command := Chr(NCBRESET);
NCB.ncb_lana_num := LANAENUM.lana[CardNo];
cRC := NetBios(@NCB);
if Ord(cRC) <> 0 then
Exit;
ZeroMemory(@NCB, SizeOf(NCB));
// Get adapter address
NCB.ncb_command := Chr(NCBASTAT);
NCB.ncb_lana_num := LANAENUM.lana[CardNo];
StrPCopy(NCB.ncb_callname, '*');
NCB.ncb_buffer := @ADAPTER;
NCB.ncb_length := SizeOf(ADAPTER);
cRC := NetBios(@NCB);
strTemp := '';
// Convert it to string
for intIdx := 0 to 5do
strTemp := strTemp + InttoHex(Integer(ADAPTER.adapter_address[intIdx]), 2);
Result := strTemp;
finally
end;
end;
是什么原因啊..全力放分..