M
moutocean
Unregistered / Unconfirmed
GUEST, unregistred user!
我在使用rasapi.pas时:
unit rasapi;
interface
Uses WinTypes, WinProcs, Dialogs;
Const
UNLEN = 256;
PWLEN = 256;
DNLEN = 15;
RAS_MaxEntryName = 256;//连接名称最大长度
RAS_MaxDeviceName = 128;//设备名称最大长度
RAS_MaxDeviceType = 16;//设备类型名称长度
{ RAS_MaxParamKey = 32;
RAS_MaxParamValue = 128;}
RAS_MaxPhoneNumber = 128;//电话号码的最大长度
RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
Type
{UINT = Word;}
PHRASConn = ^HRASConn;
Type
{ 确认一活动的拨号连接. (为RasConnectEnum函数使用) }
PRASConn = ^TRASConn;//拨号连接的句柄类型
TRASConn = record
dwSize: DWORD;//该结构类型所占内存的字节大小
rasConn: HRASConn;//活动连接的句柄
szEntryName: Array[0..RAS_MaxEntryName] Of Char;//
szDeviceType : Array[0..RAS_MaxDeviceType] Of Char;
szDeviceName : Array [0..RAS_MaxDeviceName] of char;
end;
PRASConnStatus = ^TRASConnStatus;
TRASConnStatus = Record
dwSize: LongInt;
rasConnstate: Word;
dwError: LongInt;
szDeviceType: Array[0..RAS_MaxDeviceType] Of Char;
szDeviceName: Array[0..RAS_MaxDeviceName] Of Char;
End;
PRASDIALEXTENSIONS= ^TRASDIALEXTENSIONS;
TRASDIALEXTENSIONS= Record
dwSize: DWORD;
dwfOptions: DWORD;
hwndParent: HWnd;
reserved: DWORD;
end;
PRASDialParams = ^TRASDialParams;
TRASDialParams = Record
dwSize: DWORD;
szEntryName: Array[0..RAS_MaxEntryName] Of Char;
szPhoneNumber: Array[0..RAS_MaxPhoneNumber] Of Char;
szCallbackNumber: Array[0..RAS_MaxCallbackNumber] Of Char;
szUserName: Array[0..UNLEN] Of Char;
szPassword: Array[0..PWLEN] Of Char;
szDomain: Array[0..DNLEN] Of Char;
end;
PRASEntryName = ^TRASEntryName;
TRASEntryName = Record
dwSize: LongInt;
szEntryName: Array[0..RAS_MaxEntryName] Of Char;
{ Reserved: Byte;}
End;
//拨号函数
Function RasDial(
lpRasDialExtensions : PRASDIALEXTENSIONS ; //在WIN9X下无用,可设置为NIL
lpszPhonebook: PChar; //在WIN9X下无用,可设置为NIL
lpRasDialParams : PRASDIALPARAMS; // 拨号参数,类型指针
dwNotifierType : DWORD; { 消息通知方式}
lpvNotifier: DWORD; { 消息处理事件}
var rasConn: HRASConn { 返回成功连接的连接句柄}
): DWORD; stdcall;
function RasEnumConnections(RASConn: PrasConn;
var BufSize: DWord;
var Connections: DWord
): LongInt; stdcall;
Function RasEnumEntries (
reserved: PChar; {保留字段,必须为空}
lpszPhonebook: PChar ; { 电话本名称,在WIN9X下无用,可设置为NIL}
lprasentryname: PRASENTRYNAME ; {接收拨号连接名称的缓冲区,是一类型数组的指针}
var lpcb : DWORD; {接收拨号连接名称的缓冲区的大小}
var lpcEntries : DWORD {实际获得拨号连接 的数目}
) : DWORD; stdcall;
function RasGetConnectStatus(RASConn: hrasConn; { 指定活动连接的句柄 }
RASConnStatus: PRASConnStatus { 获取活动连接状态信息的缓冲区}
): LongInt; stdcall;
function RasGetErrorString(ErrorCode: DWord; { 错误代码标识}
szErrorString: PChar; { 错误提示信息的缓冲区}
BufSize: DWord {错误提示信息的缓冲区的大小 }
): LongInt; stdcall;
function RasHangUp(RASConn: hrasConn ): LongInt; stdcall;
function RasGetEntryDialParams(
lpszPhonebookChar; {电话本名称,在WIN9X下无用,可设置为NIL }
VAR lprasdialparams:TRASDIALPARAMS; {拨号参数,是一类型指针}
VAR lpfPassword : BOOL {显示是否需要用户密码}
): DWORD; stdcall;
implementation
const
RAS_DLL = 'RASAPI32';
function RasDial; external RAS_DLL name 'RasDialA';
function RasEnumConnections; external RAS_DLL name 'RasEnumConnectionsA';
function RasEnumEntries; external RAS_DLL name 'RasEnumEntriesA';
function RasGetConnectStatus; external RAS_DLL name 'RasGetConnectStatusA';
function RasGetErrorString; external RAS_DLL name 'RasGetErrorStringA';
function RasHangUp; external RAS_DLL name 'RasHangUpA';
function RasGetEntryDialParams; external RAS_DLL name 'RasGetEntryDialParamsA';
end.
编译程序时
PHRASConn = ^HRASConn; 这一句有错误
“Undeclared identifier: 'HRASConn'”
各位高手,请问这是为何?
unit rasapi;
interface
Uses WinTypes, WinProcs, Dialogs;
Const
UNLEN = 256;
PWLEN = 256;
DNLEN = 15;
RAS_MaxEntryName = 256;//连接名称最大长度
RAS_MaxDeviceName = 128;//设备名称最大长度
RAS_MaxDeviceType = 16;//设备类型名称长度
{ RAS_MaxParamKey = 32;
RAS_MaxParamValue = 128;}
RAS_MaxPhoneNumber = 128;//电话号码的最大长度
RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
Type
{UINT = Word;}
PHRASConn = ^HRASConn;
Type
{ 确认一活动的拨号连接. (为RasConnectEnum函数使用) }
PRASConn = ^TRASConn;//拨号连接的句柄类型
TRASConn = record
dwSize: DWORD;//该结构类型所占内存的字节大小
rasConn: HRASConn;//活动连接的句柄
szEntryName: Array[0..RAS_MaxEntryName] Of Char;//
szDeviceType : Array[0..RAS_MaxDeviceType] Of Char;
szDeviceName : Array [0..RAS_MaxDeviceName] of char;
end;
PRASConnStatus = ^TRASConnStatus;
TRASConnStatus = Record
dwSize: LongInt;
rasConnstate: Word;
dwError: LongInt;
szDeviceType: Array[0..RAS_MaxDeviceType] Of Char;
szDeviceName: Array[0..RAS_MaxDeviceName] Of Char;
End;
PRASDIALEXTENSIONS= ^TRASDIALEXTENSIONS;
TRASDIALEXTENSIONS= Record
dwSize: DWORD;
dwfOptions: DWORD;
hwndParent: HWnd;
reserved: DWORD;
end;
PRASDialParams = ^TRASDialParams;
TRASDialParams = Record
dwSize: DWORD;
szEntryName: Array[0..RAS_MaxEntryName] Of Char;
szPhoneNumber: Array[0..RAS_MaxPhoneNumber] Of Char;
szCallbackNumber: Array[0..RAS_MaxCallbackNumber] Of Char;
szUserName: Array[0..UNLEN] Of Char;
szPassword: Array[0..PWLEN] Of Char;
szDomain: Array[0..DNLEN] Of Char;
end;
PRASEntryName = ^TRASEntryName;
TRASEntryName = Record
dwSize: LongInt;
szEntryName: Array[0..RAS_MaxEntryName] Of Char;
{ Reserved: Byte;}
End;
//拨号函数
Function RasDial(
lpRasDialExtensions : PRASDIALEXTENSIONS ; //在WIN9X下无用,可设置为NIL
lpszPhonebook: PChar; //在WIN9X下无用,可设置为NIL
lpRasDialParams : PRASDIALPARAMS; // 拨号参数,类型指针
dwNotifierType : DWORD; { 消息通知方式}
lpvNotifier: DWORD; { 消息处理事件}
var rasConn: HRASConn { 返回成功连接的连接句柄}
): DWORD; stdcall;
function RasEnumConnections(RASConn: PrasConn;
var BufSize: DWord;
var Connections: DWord
): LongInt; stdcall;
Function RasEnumEntries (
reserved: PChar; {保留字段,必须为空}
lpszPhonebook: PChar ; { 电话本名称,在WIN9X下无用,可设置为NIL}
lprasentryname: PRASENTRYNAME ; {接收拨号连接名称的缓冲区,是一类型数组的指针}
var lpcb : DWORD; {接收拨号连接名称的缓冲区的大小}
var lpcEntries : DWORD {实际获得拨号连接 的数目}
) : DWORD; stdcall;
function RasGetConnectStatus(RASConn: hrasConn; { 指定活动连接的句柄 }
RASConnStatus: PRASConnStatus { 获取活动连接状态信息的缓冲区}
): LongInt; stdcall;
function RasGetErrorString(ErrorCode: DWord; { 错误代码标识}
szErrorString: PChar; { 错误提示信息的缓冲区}
BufSize: DWord {错误提示信息的缓冲区的大小 }
): LongInt; stdcall;
function RasHangUp(RASConn: hrasConn ): LongInt; stdcall;
function RasGetEntryDialParams(
lpszPhonebookChar; {电话本名称,在WIN9X下无用,可设置为NIL }
VAR lprasdialparams:TRASDIALPARAMS; {拨号参数,是一类型指针}
VAR lpfPassword : BOOL {显示是否需要用户密码}
): DWORD; stdcall;
implementation
const
RAS_DLL = 'RASAPI32';
function RasDial; external RAS_DLL name 'RasDialA';
function RasEnumConnections; external RAS_DLL name 'RasEnumConnectionsA';
function RasEnumEntries; external RAS_DLL name 'RasEnumEntriesA';
function RasGetConnectStatus; external RAS_DLL name 'RasGetConnectStatusA';
function RasGetErrorString; external RAS_DLL name 'RasGetErrorStringA';
function RasHangUp; external RAS_DLL name 'RasHangUpA';
function RasGetEntryDialParams; external RAS_DLL name 'RasGetEntryDialParamsA';
end.
编译程序时
PHRASConn = ^HRASConn; 这一句有错误
“Undeclared identifier: 'HRASConn'”
各位高手,请问这是为何?