C
cornermoss
Unregistered / Unconfirmed
GUEST, unregistred user!
因为我用ExitWindowsEx关机是,如果别人和你有连接,就要弹出对话框~~~
我现在想先断开所有连接,再关机(我是在Win98里)
附CSDN里Kingron(戒网中……)以前的帖子,我这里怎么没效果呢?
const
NETBUFF_SIZE = $208;
type
NetSessionEnum = function(ServerName: LPSTR; Level: DWORD; Bufptr: PBYTE; MaxLen: DWORD; total: LPDWORD; resume_hwnd: LPDWORD): Dword; stdcall;
NetSessionDel = function(ServerName: LPSTR; ClientName: LPSTR; UserName: LPSTR): dword; stdcall;
function NetCloseAll: Boolean;
type
TbyBuff=array[0..NETBUFF_SIZE-1] of byte;
var
byBuff:TBybuff;
dwNetRet,i,dwEntries,dwTotalEntries:dword;
szClient:LPSTR;
dwUserName:LPSTR;
bRet:boolean;
lpbyBuff:^TbyBuff;
h:hwnd;
EnumProc:NetSessionEnum;
DelProc:NetSessionDel;
begin
h:=LoadLibrary('svrapi.dll');
lpbybuff:=@bybuff;
bRet:=false;
if h<>0 then
begin
EnumProc:=GetProcAddress(h,'NetSessionEnum');
DelProc:=GetprocAddress(h,'NetSessionDel');
if Assigned(EnumProc) and Assigned(DelProc) then
begin
dwNetRet:=EnumProc(nil,$32,@byBuff,NETBUFF_SIZE,@dwEntries,@dwTotalEntries);
if dwNetRet=0 then
begin
bRet:=true;
for i:=0 to dwTotalEntries-1 do
begin
szClient:=LPSTR(lpbybuff^[0]);
dwUserName:=LPSTR(LPbybuff^[2]);
dwNetRet:=DelProc(nil,szClient,dwUserName);
if dwNetRet<>0 then
begin
bRet:=false;
break;
end;
lpbybuff:=pointer(integer(lpbybuff)+26);
end;
end; //NetSessionEnum
end
else
bRet:=false;
end //GetProcAddress
else
bRet:=false;
FreeLibrary(h);
result:=bRet;
end;
我这里分不多了,不好意思哈~~哪位大虾帮帮忙,不胜感激哦*_*
我现在想先断开所有连接,再关机(我是在Win98里)
附CSDN里Kingron(戒网中……)以前的帖子,我这里怎么没效果呢?
const
NETBUFF_SIZE = $208;
type
NetSessionEnum = function(ServerName: LPSTR; Level: DWORD; Bufptr: PBYTE; MaxLen: DWORD; total: LPDWORD; resume_hwnd: LPDWORD): Dword; stdcall;
NetSessionDel = function(ServerName: LPSTR; ClientName: LPSTR; UserName: LPSTR): dword; stdcall;
function NetCloseAll: Boolean;
type
TbyBuff=array[0..NETBUFF_SIZE-1] of byte;
var
byBuff:TBybuff;
dwNetRet,i,dwEntries,dwTotalEntries:dword;
szClient:LPSTR;
dwUserName:LPSTR;
bRet:boolean;
lpbyBuff:^TbyBuff;
h:hwnd;
EnumProc:NetSessionEnum;
DelProc:NetSessionDel;
begin
h:=LoadLibrary('svrapi.dll');
lpbybuff:=@bybuff;
bRet:=false;
if h<>0 then
begin
EnumProc:=GetProcAddress(h,'NetSessionEnum');
DelProc:=GetprocAddress(h,'NetSessionDel');
if Assigned(EnumProc) and Assigned(DelProc) then
begin
dwNetRet:=EnumProc(nil,$32,@byBuff,NETBUFF_SIZE,@dwEntries,@dwTotalEntries);
if dwNetRet=0 then
begin
bRet:=true;
for i:=0 to dwTotalEntries-1 do
begin
szClient:=LPSTR(lpbybuff^[0]);
dwUserName:=LPSTR(LPbybuff^[2]);
dwNetRet:=DelProc(nil,szClient,dwUserName);
if dwNetRet<>0 then
begin
bRet:=false;
break;
end;
lpbybuff:=pointer(integer(lpbybuff)+26);
end;
end; //NetSessionEnum
end
else
bRet:=false;
end //GetProcAddress
else
bRet:=false;
FreeLibrary(h);
result:=bRet;
end;
我这里分不多了,不好意思哈~~哪位大虾帮帮忙,不胜感激哦*_*