如何设置共享? 是说如何能设置硬盘的共享?例如我要设置共享C:\,应该如何做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的设置共享的代码int CMxxx::ShareDiscC(){ // TODO: Add your control notification handler code here char FAR * pszServerName = NULL; short nLevel = 50; struct share_info_50* pBuf = NULL; unsigned short cbBuffer; NET_API_STATUS nStatus; pszServerName ="\0" ; cbBuffer = sizeof(struct share_info_50); pBuf =( share_info_50*)malloc(cbBuffer); if (pBuf == NULL) AfxMessageBox("No memory\n"); // // Assign values to the share_info_50 structure. // CString lpStr2="C:\\DATAFILE"; if(PathFileExists(lpStr2)==FALSE) { if(CreateDirectory(lpStr2,NULL)==FALSE) AfxMessageBox("创建文挡目录出错"); } strcpy(pBuf->shi50_netname, "DATAFILE"); pBuf->shi50_type = STYPE_DISKTREE; pBuf->shi50_flags = SHI50F_ACCESSMASK; pBuf->shi50_re = NULL; pBuf->shi50_path ="C:\\DATAFILE"; strcpy(pBuf->shi50_rw_password, "ccddbb"); strcpy(pBuf->shi50_ro_password, "cceebb"); nStatus = NetShareAdd(pszServerName,nLevel,(char FAR *)pBuf,cbBuffer); if (nStatus == NERR_Success) { return 1; //AfxMessageBox("Share added successfully\n"); } else return 0; // // Free the allocated memory. // if (pBuf != NULL) free(pBuf);} 字体,请教 发送邮件问题 五子棋游戏开发用单文档还是对话框较好 文件内容对齐问题 求助VC/MFC界面问题,怎样用VC实现带GridCtrl的类似Word的查找替换? 服务启动问题-----ACCESS----服务自动关闭,,,欢迎高手指教,可以送200分 怎样获取鼠标相对位置?? 新手求助!! 怎样利用vc自动生成的cfiledialog而不用自己创建?? 汇编版原斑竹的相片 愚蠢的问题:候捷老师和侯俊杰是一个人吗? 调用com时候的CoInitialize(0)究竟做了什么?为什么我的一个指针里面的字符串没了?
int CMxxx::ShareDiscC()
{
// TODO: Add your control notification handler code here
char FAR * pszServerName = NULL;
short nLevel = 50;
struct share_info_50* pBuf = NULL;
unsigned short cbBuffer;
NET_API_STATUS nStatus;
pszServerName ="\0" ;
cbBuffer = sizeof(struct share_info_50);
pBuf =( share_info_50*)malloc(cbBuffer); if (pBuf == NULL)
AfxMessageBox("No memory\n");
//
// Assign values to the share_info_50 structure.
//
CString lpStr2="C:\\DATAFILE"; if(PathFileExists(lpStr2)==FALSE)
{
if(CreateDirectory(lpStr2,NULL)==FALSE)
AfxMessageBox("创建文挡目录出错");
} strcpy(pBuf->shi50_netname, "DATAFILE");
pBuf->shi50_type = STYPE_DISKTREE;
pBuf->shi50_flags = SHI50F_ACCESSMASK;
pBuf->shi50_re = NULL;
pBuf->shi50_path ="C:\\DATAFILE";
strcpy(pBuf->shi50_rw_password, "ccddbb");
strcpy(pBuf->shi50_ro_password, "cceebb");
nStatus = NetShareAdd(pszServerName,nLevel,(char FAR *)pBuf,cbBuffer);
if (nStatus == NERR_Success)
{
return 1;
//AfxMessageBox("Share added successfully\n");
}
else
return 0; //
// Free the allocated memory.
//
if (pBuf != NULL)
free(pBuf);
}