Sign in to follow this  
Followers 0
Hideous

Shell32.dll help program

5 posts in this topic

#1 ·  Posted (edited)

I made this program because I self had some problems on getting the right icon on my buttons :D

Hope it's usefull for some of the starting scripters :D

CODE

#include <GUIconstants.au3>

#NoTrayIcon

Opt("GUIOnEventMode", 1)

$GUI = GuiCreate("Shell32.dll", 310, 210,-1, -1 )

$Button_1_counter = 0

$Button_2_counter = 1

$Button_3_counter = 2

$Button_4_counter = 3

$Edit_1 = GUICtrlCreateInput( "", 10, 110, 290, 20 )

$Edit_2 = GUICtrlCreateInput( "", 10, 160, 290, 20 )

$Button_1 = GuiCtrlCreateButton("", 60, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT))

GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_1_counter)

Sleep(10)

$Button_2 = GuiCtrlCreateButton("", 110, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT))

GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_2_counter)

Sleep(10)

$Button_3 = GuiCtrlCreateButton("", 160, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT))

GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_3_counter)

Sleep(10)

$Button_4 = GuiCtrlCreateButton("", 210, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT))

GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_4_counter)

$Button_Prev = GUICtrlCreateButton( "<<", 110, 60, 40, 20, $BS_FLAT)

GUICtrlSetState( -1, $GUI_DISABLE )

$Button_Next = GUICtrlCreateButton( ">>", 160, 60, 40, 20, $BS_FLAT)

GUICtrlSetOnEvent( $Button_Next, "NextItem" )

GUICtrlSetOnEvent( $Button_Prev, "PrevItem" )

GUICtrlSetOnEvent( $Button_1, "Button_1" )

GUICtrlSetOnEvent( $Button_2, "Button_2" )

GUICtrlSetOnEvent( $Button_3, "Button_3" )

GUICtrlSetOnEvent( $Button_4, "Button_4" )

GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBrowser")

GuiSetState()

While 1

Sleep(10)

WEnd

Func NextItem()

Select

Case $Button_4_counter = 233

GUICtrlSetState( $Button_Next, $GUI_DISABLE )

GUICtrlSetState( $Button_Prev, $GUI_ENABLE )

Case $Button_4_counter = 232

$Button_1_counter = $Button_1_counter + 1

GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter)

$Button_2_counter = $Button_2_counter + 1

GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter)

$Button_3_counter = $Button_3_counter + 1

GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter)

$Button_4_counter = $Button_4_counter + 1

GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter)

GUICtrlSetState( $Button_Next, $GUI_DISABLE )

GUICtrlSetState( $Button_Prev, $GUI_ENABLE )

Case $Button_4_counter < 232

$Button_1_counter = $Button_1_counter + 1

GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter)

$Button_2_counter = $Button_2_counter + 1

GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter)

$Button_3_counter = $Button_3_counter + 1

GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter)

$Button_4_counter = $Button_4_counter + 1

GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter)

GUICtrlSetState( $Button_Prev, $GUI_ENABLE )

EndSelect

EndFunc

Func PrevItem()

Select

Case $Button_1_counter = 0

GUICtrlSetState( $Button_Prev, $GUI_DISABLE )

GUICtrlSetState( $Button_Next, $GUI_ENABLE )

Case $Button_1_counter = 1

$Button_1_counter = $Button_1_counter - 1

GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter)

$Button_2_counter = $Button_2_counter - 1

GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter)

$Button_3_counter = $Button_3_counter - 1

GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter)

$Button_4_counter = $Button_4_counter - 1

GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter)

GUICtrlSetState( $Button_Prev, $GUI_DISABLE )

GUICtrlSetState( $Button_Next, $GUI_ENABLE )

Case $Button_1_counter > 1

$Button_1_counter = $Button_1_counter - 1

GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter)

$Button_2_counter = $Button_2_counter - 1

GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter)

$Button_3_counter = $Button_3_counter - 1

GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter)

$Button_4_counter = $Button_4_counter - 1

GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter)

GUICtrlSetState( $Button_Next, $GUI_ENABLE )

EndSelect

EndFunc

Func Button_1()

GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')

GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_1_counter & ' )' )

EndFunc

Func Button_2()

GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')

GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_2_counter & ' )' )

EndFunc

Func Button_3()

GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')

GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_3_counter & ' )' )

EndFunc

Func Button_4()

GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')

GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_4_counter & ' )' )

EndFunc

Func ExitBrowser()

Exit

EndFunc

Edited by Hideous

[u]Its all about experience...[/u]...

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

This is really good for choosing icons. You use Chr(34) or use

Func Button_1()
    GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')
    GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_1_counter & ' )' )
EndFunc

Func Button_2()
    GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')
    GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_2_counter & ' )' )
EndFunc

Func Button_3()
    GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')
    GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_3_counter & ' )' )
EndFunc

Func Button_4()
    GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )')
    GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_4_counter & ' )' )
EndFunc
Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thnx for the Chr(34) tip :D, wasn't aware of that possibility :D

Edited by Hideous

[u]Its all about experience...[/u]...

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