Sign in to follow this  
Followers 0
John117

How to add pic to gui -simple ;)

6 posts in this topic

#1 ·  Posted (edited)

hey I need to add a picture to my gui. It is hosted by a website. -sorry I can't download it because the pic changes and I always need the most recient version on the fly.

for this example I'm just gonna use my autoit it pic. :) If you can help, please do! Thanks!

#include <GUIConstants.au3>
$GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW)

$GUI_Pic_Map = GUICtrlCreatePic('http://www.autoitscript.com/forum/uploads/profile/photo-24404.jpg', 0, 0, 600, 600)

GUISetState(@SW_SHOW, $GUI);Show GUI

$GUI_Button_Exit = GUICtrlCreateButton("Exit", 925, 10, 65, 20)

; ============================================================================
; Main Loop
; ============================================================================
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_Button_Exit
            Exit
    EndSelect
WEnd

Do I have to set this up as an embedded webpage or can I just add the pic somehow?

Edit:

Perhaps I could dl the pic with part of the script and then load it. I would really like to avoid having to embed it.

Edited by Hatcheda

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Like this?

#include <GUIConstants.au3>
$GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW)
InetGet( "http://www.autoitscript.com/forum/uploads/profile/photo-24404.jpg", @TempDir & "\guipic.jpg", 1 )
$GUI_Pic_Map = GUICtrlCreatePic(@TempDir & "\guipic.jpg", 0, 0, 600, 600)

GUISetState(@SW_SHOW, $GUI);Show GUI

$GUI_Button_Exit = GUICtrlCreateButton("Exit", 925, 10, 65, 20)

; ============================================================================
; Main Loop
; ============================================================================
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_Button_Exit
            Exit
    EndSelect
Wend

EDIT: missing Wend

Edited by danwilli

Share this post


Link to post
Share on other sites

And yes, you could also do the embedded IE like this:

#include <GUIConstants.au3>
#include <IE.au3>
$GUI = GUICreate("", 1024, 600, Default, Default, $WS_POPUPWINDOW)
$oIE = _IECreateEmbedded()
$browser = GUICtrlCreateObj($oIE, 0, 0, 600, 600)
_IENavigate( $oIE, "about:blank" )
$shtml = ""
$shtml &= "<HTML><HEAD></HEAD>" & @CR
$shtml &= '<BODY><IMG src="//www.autoitscript.com/forum/uploads/profile/photo-24404.jpg" alt="alternative text" width="550" height="550"></BODY></HTML>'
$IEdoc = _IEDocWriteHTML($oIE, $shtml )

GUISetState(@SW_SHOW, $GUI);Show GUI

$GUI_Button_Exit = GUICtrlCreateButton("Exit", 925, 10, 65, 20)

; ============================================================================
; Main Loop
; ============================================================================
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_Button_Exit
            Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

Like this?

'InetGet' learn something new everyday! :) exactly! :blink:

Thanks, will be very useful in the future! :P

Share this post


Link to post
Share on other sites

btw, what does you pic mean?

Share this post


Link to post
Share on other sites

My pic is from a punk band called "Crass". They are a peace through anarchy type punk band from the late 70's.

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