Sign in to follow this  
Followers 0
sanhen

_WinAPI_SetParent

2 posts in this topic

#1 ·  Posted (edited)

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>

Global Const $GWL_STYLE = -16

$hGUI=GUICreate ("Test",800,600,-1,-1,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

$button = GUICtrlCreateButton ("Test ",700,500,70,30)
GUISetState( )

While 1
    $msg = GUIGetMsg()
    
Switch  $msg
    
    Case $GUI_EVENT_CLOSE
        Exit
    Case $button
        Run("notepad.exe")
         $hWndChild = WinGetHandle("classname=Notepad" , "") 
        _WinAPI_SetWindowLong($hWndChild, $GWL_STYLE ,BitOR($WS_VISIBLE, $WS_CLIPSIBLINGS))
        _WinAPI_SetParent($hWndChild,WinGetHandle($hGUI))
        
 
EndSwitch

WEnd

Did not respond to code.why?

Edited by sanhen

Share this post


Link to post
Share on other sites



Try

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
Opt("WinTitleMatchMode", 2)
Global Const $GWL_STYLE = -16

$hGUI = GUICreate("Test", 800, 600, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

$button = GUICtrlCreateButton("Test ", 700, 500, 70, 30)
GUISetState()

While 1
    $msg = GUIGetMsg()

    Switch $msg

        Case $GUI_EVENT_CLOSE
            Exit
        Case $button
            Run("notepad.exe")
            Sleep(1000)
            $hWndChild = WinGetHandle("Notepad")
            _WinAPI_SetWindowLong($hWndChild, $GWL_STYLE, BitOR($WS_VISIBLE, $WS_CLIPSIBLINGS))
            _WinAPI_SetParent($hWndChild, WinGetHandle($hGUI));needs redraw to refresh menu items for me


    EndSwitch

WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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