用winexec('rundll32.exe rnaui.dll,RnaDial '+'连接Internet',9);时
出现加载rnaui.dll时出错,找不到指定的模块。
还有没有其他方法,手动建立连接?

解决方案 »

  1.   

    winexec('rundll32.exe rnaui.dll,RnaDial '+'连接Internet',9);执行这个时候前提是你应安装了拨号网络,而当你安庄拨号网络的时候,就会copy相应的dll,到系统目录里面。所以找不到dll了。
      

  2.   

    _DoConnect(0);//调用拨号,我在2000,98测试过可以;
    下面是单元,希望对你有用
    unit libRasDial;
    interface 
    uses 
      Windows, SysUtils, Registry, WinSock, WinInet, Ras; 
    function  _IsConnectedToInternet: Boolean; 
    function  _DoConnect(hwndParent:HWND): Boolean; 
    function  _GetRasConnNum: Integer; 
    procedure _DoNew(hwndParent:HWND);
    function RasEnumEntriesA(Reserved: Pointer; 
                             szPhonebook: PChar; 
                             lpRasEntryName: PRASENTRYNAME; 
                             lpcb : PDWORD; 
                             lpcEntries : PDWORD 
                             ): DWORD; stdcall; 
    function RasGetErrorStringA(uErrorValue   : DWORD; 
                                szErrorString : PChar; 
                                cBufSize      : DWORD 
                                ): DWORD; stdcall; 
    function RasCreatePhonebookEntryA(hWndParent : HWND; 
                                      lpszPhonebook : PChar 
                                      ) : DWORD; stdcall; 
    var Conn: DWORD; 
    implementation 
    const 
      INTERNET_CONNECTION_MODEM           = 1; 
      INTERNET_CONNECTION_LAN             = 2; 
      INTERNET_CONNECTION_PROXY           = 4; 
      INTERNET_CONNECTION_MODEM_BUSY      = 8; 
    function InternetGetConnectedState(lpdwFlags: LPDWORD; 
      dwReserved: DWORD): BOOL; stdcall; external 'WININET.DLL'; 
    function  _IsConnectedToInternet: Boolean; 
    var 
      dwConnectionTypes: Integer; 
    begin 
      try 
        dwConnectionTypes := INTERNET_CONNECTION_MODEM + 
                             INTERNET_CONNECTION_LAN + 
                             INTERNET_CONNECTION_PROXY; 
        if InternetGetConnectedState(@dwConnectionTypes, 0) then 
          Result := true 
        else 
          Result := false; 
      except 
        Result := false; 
      end; 
    end; 
    function  _DoConnect(hwndParent:HWND):Boolean; 
    begin 
      Result:= false; 
      if _GetRasConnNum=0 then _DoNew(hwndParent); 
      if _GetRasConnNum=0 then exit; 
      InternetDial(hwndparent, 
                   '', 
                   INTERNET_AUTODIAL_FORCE_ONLINE, 
                   @Conn, 
                   0); 
      if Conn<>0 then Result:=true; 
    end; 
    function _GetRasConnNum: Integer; 
    var 
      Entries  : array [0..15] of TRASENTRYNAME; 
      cb       : DWORD; 
      cEntries : DWORD; 
      dwRet    : DWORD; 
      Buf      : array [0..127] of char; 
    begin 
      FillChar(Entries, SizeOf(Entries), 0); 
      Entries[0].dwSize := SizeOf(TRASENTRYNAME); 
      cb := SizeOf(Entries); 
      cEntries := 0; 
      dwRet := RasEnumEntriesA(NIL, NIL, @Entries[0], @cb, @cEntries); 
      if dwRet <> 0 then RasGetErrorStringA(dwRet, @Buf[0], SizeOf(Buf)); 
      Result:= cEntries; 
    end; 
    procedure _DoNew(hwndParent:HWND); 
    var 
      dwRet: DWORD; 
      Buf  : Array [0..127] of char; 
    begin 
      dwRet := RasCreatePhonebookEntryA(hwndParent, nil); 
      if dwRet <> 0 then RasGetErrorStringA(dwRet, @Buf[0], SizeOf(Buf)); 
    end; 
    function RasEnumEntriesA; external rasapi32 name 'RasEnumEntriesA'; 
    function RasGetErrorStringA; external rasapi32 name 'RasGetErrorStringA'; 
    function RasCreatePhonebookEntryA; external rasapi32 name 'RasCreatePhonebookEntryA'; 
    end. 
      

  3.   

    怎样通过moden-交换机-moden实现两部机之间的连接
      

  4.   

    2000下拨号和98下是不同的,
    我找到书了,《Delphi网络高级编程》,不过光盘不在,例子没法个你
    你看看RAS WinAPI的MSDN说明
    RasDial
    The RasDial function establishes a RAS connection between a RAS client and a RAS server. The connection data includes callback and user-authentication information. DWORD RasDial(
      LPRASDIALEXTENSIONS lpRasDialExtensions,
                              // pointer to function extensions data
      LPCTSTR lpszPhonebook,  // pointer to full path and file 
                              //  name 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
    );
    Parameters
    lpRasDialExtensions 
    [in] Windows NT/2000/XP: Pointer to a RASDIALEXTENSIONS structure that specifies a set of RasDial extended features to enable. Set this parameter to NULL if there is not a need to enable these features. 
    Windows 95/98/Me: This parameter is ignored. On these platforms, RasDial always uses the default behaviors for the RASDIALEXTENSIONS options. lpszPhonebook 
    [in] Windows NT/2000/XP: Pointer to a null-terminated string that specifies the full path and file name of a phone-book (PBK) file. If this parameter is NULL, the function uses the current default phone-book file. The default phone-book file is the one selected by the user in the User Preferences property sheet of the Dial-Up Networking dialog box. 
    Windows 95: This parameter should always be NULL. Dial-up networking stores phone-book entries in the registry rather than in a phone-book file. lpRasDialParams 
    [in] Pointer to a RASDIALPARAMS structure that specifies calling parameters for the RAS connection. 
    The caller must set the RASDIALPARAMS structure's dwSize member to sizeof(RASDIALPARAMS) to identify the version of the structure being passed. dwNotifierType 
    [in] Specifies the nature of the lpvNotifier parameter. If lpvNotifier is NULL, dwNotifierType is ignored. If lpvNotifier is not NULL, set dwNotifierType to one of the following values. Value Meaning 
    0xFFFFFFFF The lpvNotifier parameter is a handle to a window to receive progress notification messages. In a progress notification message, wParam is the equivalent of the rasconnstate parameter of RasDialFunc and RasDialFunc1, and lParam is the equivalent of the dwError parameter of RasDialFunc and RasDialFunc1. 
    The progress notification message uses a system registered message code. You can obtain the value of this message code as follows: {UINT unMsg = 
      RegisterWindowMessageA( RASDIALEVENT );
     if (unMsg == 0)
           unMsg = WM_RASDIALEVENT; 
     }
     
    0 The lpvNotifier parameter points to a RasDialFunc callback function.  
    1 The lpvNotifier parameter points to a RasDialFunc1 callback function.  
    2 Windows NT/2000/XP: The lpvNotifier parameter points to a RasDialFunc2 callback function.  
    lpvNotifier 
    [in] Specifies a window handle or a RasDialFunc, RasDialFunc1, or RasDialFunc2 callback function to receive RasDial event notifications. The dwNotifierType parameter specifies the nature of lpvNotifier. Please refer to its description preceding for further detail. 
    If this parameter is not NULL, RasDial sends the window a message, or calls the callback function, for each RasDial event. Additionally, the RasDial call operates asynchronously: RasDial returns immediately, before the connection is established, and communicates its progress via the window or callback function. If lpvNotifier is NULL, the RasDial call operates synchronously: RasDial does not return until the connection attempt has completed successfully or failed. If lpvNotifier is not NULL, notifications to the window or callback function can occur at any time after the initial call to RasDial. Notifications end when one of the following events occurs: The connection is established. In other words, the RAS connection state is RASCS_Connected. 
    The connection fails. In other words, dwError is nonzero. 
    RasHangUp is called on the connection. 
    The callback notifications are made in the context of a thread captured during the initial call to RasDial. lphRasConn 
    [in] Pointer to a variable of type HRASCONN. Set the HRASCONN variable to NULL before calling RasDial. If RasDial succeeds, it stores a handle to the RAS connection into *lphRasConn. 
    Return Values
    If the function succeeds, the immediate return value is zero. In addition, the function stores a handle to the RAS connection into the variable pointed to by lphRasConn. If the function fails, the immediate return value is a nonzero error value, either from the set listed in the RAS header file or ERROR_NOT_ENOUGH_MEMORY. Res
    Errors that occur after the immediate return can be detected by RasGetConnectStatus. Data is available until an application calls RasHangUp to hang up the connection. An application must eventually call RasHangUp whenever a non-NULL connection handle is stored into *lphRasConn. This applies even if RasDial returns a nonzero (error) value. An application can safely call RasHangUp from a RasDial notifier callback function. If this is done, however, the hangup does not occur until the routine returns. 
      

  5.   

    csdncjp() 我的那个单元就好用啊,难道你没试过?伤心~~~
      

  6.   

    uses 
      ras出错啊
      

  7.   

    theone_jxm() 
    你那段代码是delphi7做的吗?