发信人: lofe ()感激生活(), 信区: BorlandDev
标 题: .检查应用是否已经运行
发信站: 哈工大紫丁香 (Mon Sep 4 16:31:13 2000), 转信
Create a unit called PrevInst and add it to your uses clause.
Here's the code:
unit PrevInst;
interface
uses
WinTypes, WinProcs, SysUtils;
type
PHWND = ^HWND;
function EnumFunc(Wnd:HWND; TargetWindow:PHWND): bool; export;
procedure GotoPreviousInstance;
implementation
function EnumFunc(Wnd:HWND; TargetWindow:PHWND): bool;
var
ClassName : array[0..30] of char;
begin
Result := true;
if GetWindowWord(Wnd,GWW_HINSTANCE) = hPrevInst then
begin
GetClassName(Wnd,ClassName,30);
if StrIComp(ClassName,'TApplication') = 0 then
begin
TargetWindow^ := Wnd;
Result := false;
end;
end;
end;
procedure GotoPreviousInstance;
var
PrevInstWnd : HWND;
begin
PrevInstWnd := 0;
EnumWindows(@EnumFunc,longint(@PrevInstWnd));
if PrevInstWnd <> 0 then
if IsIconic(PrevInstWnd) then
Sho
--
※ 修改:.haojs 于 Sep 4 16:11:11 修改本文.[FROM: bbs.hit.edu.cn]
--
※ 转寄:.武汉白云黄鹤站 bbs.whnet.edu.cn.[FROM: bbs.hit.edu.cn]
--
☆ 来源:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: haojs.bbs@bbs.whnet.]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:10.955毫秒