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 的方法更改而来,经过测试存在一个问题:
如果打开多个,那么只有一个会置顶!
呵呵,楼主给分吧!
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;