SirWayNe Posted September 29 Share Posted September 29 Hey, TLDR; Take Image from dll File, rotate as needed, Put into Button Control I want to use Icons from shell32 and Put them into Buttons as Images. So far so easy, Buttons are created with Style BS_ICON and the Image ist set via guictrlsetimage with specific identifier. But the Idea is to use arrows or other Icons from the shell32.dll or different files, but rotating them as needed for the Button controls. Since the Rotation has to be done at runtime, creating the icons in advance wont work. I got a bit lost, using GDI Plus in this. Every attemp i tried, failed in No Icon displayed. But i am not used to GDI Plus at all, that might be the Problem here. When i have access to the current source, i will add this to the topic. Any ideas so far how to solve this? Greetings. Link to comment Share on other sites More sharing options...
Solution Nine Posted September 29 Solution Share Posted September 29 (edited) Maybe this ? expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <WinAPIRes.au3> #include <GDIPlus.au3> Opt("MustDeclareVars", True) Example() Func Example() GUICreate("Rotate") Local $idButton = GUICtrlCreateButton("", 10, 20, 50, 50, $BS_ICON) Local $hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE) Local $hIcon = _WinAPI_LoadIcon($hInstance, 231) _GDIPlus_Startup() Local $hImage = _GDIPlus_BitmapCreateFromHICON($hIcon) _GDIPlus_ImageRotateFlip($hImage, 1) ; 90 degree Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUICtrlSendMsg($idButton, $BM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) _WinAPI_FreeLibrary($hInstance) EndFunc ;==>Example Edited September 29 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SirWayNe Posted September 30 Author Share Posted September 30 Hey, thank you for the fast answer, it is working as intended now. This Function uses the name of the icon rather then the ordinal number. this has to be kept in mind, when using the Icon Selector from examples in AU3 Installation. Greetings. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now