标题:[求助]急!关于DELPHI8的使用WINSOCK
只看楼主
tantan214
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-4-26
 问题点数:0 回复次数:0 
[求助]急!关于DELPHI8的使用WINSOCK

unit sy102Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Borland.Vcl.StdCtrls, System.ComponentModel,WinSock;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
function GetHostName:String;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.nfm}
function TForm1.GetHostName:String;
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
Size: Cardinal;
begin
result:='';
Size := MAX_COMPUTERNAME_LENGTH+1;
GetComputerName(ComputerName, Size);
Result:=StrPas(ComputerName);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=GetHostName;
Edit2.Text:=DateTimeToStr(Now);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text:='';
Edit2.Text:='';
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
application.Terminate;
end;

end.
这是使用DELPHI8获取计算机名称的程序,但不知为什么,在USER中不能直接通过添加WINSOCK来实现GETCOMPUTERNAME()函数的调用,在DELPHI7可以?请指教,谢谢!

[此贴子已经被作者于2006-4-26 18:43:22编辑过]

搜索更多相关主题的帖子: WINSOCK 
2006-04-26 18:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-60369-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.231768 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved