为什么有时有结果有时没有结果?
界面上只有一个ListBox和一个Button。use TLHelp32procedure TForm1.Button1Click(Sender: TObject);
var
lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
found := Process32First(Hand,lppe);
while found do
begin
ListBox1.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。
found := Process32Next(Hand,lppe);
end;
end;
界面上只有一个ListBox和一个Button。use TLHelp32procedure TForm1.Button1Click(Sender: TObject);
var
lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
found := Process32First(Hand,lppe);
while found do
begin
ListBox1.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。
found := Process32Next(Hand,lppe);
end;
end;
解决方案 »
- delphi 视频加解密播放问题
- Delphi 如何从html 中提取纯文本
- 自定义timage控件的派生控件的时候,能不能使它在加载图片的时候自动将图片的实际尺寸赋为本身的初始值?
- 突然字段找不到了,怪
- 请问一下,我最近做一项目 ,用到TADOCOMMAND组件时,我在多表中进行多表查询,为什么返回的结果老是重复啊?
- 批处理用什么软件生成EXE或COM
- 报表设置问题!急急急!!!!
- delphi读取word文件中的复选框???
- windows服务程序无法显示界面.在线等.
- 怎么遍文件夹所有文件的MD5
- datetimepicker的使用方法?
- 大家来帮我看一下:编译一个从class和Interface继续下来的类时,出错! 不明白原因!请高手指点一下.
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);lppe.dwSize := SizeOf(FProcessEntry32); found := Process32First(Hand,lppe);
5星上将,果然不一样!
不过为什么要加lppe.dwSize := SizeOf(TProcessEntry32);这一句呢?
The calling application must set the dwSize member of PROCESSENTRY32 to the size, in bytes, of the structure. Process32First changes dwSize to the number of bytes written to the structure. This will never be greater than the initial value of
dwSize, but it may be smaller. If the value is smaller, do not rely on the values of any members whose offsets are greater than this value.
StrPas(lppe.szExeFile)是不是改为string(lppe.szExeFile)