开发者

Bring opera window to front!

开发者 https://www.devze.com 2022-12-28 06:36 出处:网络
Could you please help me to figure out how to bring Opera\'s window to front, using class name?! I use the following procedure to bringother applications to front and it works fine. I need to use only

Could you please help me to figure out how to bring Opera's window to front, using class name?! I use the following procedure to bring other applications to front and it works fine. I need to use only a class name and not window's caption. If I use window caption instead, the procedure works. Her开发者_运维问答e is the procedure:

procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall;
external user32 Name 'SwitchToThisWindow';

procedure Opera;
var
Wnd:HWND;
begin
Wnd:= FindWindow(PChar('OpWindow'),nil);
 if (Wnd <> 0) then SwitchToThisWindow(Wnd, True) ;
////////////////////////////////////////////////////


Looking at Opera 10.50, there is more than one window with the OpWindow class, the other windows seem to be hidden so you should run FindWindow(Ex) in a loop or use EnumWindows and search until you find a visible OpWindow window. (This will probably cause problems when Opera is in the tray)

So, without actually testing, I'm guessing you would have to look for a visible OpWindow window, or a OpWindow window with a non empty title (Or maybe looking for a OpWindow that has a specific style (WS_OVERLAPPEDWINDOW or WS_EX_WINDOWEDGE))

It should also be noted that all of this is internal opera details and could change in the next version etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号