Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Load Ico-Image from DLL

$
0
0
Hi guys,
I'd like to create a DLL with the resource of the script. So i'd like to include:
1) Icon
2) Image
3) Exe ( if it is possible )

I Have created the resource DLL with ResourcesViewerAndCompiler. I don't know if it is the best solution for create a resource DLL, if you have other suggestion please tell me ( i'l like to add also the version number to the DLL, the file description etc. but seems i can't  with that UDF )

I have add tree icon:
  • ICON_1
  • ICON_2
  • ICON_3
And one image:
  • IMAGE
The test script:
[ autoit ]         
  #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <Constants.au3> #include <WinAPI.au3> Example() Func Example()  GUICreate("", 400, 380, -1, -1)  GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)  GUICtrlSetImage(-1, "DLLTest.dll", "ICON_1")  GUICtrlCreateButton("my picture button", 50, 20, 40, 40, $BS_ICON)  GUICtrlSetImage(-1, "DLLTest.dll", "-2")  GUICtrlCreateButton("my picture button", 90, 20, 40, 40, $BS_ICON)  GUICtrlSetImage(-1, "DLLTest.dll", "-3")  GUICtrlCreatePic("", 0, 20, 400, 380)  GUICtrlSetState(-1, $GUI_DISABLE)  GUICtrlSetImageFromDLL(-1, "DLLTest.dll", "-4")  GUISetState()  While 1   $msg = GUIGetMsg()   If $msg = $GUI_EVENT_CLOSE Then ExitLoop  WEnd EndFunc   ;==>Example Func GUICtrlSetImageFromDLL($controlID, $filename, $imageIndex)  Local Const $STM_SETIMAGE = 0x0172  $hLib = _WinAPI_LoadLibrary($filename)  $hBmp = _WinAPI_LoadImage($hLib, $imageIndex, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR)  GUICtrlSendMsg($controlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)  _WinAPI_FreeLibrary($hLib)  _WinAPI_DeleteObject($hBmp) EndFunc   ;==>GUICtrlSetImageFromDLL

I can see the icon, but i have a question:
Why i cant' put the name but i need to use negative values?

The IMAGE not work, don't know how i need to put in :D

You can find the example DLL in the attachment. Thanks for any help

Attached Files


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>