Sign in to follow this  
Followers 0
CodyBarrett

icon from .dll

7 posts in this topic

ok so ive been tinkering with .dlls just lately and im wondering why doesnt this work

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Bob

 Script Function:
    Keeps A Secure Folder

#ce ----------------------------------------------------------------------------
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>
#Include <GuiEdit.au3>

Opt ('GuiOnEventMode', 1)
Opt ('MustDeclareVars', 1)

Global $GUI = GUICreate ('LOCKER', 400, 200, -1, -1, -2139094904)
GUISetBkColor (0x000000, $GUI)
GUISetFont (20, '', '', 'Courier New', $GUI)
Global $STATUSLABEL = GUICtrlCreateLabel ('LOCKER STATUS = ', 10, 10, 300, 50)
Global $STATUSICON = GUICtrlCreateIcon (@SystemDir & '\Shell32.dll', 364, 300, 10, 30, 30)
GUICtrlSetColor ($STATUSLABEL, 0xFFFFFF)

GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUISetState ()

While 1
WEnd

Func _Exit ()
Exit
EndFunc

Share this post


Link to post
Share on other sites



CodyBarrett,

Firstly, my Shell32.dll only has 277 icons! (Vista x32 Home Prem)

Secondly, I believe you need a negative ordinal. From the Help file: "Passing a positive number will reference the string equivalent icon name. Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers".

Using your code with -48 gives me a "padlock" icon - which I assume is what you wanted

Global $STATUSICON = GUICtrlCreateIcon (@SystemDir & '\Shell32.dll', -48, 300, 10, 30, 30)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

awe thank you... so how do i figure out the numeral value for the icon.. i was using reshacker and i that it wasnt right...

Share this post


Link to post
Share on other sites

Look under the "Icon Group" expanded tree, not "Icon".

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ahhh thank you! :D

EDIT

ok now i have this and the button wont click

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Bob

 Script Function:
    Keeps A Secure Folder

#ce ----------------------------------------------------------------------------
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>
#Include <GuiEdit.au3>
#include <StaticConstants.au3>

Opt ('GuiOnEventMode', 1)
Opt ('MustDeclareVars', 1)

Global $GUI = GUICreate ('LOCKER', 400, 200, -1, -1, -2139094904)
GUISetBkColor (0x000000, $GUI)
GUISetFont (20, '', '', 'Courier New', $GUI)
Global $STATUSLABEL = GUICtrlCreateLabel ('LOCKER STATUS = ', 10, 10, 300, 50)
Dim $STATUSICON = GUICtrlCreateButton ('', 270,10, 40, 40, $BS_ICON)
GUICtrlSetImage ($STATUSICON,'Shell32.dll', -48)
GUICtrlSetColor ($STATUSLABEL, 0xFFFFFF)
GUICtrlSetOnEvent ($STATUSICON, 'Setattrib')
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUISetState ()

While 1
    Sleep (100)
WEnd

Func Setattrib ()
    GUICtrlSetImage ($STATUSICON, 'Shell32.dll', -45)
EndFunc

Func _Exit ()
Exit
EndFunc
Edited by CodyBarrett

Share this post


Link to post
Share on other sites

ahhh thank you! :D

EDIT

ok now i have this and the button wont click

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Bob

 Script Function:
    Keeps A Secure Folder

#ce ----------------------------------------------------------------------------
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>
#Include <GuiEdit.au3>
#include <StaticConstants.au3>

Opt ('GuiOnEventMode', 1)
Opt ('MustDeclareVars', 1)

Global $GUI = GUICreate ('LOCKER', 400, 200, -1, -1, -2139094904)
GUISetBkColor (0x000000, $GUI)
GUISetFont (20, '', '', 'Courier New', $GUI)
Global $STATUSLABEL = GUICtrlCreateLabel ('LOCKER STATUS = ', 10, 10, 300, 50)
Dim $STATUSICON = GUICtrlCreateButton ('', 270,10, 40, 40, $BS_ICON)
GUICtrlSetImage ($STATUSICON,'Shell32.dll', -48)
GUICtrlSetColor ($STATUSLABEL, 0xFFFFFF)
GUICtrlSetOnEvent ($STATUSICON, 'Setattrib')
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUISetState ()

While 1
    Sleep (100)
WEnd

Func Setattrib ()
    GUICtrlSetImage ($STATUSICON, 'Shell32.dll', -45)
EndFunc

Func _Exit ()
Exit
EndFunc
Your label overlaps the button, so reduce it to say 260 wide.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

OH! is that it?

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