Sign in to follow this  
Followers 0
Battery

Images Help?

7 posts in this topic

#1 ·  Posted (edited)

Can someone give me an example of how I do this?

Create GUI - 400x600

Create a button anywhere in the GUI

Load an image file (400x600) and put it in the GUI

Sleep 10 seconds

Replace the old image with a new image (400x600) and put it in the GUI

-The button has to be always on top of course, the image will be the background.

Thanks guys, I hope it's not so complicated.

Edited by Battery

Share this post


Link to post
Share on other sites



Sorry but I couldn't find what I needed, can you give me an example?

Share this post


Link to post
Share on other sites

Can someone give me an example of what I need? I bet it's not so complicated.

Share this post


Link to post
Share on other sites

Can someone give me an example of what I need? I bet it's not so complicated.

Yes. It's really trivial but you must do your homework yourself.

We can help you but we will not do whole your work.

We are not slaves of lazy people here!

Open up Autoit's helpfile and read all basics from there.

Share this post


Link to post
Share on other sites

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

Global Const $STM_SETIMAGE = 0x0172
Global Const $iWidth = 200, $iHeight = 200
Global Const $iImgWidth = 200, $iImgHeight = 200
Global $aImages[100] = [0]

_Main()

Func _Main()
    Local $hGUI, $hExplorer, $hImageList, $hBmp, $Btn, $Pic

    $hExplorer = _WinAPI_LoadLibrary("explorer.exe")
    For $i = 140 To 190
        $hBmp = _WinAPI_LoadImage($hExplorer, $i, $IMAGE_BITMAP, $iImgWidth, $iImgHeight, 0)
        If $hBmp Then
            $aImages[0] += 1
            $aImages[$aImages[0]] = $hBmp
        EndIf
    Next
    ReDim $aImages[$aImages[0]+1]
    _WinAPI_FreeLibrary($hExplorer)

    $hGUI = GUICreate("Test", $iWidth, $iHeight)
    $Pic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight)
    GUICtrlSetState($Pic, $GUI_DISABLE)

    $Btn = GUICtrlCreateButton("Btn", $iWidth/2-35, $iHeight/2-12, 70, 23)

    _SetPicRandomImage($Pic)
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $Btn
                _SetPicRandomImage($Pic)
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    For $i = 1 To $aImages[0]
        _WinAPI_DeleteObject($aImages[$i])
    Next
    GUIDelete()
EndFunc

Func _SetPicRandomImage($Ctrl)
    GUICtrlSendMsg($Ctrl, $STM_SETIMAGE, $IMAGE_BITMAP, 0)
    GUICtrlSendMsg($Ctrl, $STM_SETIMAGE, $IMAGE_BITMAP, $aImages[Random(1, $aImages[0], 1)])
EndFunc

Share this post


Link to post
Share on other sites

Can someone give me an example of what I need? I bet it's not so complicated.

Now that you have an example, could you please stop bumping the thread. Impatience will get you no place around here.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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