/* zong:
MSDN (version October 2001):
Platform SDK Documentation -> Networking and Directory Services
-> Network Management -> Windows Networking (WNet)
-> Using Windows Networking -> Assigning a Drive to Share.
The example demonstrates how to connect a drive letter to a remote
server share with a call to the WNetAddConnection2 function.
*/
#include <windows.h>
#include <stdio.h>
#include <winnetwk.h>
void main()
{
NETRESOURCE nr;
DWORD res;
TCHAR /*szUserName[32] = "",
szPassword[32] = "",*/
szLocalName[32] = "Q:",
szRemoteName[MAX_PATH] = "\\\\192.168.0.230\\ca";
//
// Assign values to the NETRESOURCE structure.
//
nr.dwType = RESOURCETYPE_ANY;
nr.lpLocalName = szLocalName;
nr.lpRemoteName = szRemoteName;
nr.lpProvider = NULL;
//
// Call the WNetAddConnection2 function to assign
// a drive letter to the share.
//
//res = WNetAddConnection2(&nr, szPassword, szUserName, FALSE); // original
//res = WNetAddConnection2(&nr, 0, 0, FALSE); // zong
res = WNetCancelConnection2(szLocalName, FALSE, FALSE); // zong
//
// If the call succeeds, inform the user; otherwise,
// print the error.
//
if(res == NO_ERROR)
printf("Connection added/cancelled successfully. \n", szRemoteName);
else
printf("Error: %ld\n", res);
return;
}
没有合适的资源?快使用搜索试试~ 我知道了~
AddConn2.rar_To the Letter_WNetAddConnection2
共7个文件
plg:1个
cpp:1个
ncb:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 13 浏览量
2022-09-21
03:23:12
上传
评论
收藏 7KB RAR 举报
温馨提示
The example demonstrates how to connect a drive letter to a remote server share with a call to the WNetAddConnection2 function.
资源详情
资源评论
资源推荐
收起资源包目录
AddConn2.rar (7个子文件)
www.pudn.com.txt 218B
AddConn2
AddConn2.opt 48KB
AddConn2.dsw 539B
AddConn2.plg 1KB
AddConn2.dsp 4KB
AddConn2.ncb 41KB
Test.cpp 1KB
共 7 条
- 1
邓凌佳
- 粉丝: 65
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0