GUICtrlSetResizing是针对控件的, 在你的代码中$Obj不属于控件吧,$GUIActiveX是一个ActiveX 控件.
换个思路吧:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ToolbarConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIEx.au3>
Global $Form2, $GUIActiveX, $obj
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Button1 = GUICtrlCreateButton("Button1", 0, 32, 89, 65)
$Button2 = GUICtrlCreateButton("Button2", 0, 112, 89, 65)
$Button3 = GUICtrlCreateButton("Button3", 0, 200, 89, 65)
$Button4 = GUICtrlCreateButton("Button4", 0, 296, 89, 65)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
;~ MsgBox(0,"","1")
creat()
Case $Button2
creat()
Case $Button3
MsgBox(0, "", "3")
Case $Button4
MsgBox(0, "", "4")
EndSwitch
WEnd
Func creat()
$Form2 = GUICreate('Flash播放器', 300, 200, -1, -1, $WS_OVERLAPPEDWINDOW)
$obj = ObjCreate('ShockwaveFlash.ShockwaveFlash.9')
If @error Then Exit
$GUIActiveX = GUICtrlCreateObj($obj, 300, 200, -1, -1)
$obj.Movie = @ScriptDir & '\shuizhu.swf'
$obj.ScaleMode = 0
GUISetState()
resize()
GUIRegisterMsg($WM_SIZE, "resize")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $Form2)
GUIDelete($Form2)
ExitLoop
Case $GUI_EVENT_MAXIMIZE
GUICtrlSetPos($obj, 0, 0, 1024, 768) ;最大化这里不起作用
MsgBox(0, "", "00")
EndSwitch
WEnd
EndFunc ;==>creat
Func resize()
Local $aPos = WinGetPos($Form2)
GUICtrlDelete($GUIActiveX)
$obj = ObjCreate('ShockwaveFlash.ShockwaveFlash.9')
If @error Then Exit
$GUIActiveX = GUICtrlCreateObj($obj, 0, 0, $aPos[2], $aPos[3])
$obj.Movie = @ScriptDir & '\shuizhu.swf'
$obj.ScaleMode = 0
EndFunc ;==>resize
|