在aaa.exe中加入GetCurrentDirectory得到他的路径。
解决方案 »
- 急求!用mscomm实现串口发送16进制数据?
- 如何在WebBrowser中,清除了一个网页在我机上的所有cookie变量? 100分!
- 怎样才能取到屏幕上反蓝的词 ~~急
- 我用WebBrowser控件写了个自动注册网页ID的程序,可是每次做完之后都是同一个账号,请问怎样可以每次申请的时候,都让WebBrowser控件刷新
- OCX 报地址问题(急需解决)
- 如果我需要以流的形式存储文件而不是用数据库,应该怎么做?
- 请高手帮忙!!把下面这段Delphi代码翻译成VC++,感激不尽
- 关于建立多窗口,请求帮助~
- 有知道本论坛的离线浏览数据包何处下载?
- 求救,一个整形变量是否可以转化成一个RECORD的数据类型,兄弟我急!!
- 那位高手能给我一个COM的最简单的实例
- 这样一个存储过程该如何写????
这里有一个例子列出找出所有进程信息的方法
你可以用来试试,相信你能解决的!
const
ProcessInfoCaptions: array[0..3] of string = (
'ProcessName', 'Threads', 'ID', 'ParentID');
procedure TFormServer.FillProcessInfoList();
var
I: Integer;
ExeFile: string;
PE: TProcessEntry32;
HAppIcon: HIcon;
begin
Refresh;
ListView.Columns.Clear;
ListView.Items.Clear;
for I := Low(ProcessInfoCaptions) to High(ProcessInfoCaptions) do
with ListView.Columns.Add do
begin
if I = 0 then Width := 285
else Width := 75;
Caption := ProcessInfoCaptions[I];
end;
for I := 0 to FProcList.Count - 1 do
begin
PE := PProcessEntry32(FProcList.Items[I])^;
HAppIcon := ExtractIcon(HInstance, PE.szExeFile, 0);
try
if HAppIcon = 0 then HAppIcon := FWinIcon;
ExeFile := PE.szExeFile;
if ListView.ViewStyle = vsList then
ExeFile := ExtractFileName(ExeFile);
// insert new item, set its caption, add subitems
with ListView.Items.Add, SubItems do
begin
Caption := ExeFile;
Data := FProcList.Items[I];
Add(IntToStr(PE.cntThreads));
Add(IntToHex(PE.th32ProcessID, 8));
Add(IntToHex(PE.th32ParentProcessID, 8));
// if ImageList <> nil then
// ImageIndex := ImageList_AddIcon(ImageList.Handle, HAppIcon);
end;
finally
if HAppIcon <> FWinIcon then DestroyIcon(HAppIcon);
end;
end;
end;
GetModuleFileName的第一个参数是loadLibary的返回值第2个参数返回程序的路径,第三个是路径的长度!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormShow(Sender: TObject);
begin
application.MainForm.Caption:=application.ExeName ;
application.Title:='你好';
end;procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(extractfilename(application.exename));
end;procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage(extractfilepath(application.exename));
end;procedure TForm1.Button3Click(Sender: TObject);
begin
showmessage(extractfileext(application.exename));
end;end.