找回密码
 加入
搜索
查看: 3785|回复: 11

如何嵌入窗口到GUI里

[复制链接]
发表于 2008-5-16 21:23:01 | 显示全部楼层 |阅读模式
怎么样将一个窗口嵌入到我的GUI里?帮帮忙了!

[ 本帖最后由 zhangji2008_201 于 2008-6-4 22:36 编辑 ]
发表于 2008-5-16 21:51:27 | 显示全部楼层
……这个……使用子窗口?
发表于 2008-5-16 21:54:30 | 显示全部楼层
我想,lz是想实现PS之类软件那样,窗口中还有窗口?
发表于 2008-5-18 20:50:32 | 显示全部楼层
所谓的嵌入是固定在父窗口还是可以自由移动的?
发表于 2008-5-18 20:57:11 | 显示全部楼层
应该是可以动的吧。
发表于 2008-5-18 21:09:01 | 显示全部楼层
说错了。是固定在父窗口移动。还是怎么样的呢?理解能力有限。
发表于 2008-5-18 21:22:00 | 显示全部楼层
有这样的例子~我找找先!
发表于 2008-5-18 21:29:26 | 显示全部楼层
不知道这是不是你需要的样子?


#include <GuiConstants.au3>
#include <WindowsConstants.au3>

Global $gui[100000]
$x = 1

$Mother_GUI = GUICreate("内镶窗口,呵呵",-1,-1,-1,-1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Button_1 = GUICtrlCreateButton("新建窗口", 5, 5, 70, 20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button_2 = GUICtrlCreateButton("删掉窗口",5,30,70,20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Input_1 = GUICtrlCreateInput("1",5,60,70,20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
GUISetState(@SW_SHOW, $Mother_GUI)

$Main_GUI = GUICreate("",220,300,80,5,$WS_POPUPWINDOW)
GUISetBkColor(0xCCCCCC)
GUISetState(@SW_SHOW,$Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Main_GUI), "hwnd", WinGetHandle($Mother_GUI))
Makebox()
While 1
    setsize()
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then Exit
    if $msg = $Button_1 then Makebox()
    if $msg = $Button_2 then GUIDelete($Gui[GUICtrlRead($Input_1)])
    sleep(10)
WEnd

Func Makebox()
    if $x < 100000 then
        $gui[$x] = GUICreate("",200,90,100+$x*5,100+$x*5, $WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
        $label = GUICtrlCreateLabel("新建的窗口" & $x,0,0,200,20,-1,$GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont(-1,12,14,0,"Comic Sans MS")
        settopbarcolor()
        GUICtrlCreateEdit("",0,20,200,70,$WS_VSCROLL)
        GUISetState(@SW_SHOW,$gui[$x])
        DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($Gui[$x]), "hwnd", WinGetHandle($Main_GUI))
        $x = $x +1
    EndIf
EndFunc

Func settopbarcolor($s_control=-1)
    $Random = Random(1,6,1)
    if $Random = 1 Then
        GUICtrlSetBkColor($s_control,0x0000FF)
    elseif $Random = 2 Then
        GUICtrlSetBkColor($s_control,0x00FF00)
    elseif $Random = 3 then
        GUICtrlSetBkColor($s_control,0xFF0000)
    elseif $Random = 4 then
        GUICtrlSetBkColor($s_control,0x00FFFF)
    elseif $Random = 5 then
        GUICtrlSetBkColor($s_control,0xFF00FF)
    elseif $Random = 6 Then
        GUICtrlSetBkColor($s_control,0xFFFF00)
    EndIf
EndFunc

Func setsize()
    $Motherpos = WinGetPos($Mother_GUI)
    $Mainpos = WinGetPos($Main_GUI)
    if $Mainpos[2] <> $Motherpos[2]-98 or $Mainpos[3] <> $Motherpos[3]-40 then WinMove($Main_GUI,"",85,5,$Motherpos[2]-98,$Motherpos[3]-45)
EndFunc

Func SpecialEvents()
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            Exit
    EndSelect
EndFunc


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2008-5-19 13:15:27 | 显示全部楼层
谢谢楼上给的例子,基本上是我想要的,我想问下,如果我要将这个嵌入的窗口固定,怎么办,在我的程序中,我要嵌入的是一个放视频的窗口,播放时,需要点击父窗口才能看播放的画面,怎么解决?(做完后,我会将它上传供大家参考)
发表于 2008-5-21 08:40:01 | 显示全部楼层
这个  直接做到一起不行么  做成类似pplive ppstream那样的
 楼主| 发表于 2008-5-27 18:56:55 | 显示全部楼层
说来郁闷,我不知道是播放的插件有问题还是AU3的问题,做不成那个样。所以我只有用这种方法来解决。我做的正是一个点对点的网络电视。
发表于 2008-5-28 11:21:38 | 显示全部楼层
你插入的是有声视频不?是的话,插入时不能直接用gui的方式,会有点问题的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-24 03:24 , Processed in 0.076067 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表