Parsix Posted April 25, 2020 Posted April 25, 2020 (edited) problem with resize try this local $hB=_ResourceGetAsBitmap($ResourceName) if $hB then _GDIPlus_ImageResize($hB, 64, 64) => program crashes Edited April 25, 2020 by Parsix
Parsix Posted April 25, 2020 Author Posted April 25, 2020 (edited) problem with resize try this #AutoIt3Wrapper_Res_File_Add=Resource-GRP\logo.png, 10, Logo_PNG local $hB=_ResourceGetAsBitmap("Logo_PNG") if $hB then _GDIPlus_ImageResize($hB, 64, 64) => program crashes Edited April 25, 2020 by Parsix
Nine Posted April 25, 2020 Posted April 25, 2020 It returns a HBITMAP object. You need to convert it to GDI+ before manipulating it. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Developers Jos Posted April 25, 2020 Developers Posted April 25, 2020 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Parsix Posted April 25, 2020 Author Posted April 25, 2020 1 hour ago, Nine said: It returns a HBITMAP object. You need to convert it to GDI+ before manipulating it. how to?
Nine Posted April 25, 2020 Posted April 25, 2020 _GDIPlus_BitmapCreateFromHBITMAP “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Parsix Posted April 25, 2020 Author Posted April 25, 2020 5 minutes ago, Nine said: _GDIPlus_BitmapCreateFromHBITMAP i need to use for ImageList i try it but not worked
Nine Posted April 25, 2020 Posted April 25, 2020 Maybe posting a runable snippet of your code could help understand this issue ? What do you think ? “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Parsix Posted April 25, 2020 Author Posted April 25, 2020 (edited) expandcollapse popup#Region #AutoIt3Wrapper_Res_File_Add=Resources-Slider\NotaryW2.png, RT_RCDATA, SSAA_PNG #EndRegion #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> #include <GDIPlus.au3> #Include "Resource-LIB\resources.au3" Example() Func Example() Local $hGUI = GUICreate("ImageList Draw", 400, 300) Local $ctrl=GUICtrlCreateButton("Button1", 10, 10, 100, 100) GUISetState(@SW_SHOW) Local $hB=_ResourceGetAsBitmap("SSAA_PNG") _GDIPlus_Startup() $hB2 = _GDIPlus_BitmapCreateFromHBITMAP ($hB) $hB2 = _GDIPlus_ImageResize ( $hB2, 48, 48 ) If @error Then MsgBox(64,"Error",@error) Local $hImageList = _GUIImageList_Create(64, 64, 5,1) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _WinAPI_DeleteObject( $hB2 ) _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_Shutdown() GUIDelete() EndFunc ;==>Example Edited April 25, 2020 by Parsix
Parsix Posted April 25, 2020 Author Posted April 25, 2020 (edited) 13 minutes ago, Parsix said: expandcollapse popup#Region #AutoIt3Wrapper_Res_File_Add=Resources-Slider\NotaryW2.png, RT_RCDATA, SSAA_PNG #EndRegion #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> #include <GDIPlus.au3> #Include "Resource-LIB\resources.au3" Example() Func Example() Local $hGUI = GUICreate("ImageList Draw", 400, 300) Local $ctrl=GUICtrlCreateButton("Button1", 10, 10, 100, 100) GUISetState(@SW_SHOW) Local $hB=_ResourceGetAsBitmap("SSAA_PNG") _GDIPlus_Startup() $hB2 = _GDIPlus_BitmapCreateFromHBITMAP ($hB) $hB2 = _GDIPlus_ImageResize ( $hB2, 48, 48 ) If @error Then MsgBox(64,"Error",@error) Local $hImageList = _GUIImageList_Create(64, 64, 5,1) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _GUIImageList_Add($hImageList, $hB2) _WinAPI_DeleteObject( $hB2 ) _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_Shutdown() GUIDelete() EndFunc ;==>Example @error is set to 4 resources.au3 Edited April 25, 2020 by Parsix
Nine Posted April 25, 2020 Posted April 25, 2020 You need to revert it back to an HBITMAP object after resizing, as _GUIImageList_Add does not accept GDI+ image. Make sure you dispose HBITMAP object and GDI+ image correctly. Your snippet is not doing it right. Open help file and read about those functions and how to clean them up. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Parsix Posted April 25, 2020 Author Posted April 25, 2020 13 minutes ago, Nine said: You need to revert it back to an HBITMAP object after resizing, as _GUIImageList_Add does not accept GDI+ image. Make sure you dispose HBITMAP object and GDI+ image correctly. Your snippet is not doing it right. Open help file and read about those functions and how to clean them up. i not found any thing
Parsix Posted April 25, 2020 Author Posted April 25, 2020 Local $img1=_ResourceGetAsBitmap($ResourceName) Local $hImageList = _GUIImageList_Create(72, 72, 5) ;---Resize $img1 (hbitmap) for Imagelist _GUIImageList_Add($hImageList, $img1) ;---or Resize $img1 in Imagelist _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)
Developers Jos Posted April 25, 2020 Developers Posted April 25, 2020 @Parsix, Stick to this thread and start showing some effort to follow up on what was handed to you. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Parsix Posted April 25, 2020 Author Posted April 25, 2020 have you solution for my problem? Local $img1=_ResourceGetAsBitmap($ResourceName) Local $hImageList = _GUIImageList_Create(72, 72, 5) ;---Resize $img1 (hbitmap) for Imagelist _GUIImageList_Add($hImageList, $img1) ;---or Resize $img1 in Imagelist _GUICtrlButton_SetImageList($ctrl, $hImageList, 2, 1, 10)
Developers Jos Posted April 25, 2020 Developers Posted April 25, 2020 Which problem? It helps when you try to put some effort in formulating a question when you want an answer. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Parsix Posted April 25, 2020 Author Posted April 25, 2020 (edited) 11 minutes ago, Jos said: Which problem? It helps when you try to put some effort in formulating a question when you want an answer. How to Resize $img1 (hbitmap) for Imagelist before add to imagelist or Resize $img1 in Imagelist ? question 1: first list how to convert gdi plus bitmap to image object or any for add to image list? Edited April 25, 2020 by Parsix
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