Sign in to follow this  
Followers 0
fett8802

Calling image from custom DLL [SOLVED]

5 posts in this topic

#1 ·  Posted (edited)

Hello all,

I've been beating my head against a wall for a while now about this. I can call images from shell32.dll no problem. But I can not figure out how to call images from a custom dll and apply them to a toolbar button. All of the help files for functions such as _GUIImageList_AddIcon and_GUICtrlToolbar_AddBitmap deal only with shell32.dll or the windows default icons.

I'm creating a new and hopefully more efficient version of a program that I wrote for work and I've created a custom .dll file with the icon resources to use on my toolbar. It seems the problems may be with using ordinal indexing or not.

Any ideas? I would post code, but all of the test code I've been trying are an embarrassment. I don't need you to code the entire project or anything, just ideas to get it going. Those of you that know me know that I don't post unless I'm at my wits end with my own code and have exhausted the forum's search function. Also, I'm happy to re-do the .dll file if I have done something wrong.

I've attached the custom dll.

Thank you for your help,

Fett

Edited by fett8802

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites



#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiToolbar.au3>

$hGUI = GUICreate("Form1", 623, 449, 192, 114)
$hImageList = _GUIImageList_Create(16, 16, 5)
For $i = 0 To 26
_GUIImageList_AddIcon($hImageList, @ScriptDir & "rcv2.dll", $i, True)
Next
$hToolBar = _GUICtrlToolbar_Create($hGUI, 0)
_GUICtrlToolbar_SetImageList($hToolBar, $hImageList)
For $i = 0 To 10
_GUICtrlToolbar_AddButton($hToolBar, 0, $i, 0)
Next
GUISetState()

While 1
Sleep(10)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Thank you very much.

I have an almost identical version of that script that I wrote, I'm not sure why I couldn't get it to work.

Either way, thank you very much. My head feels much better now.

- Fett


[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites

Just for any of you that may search and find this topic later, I figured out what I was missing:

_GUICtrlToolbar_SetImageList($hToolBar, $hImageList)

Thanks again!

-Fett


[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

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