呵呵,楼主给分吧! var h: Hwnd; begin ShellExecute(handle,'open','Help.chm',nil,nil,SW_ShowNormal); h := FindWindow(nil,'帮助手册'); //帮助手册是窗口标题 SetWindowPos(h,HWND_TopMost,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE); end;
var h: Hwnd; i: Integer; begin h := 0; i := 0; ShellExecute(handle, 'open', 'English.chm', nil, nil, SW_ShowNormal); while (h = 0) and (i < 1000) do begin Sleep(10); h := FindWindow('HH Parent', nil); //在Win 2k Pro下,类名是'HH Parent'; Inc(i, 1); end; Self.Caption := CurrToStr(h); SetWindowPos(h, HWND_TopMost, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE); end; 根据 loveWife 的方法更改而来,经过测试存在一个问题: 如果打开多个,那么只有一个会置顶!
那必须有个检查程序调要完毕的过程阿,光ShellExecute好像不行吧。
Exe 不是偶写的,是自解压缩包,里面ppt和视频等乱七八糟东西。唉,麻烦
var
h: Hwnd;
begin
ShellExecute(handle,'open','Help.chm',nil,nil,SW_ShowNormal);
h := FindWindow(nil,'帮助手册'); //帮助手册是窗口标题
SetWindowPos(h,HWND_TopMost,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end;
h: Hwnd;
i: Integer;
begin
h := 0;
i := 0;
ShellExecute(handle, 'open', 'English.chm', nil, nil, SW_ShowNormal);
while (h = 0) and (i < 1000) do
begin
Sleep(10);
h := FindWindow('HH Parent', nil); //在Win 2k Pro下,类名是'HH Parent';
Inc(i, 1);
end;
Self.Caption := CurrToStr(h);
SetWindowPos(h, HWND_TopMost, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end;
根据 loveWife 的方法更改而来,经过测试存在一个问题:
如果打开多个,那么只有一个会置顶!