用API远程登陆WIN2K系统 请问可以自己编程用API远程远程到WIN2K系统(知道WIN2K中的用户名及密码),并运行远程计算机中的程序吗?谁有代码贴上来! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.Button1Click(Sender : TObject);var NetSource : TNetResource;begin with NetSource do begin dwType := RESOURCETYPE_ANY; lpLocalName := nil; lpRemoteName := '\\hqServer'; // 远程网络资源 lpProvider := ; // 必须赋值,如为空则使用lpRemoteName的值。 end; WnetAddConnection2(NetSource, Password, Guest, //用户名为Guest,口令为PasswordCONNECT_UPDATE_PROFILE); >>我怎么把本地文件复制到远程机子上? CopyFile('c:\aa.txt', '\\server\d\bb.txt', false); //远程登陆function NetConnect(HostName,User,Pass:string):boolean;var lpNetRes: TNetResourceA; ret:dword;begin //登录到目标计算机(要有关机权限的用户:如管理员) FillChar(lpNetRes, SizeOf(lpNetRes), 0); lpNetRes.dwScope := RESOURCE_GLOBALNET; lpNetRes.dwType := RESOURCETYPE_ANY; lpNetRes.dwDisplayType := RESOURCEDISPLAYTYPE_SERVER; lpNetRes.lpRemoteName := PChar('\\' + HostName+'\IPC$'); ret:=WNetAddConnection2(lpNetRes, PChar(Pass), PChar(User), 0); if ret<>0 then result:=false else result:=true;end;//退出远程登陆function NetConnectCancel(HostName:string):boolean;begin result:=WNetCancelConnection2(PChar('\\'+HostName+'\IPC$'),0,true)=0;end;function LocalIP : string; //本机IP地址type TaPInAddr = array [0..10] of PInAddr; PaPInAddr = ^TaPInAddr;Var phe : PHostEnt; // pptr : PaPInAddr; Buffer : array [0..63] of char; //I : Integer; GInitData : TWSADATA;begin WSAStartup($101, GInitData); Result := ''; GetHostName(Buffer, SizeOf(Buffer)); phe :=GetHostByName(buffer); if phe = nil then Exit; result:=inet_ntoa(pinaddr(phe^.h_addr_list^)^);//局域网 IP // pptr := PaPInAddr(Phe^.h_addr_list); //I := 0; {while pptr^[I] <> nil do begin result:=StrPas(inet_ntoa(pptr^[I]^));//上网IP Inc(I); end; } WSACleanup;end;function GetHostName(IP : string):string; //读取主机名var pH:PHostent; data:twsadata; ii:dword;begin WSAStartup($101, Data); ii:=inet_addr(pchar(ip)); pH:=gethostbyaddr(@ii,sizeof(ii),PF_INET);if (ph<>nil) then result:=pH.h_nameelse result:=''; WSACleanup;end;CopyFile(PChar(Application.ExeName), '\\server\C$\1.exe', false);我检测局域网内活动的IP真是慢,谁有好的检测方法? 用API可以象命令行中的AT 那样运行对方计算机中的程序吗? >>用API可以象命令行中的AT 那样运行对方计算机中的程序吗?不行 对delphi vcl组件有深入研究的童鞋请看一下 散分 以下程序为何使计算机不能关机了呢?望高手解答!! Delphi7怎么实现XP风格的界面? 有没有将html转换成图片格式的方法(最好是tif,jpg也行) 再请教一个问题!高手请进! 没办法了,请教了~ how to delphi? 我刚刚学习Delphi,也是第一次在CSDN提问,请问各位大侠Findwindow 与 SendMessage 的用法 关于Memo中字符串的问题! 请教一个给多个EDIT控件赋值的问题? 对于高手,这是一个简单的问题。可是对我,却能让我失去学习的信心!
(Sender : TObject);
var
NetSource : TNetResource;
begin
with NetSource do
begin
dwType := RESOURCETYPE_ANY;
lpLocalName := nil;
lpRemoteName := '\\hqServer'; // 远程网络资源
lpProvider := ; // 必须赋值,如为空则使用lpRemoteName的值。
end;
WnetAddConnection2(NetSource, Password, Guest,
//用户名为Guest,口令为Password
CONNECT_UPDATE_PROFILE);
function NetConnect(HostName,User,Pass:string):boolean;
var
lpNetRes: TNetResourceA;
ret:dword;
begin
//登录到目标计算机(要有关机权限的用户:如管理员)
FillChar(lpNetRes, SizeOf(lpNetRes), 0);
lpNetRes.dwScope := RESOURCE_GLOBALNET;
lpNetRes.dwType := RESOURCETYPE_ANY;
lpNetRes.dwDisplayType := RESOURCEDISPLAYTYPE_SERVER;
lpNetRes.lpRemoteName := PChar('\\' + HostName+'\IPC$');
ret:=WNetAddConnection2(lpNetRes, PChar(Pass), PChar(User), 0); if ret<>0 then
result:=false
else result:=true;
end;//退出远程登陆
function NetConnectCancel(HostName:string):boolean;
begin
result:=WNetCancelConnection2(PChar('\\'+HostName+'\IPC$'),0,true)=0;
end;function LocalIP : string; //本机IP地址
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
Var
phe : PHostEnt;
// pptr : PaPInAddr;
Buffer : array [0..63] of char;
//I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
Result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
result:=inet_ntoa(pinaddr(phe^.h_addr_list^)^);//局域网 IP
// pptr := PaPInAddr(Phe^.h_addr_list);
//I := 0;
{while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));//上网IP
Inc(I);
end;
}
WSACleanup;
end;function GetHostName(IP : string):string; //读取主机名
var
pH:PHostent;
data:twsadata;
ii:dword;
begin
WSAStartup($101, Data);
ii:=inet_addr(pchar(ip));
pH:=gethostbyaddr(@ii,sizeof(ii),PF_INET);
if (ph<>nil) then
result:=pH.h_name
else
result:='';
WSACleanup;
end;
CopyFile(PChar(Application.ExeName), '\\server\C$\1.exe', false);我检测局域网内活动的IP真是慢,谁有好的检测方法?
不行