没有API,要修改注册表,具体是什么我也不大清楚,要找一个。
解决方案 »
- 动态创建的按钮,如何将属性设为“透明”?
- Format("%0.2X ",szRbuf); 急求解~~
- select设置非阻塞通信时,send返回10035,怎么处理
- xtreme toolkit9.6的源码是他自己公布的还是别人泄露出来的
- 请教有关toolbar的问题?
- dll中c++析构函数疑惑
- 高手请进来帮忙~!~!!!!!关于DLL的引用问题,急急~!
- 谁愿意帮我调试一个程序,一个简单的计算器,
- 有关GetModuleHandle的问题,大家进来讨论一下
- 有关于Mpeg1-4的文件格式,及算法。
- 我用Aspack压缩exe,dll后开始很正常运行,但过一段时间后就不正常了,不能运行,为什么??
- 有ntdll.h的同志请进。
说明
创建同一个网络资源的永久性连接
返回值
Long,零表示成功。会设置GetLastError。如GetLastError是ERROR_EXTENDED_ERROR,则可用WNetGetLastError取得额外的错误信息
参数表
参数 类型及说明
lpszNetPath String,要连接的网络名
lpszPassword String,可选的一个密码。如为vbNullString,表示采用当前用户的默认密码。如为一个空字串,则不用任何密码
lpszLocalName String,资源的本地名称。(例如,F: 和 LPT1:)
NetShareAdd Shares a resource on a server.
NetShareCheck Queries whether a server is sharing a device.
NetShareDel Deletes a share name from a server's list of shared resources.
NetShareEnum Retrieves share information about each shared resource on a server.
NetShareGetInfo Retrieves information about a specified shared resource on a server.
NetShareSetInfo Sets a shared resource's parameters.
LNK2001: unresolved external symbol _NetShareAdd@16,不知何错代码:
SHARE_INFO_2 si2;
DWORD parm= 0; si2.shi2_current_uses=10;
si2.shi2_max_uses=7;
si2.shi2_netname="rod";
si2.shi2_passwd="";
si2.shi2_path="e:\\guer\\1";
si2.shi2_permissions=ACCESS_ALL;
si2.shi2_re="";
si2.shi2_type=STYPE_DISKTREE; NetShareAdd(NULL,2,(LPBYTE)&si2,&parm);
Library: Use Netapi32.lib (Windows NT/2000) or Svrapi.lib (Windows 95/98).Windows 95/98: You must specify the size of the information buffer, in bytes, using the cbBuffer parameter. The Windows NT/Windows 2000 parm_err parameter is not available on this platform. Therefore, the parameter list is as follows. extern API_FUNCTION
NetShareAdd(
const char FAR * pszServer,
short sLevel,
const char FAR * pbBuffer,
unsigned short cbBuffer
);NetShareAdd Sample (Windows 95/98)
Windows 95/98: The following code sample demonstrates how to share a resource on the local computer with a call to the NetShareAdd function.The code sample specifies the share_info_50 structure and no password on the share. The sample also allocates and frees the memory required for the information buffer.#include <stdio.h>
#include <windows.h>
#include <svrapi.h>int main(int argc, char FAR * argv[])
{
char FAR * pszServerName = NULL;
short nLevel = 50;
struct share_info_50* pBuf = NULL;
unsigned short cbBuffer;
NET_API_STATUS nStatus;
//
// ServerName can be NULL to indicate the local computer.
//
if ((argc < 3) || (argc > 4))
{
printf("Usage: %s [\\\\ServerName] ShareName SharePath\n", argv[0]);
exit(1);
} if (argc == 4)
pszServerName = argv[1];
//
// Allocate the memory required to specify a
// share_info_50 structure.
//
cbBuffer = sizeof(struct share_info_50);
pBuf = malloc(cbBuffer); if (pBuf == NULL)
printf("No memory\n");
//
// Assign values to the share_info_50 structure.
//
strcpy(pBuf->shi50_netname, argv[argc-2]);
pBuf->shi50_type = STYPE_DISKTREE;
pBuf->shi50_flags = SHI50F_FULL;
pBuf->shi50_re = NULL;
pBuf->shi50_path = argv[argc-1];
pBuf->shi50_rw_password[0] = '\0'; // No password
pBuf->shi50_ro_password[0] = '\0'; // No password
//
// Call the NetShareAdd function
// specifying information level 50.
//
nStatus = NetShareAdd(pszServerName,
nLevel,
(char FAR *)pBuf,
cbBuffer);
//
// Display the result of the function call.
//
if (nStatus == NERR_Success)
printf("Share added successfully\n");
else
fprintf(stderr, "A system error has occurred: %d\n", nStatus);
//
// Free the allocated memory.
//
if (pBuf != NULL)
free(pBuf); return 0;
}