Jump to content

[Solved]_WinApi_SetParent acting weird?


Recommended Posts

#include<WinApi.au3>
$MG=GUICreate('Main',1024,768,-1,-1)
GUISetState()
$CG=GUICreate('Child',200,400,100,100)
GUISetState()
_WinAPI_SetParent($CG,$MG)
While GUIGetMsg()<>-3
WEndoÝ÷ ÚØ^{¦¦W°¢¹vÚ[£î¶ïËZÜ(mrZ,^jb*.rXíç%¢ÇºÛhíêZ­éíwÚrÛaz«z{gz÷«ëwöÇèrëwbëaz·¢±§!WpwhÂ)⵩ò×jÇ×èºwm槳«jëh×6#include<WinApi.au3>
#include<WindowsConstants.au3>
$MG=GUICreate('Main',1024,768,-1,-1)
GUISetState()
$CG=GUICreate('Child',200,400,100,100,BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_CHILD, $WS_SYSMENU,$WS_OVERLAPPEDWINDOW),$WS_EX_TOOLWINDOW,$MG)
GUISetState()
_WinAPI_SetParent($CG,$MG)
While GUIGetMsg()<>-3
WEnd

combining the $WS_CHILD with the $WS_CAPTION seemed to do the work :D

Edited by TheMadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

The child window has to be set as a child window, this can be done out the GUICreate function as well by looking at GUISetStyle. If you read about it on the MSDN page if you look in the help file under _WINAPI_SetParent

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

i tried it with child windows too.... same problem the parent window can't get focus unless it has no child windows or if all child windows are minimized

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

Your first example didn't work for me on XP either...

;#include<WinApi.au3>
$MG=GUICreate('Main',1024,768,-1,-1)
GUISetState()
$CG=GUICreate('Child',200,400,100,100,Default,Default,$MG)
GUISetState()
;_WinAPI_SetParent($CG,$MG)
While GUIGetMsg()<>-3
WEnd
Edited by KaFu
Link to comment
Share on other sites

Your first example didn't work for me on XP either...

;#include<WinApi.au3>
$MG=GUICreate('Main',1024,768,-1,-1)
GUISetState()
$CG=GUICreate('Child',200,400,100,100,Default,Default,$MG)
GUISetState()
;_WinAPI_SetParent($CG,$MG)
While GUIGetMsg()<>-3
WEnd
your example does not make the child go inside the parent window.....

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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...