Jump to content
Sign in to follow this  
mud409

changing an image with guictrlsetimage not working

Recommended Posts

mud409

I have this script setup to change the image on up key or down key, problem is it wont work...

Everything works on the script except the part where up and down keys change the image. what am I missing?

#include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3> 
    #include <ButtonConstants.au3>
    #include <Misc.au3>
    #include <File.au3>
    ProcessClose("tray.exe")
    ProcessClose("ki1.exe")
    ProcessClose("ki2.exe")

    
    Opt("TrayIconHide", 1)
    




HotKeySet("{F10}", "ReleaseMouse")
$MousePos = MouseGetPos()
_MouseTrap(@DesktopWidth, @DesktopHeight, @DesktopWidth, @DesktopHeight)
        thatish()
        
        Func thatish()  
        Local $msg





      ;SoundPlay ( @scriptdir & "\sounds\welcome2kc2.wav"  )
       GUICreate("KI FE", @DesktopWidth, @DesktopHeight, "", "", $WS_POPUP, $WS_EX_TOPMOST)
        GUISetBkColor (0x000000)
        $pic = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
        GUICtrlCreatePic(@scriptdir & "\images\kc.bmp", 0, 88, 340, 73)
        
        $pic2 = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
        GUICtrlCreatePic(@scriptdir & "\images\ki1d.gif", 0, 0, 340, 97)
        
    
        $pic3 = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
        GUICtrlCreatePic(@scriptdir & "\images\ki2d.gif", 0, 155, 340, 97)
        
        
        
    $hotkeyup = HotKeySet("{UP}", "upems")
$hotkeydown = HotKeySet("{Down}", "downems")
        
    
       
        GUISetState()

        While 1
            
            Sleep(100)
    
        WEnd

EndFunc

Func upems()

HotKeySet("{UP}")
HotKeySet("{DOWN}", "downems")
        HotKeySet("i", "loadems1")
    HotKeySet("o", "loadems1")
    HotKeySet("u", "loadems1")
    HotKeySet("k", "loadems1")
    HotKeySet("l", "loadems1")
    HotKeySet("j", "loadems1")
    HotKeySet("y", "loadems1")
    HotKeySet("{ENTER}", "loadems1")
    ish(@scriptdir & "\images\ki1.gif", @scriptdir & "\images\ki2d.gif")
    EndFunc

Func downems()
HotKeySet("{UP}", "upems")
HotKeySet("{DOWN}")
    HotKeySet("i", "loadems2")
    HotKeySet("o", "loadems2")
    HotKeySet("u", "loadems2")
    HotKeySet("k", "loadems2")
    HotKeySet("l", "loadems2")
    HotKeySet("j", "loadems2")
    HotKeySet("y", "loadems2")
    HotKeySet("{ENTER}", "loadems2")
ish(@scriptdir & "\images\ki1d.gif", @scriptdir & "\images\ki2.gif")
EndFunc



Func ish($ki1bmp, $ki2bmp)
        
    
        Guictrlsetimage ($pic2, $ki1bmp)
        Guictrlsetimage ($pic3, $ki2bmp)
    endfunc
    
    func loadems1()
        HotKeySet("{Enter}")
        HotKeySet("i")
        HotKeySet("o")
    HotKeySet("u")
    HotKeySet("k")
    HotKeySet("l")
    HotKeySet("j")
    HotKeySet("y")
            SoundPlay ( @scriptdir & "\sounds\killerinstinct.wav", 1 )
            HotKeySet("{UP}")
HotKeySet("{DOWN}")
    
    Opt('WinWaitDelay', 10)
    Run (@scriptdir & "\u64\ki1.exe", "", @SW_HIDE)
    WinWaitActive ("U64Emu - V3.05")
    WinSetState ( "U64Emu - V3.05", "", @SW_HIDE )
    Opt('WinWaitDelay', 250)
        
ControlFocus ("U64Emu - V3.05", "", "Button2")
    ControlClick("U64Emu - V3.05", "", "Button2", "left", 1)
    WinSetState ( "KI FE", "", @SW_HIDE )
            Opt('WinWaitDelay', 10)
    WinWaitActive ("Loading")

    WinSetState ( "Loading", "", @SW_HIDE )
    Opt('WinWaitDelay', 250)
    Run("tray.exe")
endfunc

    func loadems2()
        HotKeySet("{Enter}")
        HotKeySet("i")
        HotKeySet("o")
    HotKeySet("u")
    HotKeySet("k")
    HotKeySet("l")
    HotKeySet("j")
    HotKeySet("y")
            SoundPlay ( @scriptdir & "\sounds\killerinstinct2.wav", 1 )
            HotKeySet("{UP}")
HotKeySet("{DOWN}")
    
    Opt('WinWaitDelay', 10)
    Run (@scriptdir & "\u64\ki2.exe", "", @SW_HIDE)
    WinWaitActive ("U64Emu - V3.05")
    WinSetState ( "U64Emu - V3.05", "", @SW_HIDE )
    Opt('WinWaitDelay', 250)
        
ControlFocus ("U64Emu - V3.05", "", "Button2")
    ControlClick("U64Emu - V3.05", "", "Button2", "left", 1)
    WinSetState ( "KI FE", "", @SW_HIDE )
            Opt('WinWaitDelay', 10)
    WinWaitActive ("Loading")
    WinSetState ( "Loading", "", @SW_HIDE )
    Opt('WinWaitDelay', 250)
    Run("tray.exe")

endfunc 

Func ReleaseMouse()
    Run("explorer.exe", "c:\windows")
    Exit
EndFunc

Share this post


Link to post
Share on other sites
BrettF

Where is the variables $pic1-3 defining a picture control?

$pic = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
    GUICtrlCreatePic(@ScriptDir & "\images\kc.bmp", 0, 88, 340, 73)

    $pic2 = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
    GUICtrlCreatePic(@ScriptDir & "\images\ki1d.gif", 0, 0, 340, 97)

    $pic3 = GUICreate("", 68, 71, 10, 10, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))
    GUICtrlCreatePic(@ScriptDir & "\images\ki2d.gif", 0, 155, 340, 97)

I think you know now.

Cheers,

Brett

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.