Jump to content

2 New ObjCreate Funcs


AlmarM
 Share

Recommended Posts

Hi,

This time I made this 2 UDF's.

  • _GUICtrlCreateFlashObj
  • _GUICtrlCreateInternetObj
I'm not sure if this is already made?

I know it's simple. But you need to start somewhere :mellow:

Example + UDF's

Example1()

Func Example1()
    $GUI = GUICreate("Example 1", 620, 220, -1, -1)
    _GUICtrlCreateFlashObj(10, 10, 600, 200, "http://www.play4traffic.com/game.swf")

    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            GUIDelete($GUI)
            Example2()
        EndSelect
    WEnd
EndFunc

Func Example2()
    $GUI = GUICreate("Example 2", 500, 500, -1, -1)
    _GUICtrlCreateInternetObj(10, 10, 480, 450)
    $Input = GUICtrlCreateInput("http://", 10, 470, 150, 20)
    $Button = GUICtrlCreateButton("Navigate!", 170, 470, 100, 20)
    
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $Button
            $Read = GUICtrlRead($Input)
            $oShell.Navigate($Read)
        EndSelect
    WEnd
EndFunc

Func _GUICtrlCreateFlashObj($cLeft, $cTop, $cHeight, $cWidth, $iMovie)
    Global $oGame
    
    $oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
    GUICtrlCreateObj($oGame, $cLeft, $cTop, $cHeight, $cWidth)
    
    With $oGame
        .Movie = $iMovie
        .ScaleMode = 2
        .wmode = "Opaque"
        .Loop = True
        .bgcolor = "#000000"
    EndWith
EndFunc

Func _GUICtrlCreateInternetObj($cLeft, $cTop, $cHeight, $cWidth)
    Global $oShell
    
    $oShell = ObjCreate("Shell.Explorer.1")
    GUICtrlCreateObj($oShell, $cLeft, $cTop, $cHeight, $cWidth)
EndFunc

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Link to comment
Share on other sites

Prety neat. Has been done before but this is very simple and easy. I would recommend not using Global inside of a Function. Use Local instead.

Ha! Listen.

If I use 'Local' I cant use things like '.Navigate' or for the Flash '.SetVariable'.

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Ha! Listen.

If I use 'Local' I cant use things like '.Navigate' or for the Flash '.SetVariable'.

AlmarM

Ha. I guess I don't understand?

Example1()

Func Example1()
    $GUI = GUICreate("Example 1", 620, 220, -1, -1, 0x00C40000)
    _GUICtrlCreateFlashObj(10, 10, 600, 200, "http://www.play4traffic.com/game.swf")

    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            GUIDelete($GUI)
            Exit
        EndSelect
    WEnd
EndFunc

Func _GUICtrlCreateFlashObj($cLeft, $cTop, $cHeight, $cWidth, $iMovie)
    Local $oGame
   
    $oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
    GUICtrlCreateObj($oGame, $cLeft, $cTop, $cHeight, $cWidth)
   
    With $oGame
        .Movie = $iMovie
        .ScaleMode = 2
        .wmode = "Opaque"
        .Loop = True
        .bgcolor = "#000000"
    EndWith
EndFuncoÝ÷ Ùçb´èH±çÁ«'ßÛe¢"­¶y°k¢Ì­û§pí«jDz¢ç(ºWljeÊ·­º¹íêç-jëh×6Example1()

Func Example1()
    $GUI = GUICreate("Example 1", 620, 220, -1, -1)
    $oGame = _GUICtrlCreateFlashObj(10, 10, 600, 200, "http://www.play4traffic.com/game.swf")

    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            GUIDelete($GUI)
            Example2()
        EndSelect
    WEnd
EndFunc

