我想把远程的机子上的共享文件夹中的文件剪切到本地,需要输入密码(如果不输入,用户和密码,操作失败,win2000系统) 
例如:远程计算机 ip=192.168.0.130
                 user=sa
                 key=sa
          共享文件夹为:d://cmis//exch//xcaq//put//*.dat
     本地计算机 ip=192.168.0.253
         本地存放文件的目录为:d://datainfra//file//

解决方案 »

  1.   

    DWORD WNetAddConnection2(
      LPNETRESOURCE lpNetResource,
      LPCTSTR lpPassword,
      LPCTSTR lpUsername,
      DWORD dwFlags
    );
    建立共享管道。
    然后和本地操作没什么区别,注意要有可写的权限才行,
    远程的目录是“\\\\192.168.0.130\\$(ShareName)\\.....”, 
    注$(ShareName)是共享文件夹的名字。注意:未验证。
      

  2.   

    WNetAddConnection2 中这4个参数到底怎么用,有人讲一下吗?!
    主要是 LPNETRESOURCE lpNetResource 和  DWORD dwFlags
      

  3.   

    WNetAddConnection就可以读取了。
    要剪切,你有写权限没?
    还有在你那失败,错误代码是多少?Example code:
    DWORD dwResult; 
    NETRESOURCE nr; 
    //
    // Call the WNetAddConnection2 function to make the connection,
    //   specifying a persistent connection.
    //
    dwResult = WNetAddConnection2(&nr, // NETRESOURCE from enumeration 
        (LPSTR) NULL,                  // no password 
        (LPSTR) NULL,                  // logged-in user 
        CONNECT_UPDATE_PROFILE);       // update profile with connect information 
     
    // Process errors.
    //  The local device is already connected to a network resource.
    //
    if (dwResult == ERROR_ALREADY_ASSIGNED) 

        TextOut(hdc, 10, 10, "Already connected to specified resource.", 40); 
        return FALSE; 

     
    //  An entry for the local device already exists in the user profile.
    //
    else if (dwResult == ERROR_DEVICE_ALREADY_REMEMBERED) 

        TextOut(hdc, 10, 10, 
            "Attempted reassignment of remembered device.", 44); 
        return FALSE; 

    else if(dwResult != NO_ERROR) 

        //
        // Call an application-defined error handler.
        //
        NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetAddConnection2"); 
        return FALSE; 

     
    //
    // Otherwise, report a successful connection.
    //
    TextOut(hdc, 10, 10, "Connected to specified resource.", 32); 
      

  4.   

    错误:DataTransDlg.obj : error LNK2001: unresolved external symbol_WNetAddConnection2A@16
    Debug/DataTrans.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.是不是缺少什么库函数呀!
      

  5.   

    Requirements
    Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. 
    Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server. 
    Header Declared in Winnetwk.h.
     
    Library Link to Mpr.lib.
     
    DLL Requires Mpr.dll.  
    Unicode Implemented as WNetAddConnection2W (Unicode) and WNetAddConnection2A (ANSI). Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
     
    需要mpr.lib
      

  6.   

    我已经LINK 了一个oracle的一个oci.h,还能LINK 吗?!
      

  7.   

    LINK : fatal error LNK1104: cannot open file "C:\Program.obj"我LINK mpr.lib,出来一个错误!请问为什么?!
      

  8.   

    可以,你可以直接在后面写新的LINK,不过要主要加上“”最好!
      

  9.   

    把原来的 clean 一下,
    然后 rebuild 工程 ...