易截截图软件、单文件、免安装、纯绿色、仅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调用外部程序并等待其运行信息(如结束)

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

Delphi常用控件命名规范

 常用控件命名前缀
控件类名
前缀
TForm等窗体类 
frm
TButton, TSpeedButton等所有的按钮类 
btn
TCheckBox等所有的检查框 
chk
TRadioButton单选按钮类
rdo
TListBox等所有的列表框类 
lst
TPanel等所有的面板类
pnl
TLabel, TStaticText等所有用来显示的标签类 
lbl
TE ......

Delphi 与 C/C++ 数据类型对照表

Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......

delphi canvas使用

在DELPHI为编程者提供了一个灵活的绘图场所,即本文所述的   
CANVAS类,在DELPHI中的很多控件都具有此属性,使编程者可以   
在这些的控件的表面随心所欲的绘图,这对完善用户界面或者制   
作一些屏幕特技都有着非凡的作用,下面举例说明几种特殊屏幕    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号