Func Example2()
    $GUI = GUICreate("Example 2", 500, 500, -1, -1)
    $oShell = _GUICtrlCreateInternetObj(10, 10, 480, 450)
    $Input = GUICtrlCreateInput("http://", 10, 470, 150, 20)
    $Button = GUICtrlCreateButton("Navigate!", 170, 470, 100, 20)
   
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $Button
            $Read = GUICtrlRead($Input)
            $oShell.Navigate($Read)
        EndSelect
    WEnd
EndFunc

Func _GUICtrlCreateFlashObj($cLeft, $cTop, $cHeight, $cWidth, $iMovie)
    Local $oGame
   
    $oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
    GUICtrlCreateObj($oGame, $cLeft, $cTop, $cHeight, $cWidth)
   
    With $oGame
        .Movie = $iMovie
        .ScaleMode = 2
        .wmode = "Opaque"
        .Loop = True
        .bgcolor = "#000000"
    EndWith
    Return $oGame
EndFunc

Func _GUICtrlCreateInternetObj($cLeft, $cTop, $cHeight, $cWidth)
    Local $oShell
   
    $oShell = ObjCreate("Shell.Explorer.1")
    GUICtrlCreateObj($oShell, $cLeft, $cTop, $cHeight, $cWidth)
    Return $oShell
EndFunc
Edited by spudw2k
Link to comment
Share on other sites

Ha. I guess I don't understand?

Example1()

Func Example1()
    $GUI = GUICreate("Example 1", 620, 220, -1, -1, 0x00C40000)
    _GUICtrlCreateFlashObj(10, 10, 600, 200, "http://www.play4traffic.com/game.swf")

    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            GUIDelete($GUI)
            Exit
        EndSelect
    WEnd
EndFunc

Func _GUICtrlCreateFlashObj($cLeft, $cTop, $cHeight, $cWidth, $iMovie)
    Local $oGame
   
    $oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
    GUICtrlCreateObj($oGame, $cLeft, $cTop, $cHeight, $cWidth)
   
    With $oGame
        .Movie = $iMovie
        .ScaleMode = 2
        .wmode = "Opaque"
        .Loop = True
        .bgcolor = "#000000"
    EndWith
EndFuncoÝ÷ Ùçb´èH±çÁ«'ßÛe¢"­¶y°k¢Ì­û§pí«jDz¢ç(ºWljeÊ·­º¹íêç-jëh×6Example1()

Func Example1()
    $GUI = GUICreate("Example 1", 620, 220, -1, -1)
    $oGame = _GUICtrlCreateFlashObj(10, 10, 600, 200, "http://www.play4traffic.com/game.swf")

    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            GUIDelete($GUI)
            Example2()
        EndSelect
    WEnd
EndFunc

Func Example2()
    $GUI = GUICreate("Example 2", 500, 500, -1, -1)
    $oShell = _GUICtrlCreateInternetObj(10, 10, 480, 450)
    $Input = GUICtrlCreateInput("http://", 10, 470, 150, 20)
    $Button = GUICtrlCreateButton("Navigate!", 170, 470, 100, 20)
   
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $Button
            $Read = GUICtrlRead($Input)
            $oShell.Navigate($Read)
        EndSelect
    WEnd
EndFunc

Func _GUICtrlCreateFlashObj($cLeft, $cTop, $cHeight, $cWidth, $iMovie)
    Local $oGame
   
    $oGame = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
    GUICtrlCreateObj($oGame, $cLeft, $cTop, $cHeight, $cWidth)
   
    With $oGame
        .Movie = $iMovie
        .ScaleMode = 2
        .wmode = "Opaque"
        .Loop = True
        .bgcolor = "#000000"
    EndWith
    Return $oGame
EndFunc

Func _GUICtrlCreateInternetObj($cLeft, $cTop, $cHeight, $cWidth)
    Local $oShell
   
    $oShell = ObjCreate("Shell.Explorer.1")
    GUICtrlCreateObj($oShell, $cLeft, $cTop, $cHeight, $cWidth)
    Return $oShell
EndFunc
Arg! Ofcourse!

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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