unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
save: TButton;
Memo1: TMemo; procedure FormCreate(Sender: TObject);
procedure saveClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);//这里读取gg.txt里的内容到memo1里
begin
memo1.readonly:=ture;
memo1.Lines.LoadFromFile('服务器地址\c:\gg.txt');
//这里主要有个服务器登录过程,需要用户名和密码,这段代码该怎么写不知道!
end;procedure TForm1.saveClick(Sender: TObject);//保存到服务器的c:\gg.txt里!
begin
memo1.readonly:=false;
memo1.Lines.SaveToFile('服务器地址\c:\gg.txt');
end;end.
主要事服务器的登录过程,用户名和密码都已知!(用户名:dsss163,密码:123456)!
文件并不需要下载到自己的客户机上!请大家教教小弟!谢谢了!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
save: TButton;
Memo1: TMemo; procedure FormCreate(Sender: TObject);
procedure saveClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);//这里读取gg.txt里的内容到memo1里
begin
memo1.readonly:=ture;
memo1.Lines.LoadFromFile('服务器地址\c:\gg.txt');
//这里主要有个服务器登录过程,需要用户名和密码,这段代码该怎么写不知道!
end;procedure TForm1.saveClick(Sender: TObject);//保存到服务器的c:\gg.txt里!
begin
memo1.readonly:=false;
memo1.Lines.SaveToFile('服务器地址\c:\gg.txt');
end;end.
主要事服务器的登录过程,用户名和密码都已知!(用户名:dsss163,密码:123456)!
文件并不需要下载到自己的客户机上!请大家教教小弟!谢谢了!
解决方案 »
- 请教一个简单的过滤条件
- 构造函数里再调用另一构造函数,会不会分配了2次内存?
- 获得万象2004系统设置里面的BUTTON句柄,然后执行它的BUTTON的单击事件
- 弱弱的问一句:DATABASE DESKTOP数据库中怎么来定义BOOL类型的字段
- 请问熟悉POS系统的朋友
- 急!!关于D7中的Indy控件问题
- 请教高手,谁能解释一下TButton的ONCLICK事件是如何产生的
- delphi2010使用comport控件出现错误
- 提议:版主将CSDN中的经典的问题和解答作一个总结性的帮助文件同意的就up一下
- 请问,如何在一个工程文件里执行另一个工程的exe文件
- 请问如何在 directX 的游戏中取得屏幕上某一点的颜色值?
- 任务栏托盘区加图标问题~~请高手指点,在线直到问题解决
The LogonUser function attempts to log a user on to the local computer, that is,
to the computer from which LogonUser was called. You cannot use LogonUser to
log on to a remote computer. You specify the user with a user name and domain,
and authenticate the user with a clear-text password. If the function succeeds,
you receive a handle to a token that represents the logged-on user. You can then
use this token handle to impersonate the specified user, or in most cases, to
create a process running in the context of the specified user. BOOL LogonUser(
LPTSTR lpszUsername, // string that specifies the user name
LPTSTR lpszDomain, // string that specifies the domain or
// server
LPTSTR lpszPassword, // string that specifies the password
DWORD dwLogonType, // specifies the type of logon operation
DWORD dwLogonProvider, // specifies the logon provider
PHANDLE phToken // pointer to variable to receive token
// handle
);
或者:
也可以使用WNet函数,下面的函数WNetAddConnection2是建立同服务器的连接,
包括共享资源的映射。
DWORD WNetAddConnection2(
LPNETRESOURCE lpNetResource, // connection details
LPCTSTR lpPassword, // password
LPCTSTR lpUsername, // user name
DWORD dwFlags // connection options
);
The WNetAddConnection2 function makes a connection to a network
resource. The function can redirect a local device to the
network resource.
注意:在9x和NT上该函数的lpPassword,lpUsername只能为空,在NT上你可以指定连接
的用户和密码。