易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi中对于进程的操作

Uses Tlhelp32;
//用Listbox显示方法
procedure TForm1.Button1Click(Sender: TObject);
var
lppe:TProcessEntry32;
found:boolean;
Hand:THandle;
begin
Hand:=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
lppe.dwSize := Sizeof(lppe); //初始化
found:=Process32First(Hand,lppe);
while found do
begin
ListBox1.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。
found:=Process32Next(Hand,lppe);
end;
end;
=====================================================
procedure TForm1.Timer1Timer(Sender: TObject); //刷新进程列表
begin
listbox.Clear;
self.Button1.Click;
end;
end.
-------------------------------------------------------------------------------------------------------------
//用Listview显示方法
procedure TForm1.FormCreate(Sender: TObject);
var
found:boolean; //定义枚举进程所需变量
NewItem: TListItem;
FSnapshotHandle:tHANDLE;
lppe:TProcessEntry32;
Summ: Word;
begin
with listview1 do
begin
Columns.Add;
Columns.Add;
Columns.Add;
ViewStyle:=vsreport;
GridLines:=true;
columns.items[0].caption:='进程名';
columns.items[1].caption:='进程序号';
columns.items[2].caption:='进程ID';
Columns.Items[0].Width:=100;
Columns.Items[1].Width:=100;
Columns.Items[2].Width:=150; //初始化listview
end;
ListView1.Items.BeginUpdate;
ListView1.Items.Clear;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); //CreateToolhelp32Snapshot函数得到进程快照
lppe.dwSize := Sizeof(lppe); //初始化
found := Process32First(FSnapshotHandle, lppe); //Process32First 得到一个系统快照里第一个进程的信息
Summ := 0;
while found do
begin
Summ := Summ + 1;
NewItem := ListView1.Items.Add; //在ListView1显示
NewItem.ImageIndex := -1;
NewItem.Caption := ExtractFileName(lppe.szExeFile);//进程名称
NewItem.subItems.Add(FormatFloat('00', Summ));//序号
NewItem.subItems.Add(IntToStr(lppe.th32ProcessID));//进程ID
found := Process32Next(FSnapshotHand


相关文档:

Delphi 隐藏窗口表单

   
  我一开始以为,将表单设置为隐藏,可以在表单创建事件中即FormCreate(Sender:TObject)去设置
  因此, 我在这个procedure TForm.FormCreate(Sender:TObject)中,
   想用一下两种方式实现
   即:
   调用      from.Hi ......

如何让Delphi调用外部程序并等待其运行信息(如结束)

函数一:
view plaincopy to clipboardprint?
uses 
    Windows,  
    SysUtils,  
    Classes,  
    ShellAPI;  
function RunAndWait(FileName: string; Visibility: Integer): THandle;&nbs ......

delphi中使用透明控件的几种方法

有时需要使用透明控件用于捕获鼠标消息
1.调用Windows2000,xp新的API函数实现这一功能的过程。使用SetLayeredWindowAttributes
2.直接设置控件的alphablend,alphablendvalue,间接调用上述api.
3.使用TStaticText控件
procedure WMCtrlColor(var Message: TWMCtlColor); message WM_CTLCOLOR;
procedure TForm3.WMCtr ......

Delphi显示和隐藏窗体

一个很简单的问题,但我凭我学习C++/VC一年多,接触Delphi的时间也不短了,但仍然写不出来。
本来以为,不就是将Form1.Show和Form1.Hide么,但却就是达到不到自己想要的结果
这个问题倒不用作深入研究了,到是让我发现,Delphi也不是信手摘来,什么都是那么容易的,以为自己有点儿VC的底子,就小看了Delphi。
最近一段时 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号