Const
RAS_MaxEntryName = 256;//连接名称最大长度
RAS_MaxDeviceName= 32;//设备名称最大长度
RAS_MaxDeviceType= 16;//设备类型名称长度Type
PRASConn=^TRASConn;//拨号连接的句柄类型
TRASConn=record
dwSize:DWORD;//该结构类型所占内存的字节大小
HrasConn:Dword;//活动连接的句柄
szEntryName:Array[0..RAS_MaxEntryName] of Char;//
szDeviceType:Array[0..RAS_MaxDeviceType]of Char;
szDeviceName:Array[0..RAS_MaxDeviceName]of char;
//szphonebook:Array[0..256] of char;
//dwsubentry:dword;
//guidentry:Dword函数原型如下:
function RasEnumConnections(RASConn:prasConn;
var BufSize:DWord;
 var Connections:DWord
):Dword;stdcall;
...
...
const
RAS_DLL='Rasapi32.dll';
function RasEnumConnections;external RAS_DLL name 'RasEnumConnectionsA';___________________________________________________
当我在以下代码中调用运行(编译没问题)时,总是出错:“检测到一个不正确的结构大小”procedure TForm1.BtConnectClick(Sender: TObject);
 var
   cb:dword;
   connum:dword ;
     myrasconn:array[1..10] of Trasconn;
   dwresult:dword;begin{  DWORD RasDial(
    LPRASDIALEXTENSIONS lpRasDialExtensions, // pointer to function extensions data
    LPTSTR lpszPhonebook, // pointer to full path and filename of phone-book file
    LPRASDIALPARAMS lpRasDialParams, // pointer to calling parameters data
    DWORD dwNotifierType, // specifies type of RasDial event handler
    LPVOID lpvNotifier, // specifies a handler for RasDial events
    LPHRASCONN lphRasConn  // pointer to variable to receive connection handle
   );}  //获取当前所有连接的状态
  connum:=0;
  myrasconn[1].dwSize:=sizeof(trasconn);
  cb:=sizeof(myrasconn);
  dwresult:=RasEnumConnections(@myrasconn[1],cb,connum);
  if dwresult=0 then
   showmessage(inttostr(connum))
  else
   memo1.lines.add('获取当前系统中活动的连接:' + GetRasError( dwResult )) ;
end;就是说每次执行的时候都不是返回0(0是成功),GetRasError是自定义的错误处理
函数,当失败时由它获得错误信息,每次获得的错误信息是:“检测到一个不正确的结构大小”请问错误出在哪里?怎么解决?
我现在急用这个程序,谢谢!