发信人: i_can()
整理人: cobe(2000-06-23 22:50:37), 站内信件
|
【 在 zaction (cutebear) 的大作中提到: 】
: 【 在 i_can (BlueLotus) 的大作中提到: 】
: : 【 在 zaction (cutebear) 的大作中提到: 】
: :
: : API: NetShareAdd
: .......
In VC,the description of the fuction is
API_FUNCTION NetShareAdd(
const char FAR * pszServer,
short sLevel,
const char FAR * pbBuffer,
unsigned short cbBuffer
);
这个函数在netapi32.dll之中。
具体说明太多,自己去找MSDN,下面有个VC例子。
#define UNICODE
#include <windows.h>
#include <stdio.h>
#include <lm.h>
void wmain( int argc, TCHAR *argv[ ])
{
NET_API_STATUS res;
SHARE_INFO_2 p;
DWORD parm_err = 0;
if(argc<2)
printf("Usage: NetShareAdd server\n");
else
{
//
// Fill in the SHARE_INFO_2 structure.
//
p.shi2_netname = TEXT("TESTSHARE");
p.shi2_type = STYPE_DISKTREE; // disk drive
p.shi2_remark = TEXT("TESTSHARE to test NetShareAdd");
p.shi2_permissions = 0;
p.shi2_max_uses = 4;
p.shi2_current_uses = 0;
p.shi2_path = TEXT("C:\\");
p.shi2_passwd = NULL; // no password
//
// Call the NetShareAdd function,
// specifying level 2.
//
res=NetShareAdd(argv[1], 2, (LPBYTE) &p, &parm_err);
//
// If the call succeeds, inform the user.
//
if(res==0)
printf("Share created.\n");
// Otherwise, print an error,
// and identify the parameter in error.
//
else
printf("Error: %u\tparmerr=%u\n", res, parm_err);
}
return;
}
-- I have no VB,but have to be a master of VB...
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.132.73.198]
|
|