Jump to content

several questioni about child window and some functions


Recommended Posts

I could have the following results by this script, 4 different window inside a MainGUI

#include
#include
#include
#include

WinWait("Google")
$hWnd1 = WinGetHandle("Google - Mozilla Firefox")
_GUICtrlMenu_SetMenu($hWnd1,1)

WinWait("Windows Live Messenger")
$hWnd2 = WinGetHandle("Windows Live Messenger")
_GUICtrlMenu_SetMenu($hWnd2,1)


;; WinWait("WinEdt 6.0")
$hWnd3 = 0x00C0668
_GUICtrlMenu_SetMenu($hWnd3,1)

WinWait("[CLASS:SUMATRA_PDF_FRAME]")
$hWnd4 = WinGetHandle("[CLASS:SUMATRA_PDF_FRAME]")
_GUICtrlMenu_SetMenu($hWnd4,1)

$MainGUI = GUICreate("Pdf Test", @DesktopWidth*3/5, @DesktopHeight*9/10, -1, -1, BitOr($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN,$WS_SIZEBOX))
GUISetState()
$WinSize = WinGetClientSize($MainGUI)

_WinAPI_SetParent($hWnd1, $MainGUI)
_WinAPI_SetWindowPos($hWnd1,$HWND_TOP,0,0,$WinSize[0]/2,$WinSize[1]/2,$SWP_SHOWWINDOW)
_WinAPI_SetParent($hWnd2, $MainGUI)
_WinAPI_SetWindowPos($hWnd2,$HWND_TOP,$WinSize[0]/2,0,$WinSize[0]/2,$WinSize[1]/2,$SWP_SHOWWINDOW)

_WinAPI_SetParent($hWnd3, $MainGUI)
_WinAPI_SetWindowPos($hWnd3,$HWND_TOP,0,$WinSize[0]/2,$WinSize[0]/2,$WinSize[1]/2,$SWP_SHOWWINDOW)

_WinAPI_SetParent($hWnd4, $MainGUI)
_WinAPI_SetWindowPos($hWnd4,$HWND_TOP,$WinSize[0]/2,$WinSize[0]/2,$WinSize[0]/2,$WinSize[1]/2,$SWP_SHOWWINDOW)

While 1
Sleep(100)
WEnd

Posted Image

But I found something bother me:

1) WinGetHandle doesn't 100% give the correct result. For an Latex editor "WinEdt 6", the result is different from AutoIt Window Info.exe.

2) But for this WinEdt 6, WinActive(WinGetHandle("WinEdt 6.0")) works, but not $hwnd = (the handle got from AutoIt Window Info.exe), WinActive($hwnd) doesn't.

3) Furthermore, in the above script, I need to use $hWnd3 = 0x00C0668, which is the one given by AutoIt Window Info.exe. If $hWnd3 = WinGetHandle("WinEdt 6.0"), then this script doesn't work for WinEdt 6.

4) Suppose a window inside the MainGUI is active, then use another scirpt to test if this window is active by WinActive, the result is False, meaning that the widnow is non-active. I think the reason is that the system thinks the active window ins MainGUI, not the child window. In this way, is there a way to detect which child window is active?

5) Furthermore, WinEdt can has only one window a time. But if one WinEdt Window is inside the MainGUI, then I can open another WinEdt window ( outside the MainGUI). So It seems that if a window is in a parent window, then, it is not a window for the system.

6) The ControlClick doesn't work for child window anymore, even use ClassNN (at least, it doesn't work for WinEdt 6.0. ) Is there a way to make ControlClick work in this case?

7) It seems that doing this way, the programs become slower. For example, when I type my .tex file, it's slower than I type in normal usage of WinEdt 6. Anyway to avoid this?

Edited by hodgestructure
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...