procedure TForm1.Button1Click(Sender: TObject);begin
temp:='c:\ipconfig.txt';
if fileexists(temp) then
DeleteFile(temp);
winexec(pchar('command.com /C ipconfig>'+temp),sw_hide);
if not FileExists(temp) then
Sleep(3000);
try
Memo1.Lines.LoadFromFile(temp);
except
end;end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FileExists(temp) then
DeleteFile(temp);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
搞定,给分吧
temp:='c:\ipconfig.txt';
if fileexists(temp) then
DeleteFile(temp);
winexec(pchar('command.com /C ipconfig>'+temp),sw_hide);
if not FileExists(temp) then
Sleep(3000);
try
Memo1.Lines.LoadFromFile(temp);
except
end;end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FileExists(temp) then
DeleteFile(temp);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
搞定,给分吧
解决方案 »
- delphi 如何用当前日期作文件名保存起来?
- tclientdataset传输数据时出现mismatch in datapacket问题
- 怎么能让TrackBar恢复原来的位置
- 在D7中怎么调试com+组件
- dxNavBar问题
- 在intraweb中应用messagedlg?????
- 谁有dsgnintf.pas这个文件, 本人急需!此文件位置如下在
- 我将Delphi改造了下
- Delphi下的socket(如TServerSocket)为什么没有超时属性,难道不会有出错吗?
- mspaint 的 ocx 控件 或 类似的控件
- 要知道 TServiceApplication (系统服务程序) 没有 Application.ProcessMessages;(释放CPU),那怎么延时而不占用CPU时间?
- 简单问题给100分
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;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;这是从一个显IP的小程序中CUT出来的.
前面的uses是
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Winsock, StdCtrls, ExtCtrls, Menus ,clipbrd;