rexx Posted June 21, 2009 Share Posted June 21, 2009 (edited) I have search the udf document and found _GUICtrlMenu_SetItemBmp()But it needs a bitmap handle.So I use GDI+ to load a image from file and create the bitmap handle._GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sIconFile) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) ; _WinAPI_DeleteObject($hBitmap) _GDIPlus_ShutDown()This works but I want to know if there's another way to create bitmap handle from a file without using the GDI+ lib.I found this but he didn't give the works one.Another question, I use _WinAPI_PrivateExtractIcon() to get icon from executables, but it returns icon handle.How can I convert it to bitmap handle so that I can use it in _GUICtrlMenu_SetItemBmp()I tried _WinAPI_GetIconInfo($hIcon) and uses "$aIcon[5] - Handle to the icon color bitmap", but I got a black square.Thanks. Edited June 21, 2009 by rexx Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted June 21, 2009 Share Posted June 21, 2009 Search for ModernMenu Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
oMBRa Posted June 21, 2009 Share Posted June 21, 2009 try this: Func _GdipCreateBitmapFromHICON($hIcon) Local $sBitmap $sBitmap = DllStructCreate('dword') $hBitmap = DllCall('gdiplus.dll', 'dword', 'GdipCreateBitmapFromHICON', 'hwnd', $hIcon, 'ptr', DllStructGetPtr($sBitmap)) Return SetError(0, 0, DllStructGetData($sBitmap, 1)) EndFunc ;==>_GdipCreateBitmapFromHICON this converts an icon handle to a bitmap object, to create an handle to the bitmap you could use _GDIPlus_BitmapCreateHBITMAPFromBitmap Link to comment Share on other sites More sharing options...
rexx Posted June 21, 2009 Author Share Posted June 21, 2009 Search for ModernMenuThanks. I know this, but i dont want the menu style. But maybe there will be something helpful. I'll look it again. try this: Func _GdipCreateBitmapFromHICON($hIcon) Local $sBitmap $sBitmap = DllStructCreate('dword') $hBitmap = DllCall('gdiplus.dll', 'dword', 'GdipCreateBitmapFromHICON', 'hwnd', $hIcon, 'ptr', DllStructGetPtr($sBitmap)) Return SetError(0, 0, DllStructGetData($sBitmap, 1)) EndFunc ;==>_GdipCreateBitmapFromHICON this converts an icon handle to a bitmap object, to create an handle to the bitmap you could use _GDIPlus_BitmapCreateHBITMAPFromBitmapThanks, this works! But the transparency seems not working. Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted June 21, 2009 Share Posted June 21, 2009 Could you explain a bit more Why does ModernMenu not work ? You can add the icons to the exe and use them Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
rexx Posted June 21, 2009 Author Share Posted June 21, 2009 Could you explain a bit more Why does ModernMenu not work ?You can add the icons to the exe and use themI didn't say it doesn't work.I just don't like the style, I want a simply vista style icon. 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