我在公司的软件里的一个地方调用了windows的计算器。我碰到两个问题,不知道该找什么函数解决。
第一。打开时计算器的位置总是不能固定,怎么样固定在屏幕中间或指定位置。第二。关闭程序不能一起关闭计算器。怎么解决?
大家帮忙啊>。>急
第一。打开时计算器的位置总是不能固定,怎么样固定在屏幕中间或指定位置。第二。关闭程序不能一起关闭计算器。怎么解决?
大家帮忙啊>。>急
解决方案 »
- 有没有哪个报表控件比较适合用于图片打印,急~
- 来讨论sleep()这个函数
- 大家好
- label13.caption := ReverseString('abc,abc');为什么不对?
- 释放了没?
- 如何获得图像的宽,高?
- 关于DLL文件的调用
- 提供Delphi控件和电子书籍下载(还有C/C++)的网址。杜绝垃圾。
- 如何判断DBImage.pictrue 是不是为空
- 我想将数据表中的数据导入到EXCEL表格中,采用以下方式却不能实现,哪位朋友帮忙指导一下!
- 如何将delphi6中的日期时间转化为access97支持的格式?急切等待!!!
- 怎么写存储过程参数才能使Ado参数输送类型为pdOutput而不为pdInputOutput
第二个问题,在你关闭程序的时候,取一下当前计算机的进程列表,然后关闭计数器进程,然后关闭程序
关闭进程的程序,你可以参考一下下面的程序还有,你的分太少了
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, TLHelp32, Controls, Forms, Dialogs,
StdCtrls;type
TProcessInfo = record
ExeFile: string;
ProcessId: DWORD;
end;
ProcessInfo = ^TProcessInfo; TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
procedure ProcessList(var pList: TList);
procedure My_RunFileScan(ListboxRunFile: TListBox);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
Current: TList;
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.ProcessList(var pList: TList);
var
p: ProcessInfo;
ok: Bool;
ProcessListHandle: THandle;
ProcessStruct: TProcessEntry32;
begin
PList := TList.Create;
PList.Clear;
ProcessListHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
ProcessStruct.dwSize := Sizeof(ProcessStruct);
ok := Process32First(ProcessListHandle, ProcessStruct);
while Integer(ok) <> 0 do
begin
new(p);
p.ExeFile := ProcessStruct.szExeFile;
p.ProcessID := ProcessStruct.th32ProcessID;
PList.Add(p);
ok := Process32Next(ProcessListHandle, ProcessStruct);
end;
end;procedure TForm1.My_RunFileScan(ListboxRunFile: TListBox);
var
i: Integer;
p: PRocessInfo;
begin
current := TList.Create;
Current.Clear;
ListboxRunFile.Clear;
ProcessList(Current);
for i := 0 to Current.Count - 1 do
begin
new(p);
p := Current.Items[i];
ListboxRunFile.Items.Add(p.ExeFile);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
h: THandle;
a: DWORD;
p: PRocessInfo;
begin
if ListBox1.ItemIndex >= 0 then
begin
p := Current.Items[ListBox1.ItemIndex];
h := openProcess(Process_All_Access, true, p.ProcessID);
GetExitCodeProcess(h, a); if Integer(TerminateProcess(h, a)) <> 0 then
begin
My_RunFileScan(ListBox1);
end;
end
else
Application.MessageBox('ÇëÏÈÑ¡ÔñÒ»¸ö½ø³Ì!', 'ºÚ¶´', MB_ICONERROR + MB_OK);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
My_RunFileScan(ListBox1);
end;end.