Sign in to follow this  
Followers 0
HiNoTora

Another Gui In my Gui

2 posts in this topic

#1 ·  Posted (edited)

I have script like this (copied from forum ) e.e

$hGui1 = GUICreate('Just a Way To End SCript', 1100,800)
GUISetState()

Run("notepad.exe")
WinWait("Untitled","",10)
$hw1 = WinGetHandle("Untitled")
WinMove($hw1, "", 0, 0, 400, 300);the position of notepad will be the relative positions in the our gui
Sleep(100)
$origParent = DllCall("user32.dll", "int", "SetParent", "hwnd", $hw1, "hwnd",$hGui1);  WinGetHandle("Program Manager"))

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then
       ;set Notepad back To Original parent
        DllCall("user32.dll", "int", "SetParent", "hwnd", $hw1, "hwnd", $origParent[0])
        Exit
    EndIf
    
WEnd

Now, there notepad.exe what opens in my GUI.

Is there a way to make in unmovable and remove that minimize, maximize and close buttons from notepad window and if main GUI is closed then Notepad will close to. And how to set notepad window size to be something as i want x: y:

Edited by HiNoTora

Share this post


Link to post
Share on other sites

I have script like this (copied from forum ) e.e

Ewwwwwwwwwwwwww, not even using autoit winapi func names.

;by FireFox, 2014
 
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
 
Run("notepad.exe")
 
Local $hNotepad = WinWait("[CLASS:Notepad]", "", 10)
If $hNotepad = 0 Then Exit 1
 
Local $aOriPos = WinGetPos($hNotepad)
 
Local $hGUI = GUICreate("MyGUI", Default, Default, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")
GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE")
GUISetState(@SW_SHOW, $hGUI)
 
Local $hOriParent = _WinAPI_SetParent($hNotepad, $hGUI)
 
Local $iStyle = _WinAPI_GetWindowLong($hNotepad, $GWL_STYLE)
_WinAPI_SetWindowLong($hNotepad, $GWL_STYLE, BitXOR($iStyle, $WS_OVERLAPPEDWINDOW))
 
_WinAPI_SetWindowPos($hNotepad, 0, 0, 0, 400, 400, BitOR($SWP_FRAMECHANGED, $SWP_NOACTIVATE, $SWP_NOZORDER))
 
Local $iMsg = 0
 
While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
 
;restore the notepad window
_WinAPI_SetParent($hNotepad, $hOriParent)
 
_WinAPI_SetWindowLong($hNotepad, $GWL_STYLE, $iStyle)
_WinAPI_SetWindowPos($hNotepad, 0, $aOriPos[0], $aOriPos[1], $aOriPos[2], $aOriPos[3], BitOR($SWP_FRAMECHANGED, $SWP_NOACTIVATE, $SWP_NOZORDER))
 
GUIDelete($hGUI)
 
;when the notepad window is closed the gui is activated, so check if this one has been closed
Func WM_ACTIVATE($hWnd, $iMsg, $wParam, $lParam)
    If Number($wParam) = 1 And WinExists($hNotepad) = 0 Then
        GUIDelete($hGUI)
        Exit
    EndIf
 
    Return $GUI_RUNDEFMSG
EndFunc
 
;otherwise the menu is not redrawn
Func WM_EXITSIZEMOVE($hWnd, $iMsg, $wParam, $lParam)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INVALIDATE)
 
    Return $GUI_RUNDEFMSG
EndFunc
 
;resize the notepad window according to the gui
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $iWidth = BitAND($lParam, 0xFFFF)
    Local $iHeight = BitShift($lParam, 16)
 
    WinMove($hNotepad, "", 0, 0, $iWidth, $iHeight)
 
    Return $GUI_RUNDEFMSG
EndFunc

 

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0