edumanilha Posted March 14, 2020 Share Posted March 14, 2020 (edited) I searched a lot, and tried some examples...Most of topics are necro...I have a GDI PNG logo, and now I'm trying to add PNG buttons to my GUI, But When I try to put some new GDI object the Previous stop working... I even tried to use a diferent function for the button...Thanks! expandcollapse popup$hSplashlogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\riachu.png") $logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) + 70 $logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2) + 290 $SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW),$hGUI) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo)) Global Const $iPic = GUICtrlCreatePic("", 10, 10, 128, 128) SendImageToPicControl(@ScriptDir & "\Dados\Imagens\close.png", $iPic) GUISetState() Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $n_width) DllStructSetData($tSize, "Y", $n_height) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Func SendImageToPicControl($sImage, $iCtrlID) Local Const $hImage = _GDIPlus_ImageLoadFromFile($sImage) Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_ImageDispose($hImage) EndFunc Edited March 15, 2020 by edumanilha Link to comment Share on other sites More sharing options...
Subz Posted March 14, 2020 Share Posted March 14, 2020 Here is an example I posted recently, the image is embedded into the exe when compiled, you'll need ResourcesEx.udf and will need to make a couple of changes to get it working, people have commented on what changes are required, while I have used bmp in the post, I also tried with png files and they worked fine edumanilha 1 Link to comment Share on other sites More sharing options...
edumanilha Posted March 14, 2020 Author Share Posted March 14, 2020 (edited) 6 hours ago, Subz said: Here is an example I posted recently, the image is embedded into the exe when compiled, you'll need ResourcesEx.udf and will need to make a couple of changes to get it working, people have commented on what changes are required, while I have used bmp in the post, I also tried with png files and they worked fine Thx for your reply! when you work with PNG they appear transparent? Can you help me to add buttons using the actual GDI script? I change this script so many times... I Figured it out! Thanks! Edited March 14, 2020 by edumanilha Solved Link to comment Share on other sites More sharing options...
Nine Posted March 14, 2020 Share Posted March 14, 2020 Didn't you learn from that previous thread : https://www.autoitscript.com/forum/topic/202039-animated-gui-gif-background-solved/?tab=comments#comment-1449692 You are always asking to provide full code to you... “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...
edumanilha Posted March 14, 2020 Author Share Posted March 14, 2020 3 minutes ago, Nine said: Didn't you learn from that previous thread : https://www.autoitscript.com/forum/topic/202039-animated-gui-gif-background-solved/?tab=comments#comment-1449692 You are always asking to provide full code to you... First - I didnt ask for full code! I asked for help to convert the gif! because I tried base 64 and didn't work! And I'm already had implemented a sample into the script... Second - same here, I used the GDI, it worked, but I can't introduce buttons, just asked for some help to correct my code! Where you saw me asking for full code without any effort? I'm breaking any forum rules? Right now in my topic I figured out the answer without waiting for as you say "Full code"... Whats the problem with you? I dont get it! Link to comment Share on other sites More sharing options...
edumanilha Posted March 14, 2020 Author Share Posted March 14, 2020 15 minutes ago, Nine said: Didn't you learn from that previous thread : https://www.autoitscript.com/forum/topic/202039-animated-gui-gif-background-solved/?tab=comments#comment-1449692 You are always asking to provide full code to you... Where's the moderation? I can't ask questions here? @Jos @Melba23 Link to comment Share on other sites More sharing options...
argumentum Posted March 14, 2020 Share Posted March 14, 2020 32 minutes ago, edumanilha said: ... I'm breaking any forum rules? Right now in my topic ... There are some rules but, what is welcomed, to me is: If you solved the issue, post the code that solved it. If you solved the issue, add [solved] to the title by editing the first post The functions that are not in the help file, add a link to the source Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) ; https://www.autoitscript.com/forum/topic/202041-gdi-png-buttons/?tab=comments#comment-1449747 ... ... Above all, don't get personal with a post oh, I'm not a mod. but I felt like sharing. edumanilha 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
edumanilha Posted March 14, 2020 Author Share Posted March 14, 2020 1 minute ago, argumentum said: There are some rules but, what is welcomed, to me is: If you solved the issue, post the code that solved it. If you solved the issue, add [solved] to the title by editing the first post The functions that are not in the help file, add a link to the source Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) ; https://www.autoitscript.com/forum/topic/202041-gdi-png-buttons/?tab=comments#comment-1449747 ... ... Above all, don't get personal with a post oh, I'm not a mod. but I felt like sharing. thanks for your hints! Thats what I call a productive interaction! argumentum 1 Link to comment Share on other sites More sharing options...
edumanilha Posted March 14, 2020 Author Share Posted March 14, 2020 3 minutes ago, argumentum said: There are some rules but, what is welcomed, to me is: If you solved the issue, post the code that solved it. If you solved the issue, add [solved] to the title by editing the first post The functions that are not in the help file, add a link to the source Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200) ; https://www.autoitscript.com/forum/topic/202041-gdi-png-buttons/?tab=comments#comment-1449747 ... ... Above all, don't get personal with a post oh, I'm not a mod. but I felt like sharing. I just did two GUI...in the end of the main GUI's linked to the main one... $hMinimizeButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\minimize.png") $miniheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hMinimizeButton)/2) - 125 $miniwidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hMinimizeButton)/2) + 270 $CloseGUI = GUICreate("", _GDIPlus_ImageGetWidth($hMinimizeButton), _GDIPlus_ImageGetHeight($hMinimizeButton), $miniwidth, $miniheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW, $WS_EX_TOPMOST),$hGUI) _SetBitmap($CloseGUI, $hMinimizeButton, 255, _GDIPlus_ImageGetWidth($hMinimizeButton), _GDIPlus_ImageGetHeight($hMinimizeButton)) ;$MiniButton = GUICtrlCreateLabel("teste", 0, 0, $miniheight, $miniwidth,$WS_EX_TOPMOST) GUISetState() $hCloseButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\close.png") $closeheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hCloseButton)/2) - 125 $closewidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hCloseButton)/2) + 300 $CloseGUI = GUICreate("", _GDIPlus_ImageGetWidth($hCloseButton), _GDIPlus_ImageGetHeight($hCloseButton), $closewidth, $closeheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW, $WS_EX_TOPMOST),$hGUI) _SetBitmap($CloseGUI, $hCloseButton, 255, _GDIPlus_ImageGetWidth($hCloseButton), _GDIPlus_ImageGetHeight($hCloseButton)) GUISetState() As you can see in the commented line I'm now trying to put a clickable label to use this like a button...But I'm really trying I'm not coming here so soon to ask: OMG I dunno whatodo gimma da code! ¬¬ Link to comment Share on other sites More sharing options...
Nine Posted March 14, 2020 Share Posted March 14, 2020 1 hour ago, edumanilha said: Whats the problem with you? I dont get it! I bet you don't get it. You forgot a few mods BTW. “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...
edumanilha Posted March 15, 2020 Author Share Posted March 15, 2020 26 minutes ago, Nine said: I bet you don't get it. You forgot a few mods BTW. I don't need to tag the whole forum. I'm still waiting for the topics where you said I'm asking for the full code! See ya! Link to comment Share on other sites More sharing options...
edumanilha Posted March 15, 2020 Author Share Posted March 15, 2020 7 hours ago, edumanilha said: I just did two GUI...in the end of the main GUI's linked to the main one... $hMinimizeButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\minimize.png") $miniheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hMinimizeButton)/2) - 125 $miniwidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hMinimizeButton)/2) + 270 $MinimizeGUI = GUICreate("Minimize", _GDIPlus_ImageGetWidth($hMinimizeButton), _GDIPlus_ImageGetHeight($hMinimizeButton), $miniwidth, $miniheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW, $WS_EX_TOPMOST),$hGUI) _SetBitmap($CloseGUI, $hMinimizeButton, 255, _GDIPlus_ImageGetWidth($hMinimizeButton), _GDIPlus_ImageGetHeight($hMinimizeButton)) GUISetState() $hCloseButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\close.png") $closeheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hCloseButton)/2) - 125 $closewidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hCloseButton)/2) + 300 $CloseGUI = GUICreate("Close", _GDIPlus_ImageGetWidth($hCloseButton), _GDIPlus_ImageGetHeight($hCloseButton), $closewidth, $closeheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW, $WS_EX_TOPMOST),$hGUI) _SetBitmap($CloseGUI, $hCloseButton, 255, _GDIPlus_ImageGetWidth($hCloseButton), _GDIPlus_ImageGetHeight($hCloseButton)) GUISetState() As you can see in the commented line I'm now trying to put a clickable label to use this like a button...But I'm really trying I'm not coming here so soon to ask: OMG I dunno whatodo gimma da code! ¬¬ Just sharing: I used GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") on the main GUI and the function: Func _WM_LBUTTONDOWN($hWnd, $iMsg, $iwParam, $ilParam) $Clicked = WinGetTitle($hWnd) if $Clicked = "Minimize" then GUISetState(@SW_MINIMIZE, $hGUI) endif if $Clicked = "Close" then Exit endif EndFunc I know it could be better, but still a work in progress... now I can click on the GDI buttons...I wonder if all of them need to be GUI's...But I can do what I need! PS: I'm not a designer! LOL... Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2020 Developers Share Posted March 15, 2020 9 hours ago, edumanilha said: Where's the moderation? I can't ask questions here? @Jos @Melba23 Seriously??? haven't found the Report button yet on your screen? Having said that: Your way of asking question is such that it is somewhat logical you get these type of responses ...so you could simply ignore them...right? Oh, and while I have your attention: Could you please stop quoting full replies each time as that only makes the thread totally unreadable. Just quote a sentence or paragraph when referring to it or simply answer as the original text is just above it. Jos FrancescoDiMuro 1 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. Link to comment Share on other sites More sharing options...
edumanilha Posted March 15, 2020 Author Share Posted March 15, 2020 (edited) Quote Seriously??? haven't found the Report button yet on your screen? No, I didn't I dont need to report anything until now... Quote Having said that: Your way of asking question is such that it is somewhat logical you get these type of responses ...so you could simply ignore them...right? English is not my native language...But I never asked: "I don't know what to do! Please make my full script!" Maybe I don't expressed rightly but I NEVER asked for full code! I work hard searching the forum, testing examples, when I tried EVERYTHING and come here and make questions! And out of the blue come someone and say: "STOP ASKING FULL CODE, YOU ALWAYS DO THAT!" is not fair with my efforts...Yesterday I had go to sleep 3:30am coding...So I'll not sit down and shutup! And You're not beeing fair too, saying I had to expect that type of behavior! Or you think you are? Quote Oh, and while I have your attention: Could you please stop quoting full replies each time as that only makes the thread totally unreadable. Just quote a sentence or paragraph when referring to it or simply answer as the original text is just above it. As you can see now I learned... I'll try to not asking any more question if you guys are bothered...I asked for help because someone come saying bullshit, and when someone comes instead of support me about the lies and attack I got my ears pulled! Thank you! Edited March 15, 2020 by edumanilha typos Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2020 Developers Share Posted March 15, 2020 2 minutes ago, edumanilha said: No, I didn't I dont need to report anything until now... Well you did link both Melba23 and me asking for a mod ....hence that comment as that is exactly what that Report button is for. 3 minutes ago, edumanilha said: Yesterday I had go to sleep 3:30am coding...So I'll not sit down and shutup! And You're not beeing fair too, saying I had to expect that type of behavior! Or you think you are? Hey to me this is all self-inflicted, but I haven't said you needed to shut-up anywhere ....did I? I honestly can't care less whether or not you do ignore people not contributing and you becoming angry... but please don't come crying to us when you can't resist. ... Simple choices in life whether you want to spend energy on negativity or not. So I have no idea where the "me not being fair" is coming from when I try to have you look in the mirror and reflect a little more. Now just try to get enough sleep for a change, take a chill-pill and stop taking everything posted personal. 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. Link to comment Share on other sites More sharing options...
edumanilha Posted March 15, 2020 Author Share Posted March 15, 2020 Quote Hey to me this is all self-inflicted Yes I'm doing because I like it... Quote Hey to me this is all self-inflicted, but I haven't said you needed to shut-up anywhere ....did I? Having said that: Your way of asking question is such that it is somewhat logical you get these type of responses ...so you could simply ignore them When someone say something thats not true, its natural you talk back, and you agreed with him... Quote I honestly can't care less whether or not you do ignore people not contributing and you becoming angry... As I said I'm working hard on my code, I'm became angry because this decrease my efforts... I'm glad people here helped me a lot! But its not a "taking all personal thing..." Quote but please don't come crying to us when you can't resist. .. Really man?... You fair doubt. Quote Simple choices in life whether you want to spend energy on negativity or not. Again man...Negativity, for complaining about injustice? what good thing I can take from his comment? Quote So I have no idea where the "me not being fair" is coming from when I try to have you look in the mirror and reflect a little more. I'll not in the mirror and say: "oh you should not been asking "full codes" in the forum, now everyone is mad at you...even jos agreed with him...shame on you..." Quote Now just try to get enough sleep for a change, take a chill-pill and stop taking everything posted personal. I'll take my "chill-Pill" and spend the sunday with my family! Thank you! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2020 Developers Share Posted March 15, 2020 1 hour ago, edumanilha said: even jos agreed with him...shame on you.. sigh ... ok read it however you want, even when it isn't stated nor implied, I am done trying to explain.... 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. Link to comment Share on other sites More sharing options...
edumanilha Posted March 15, 2020 Author Share Posted March 15, 2020 23 minutes ago, Jos said: sigh ... ok read it however you want, even when it isn't stated nor implied, I am done trying to explain.... Quote Your way of asking question is such that it is somewhat logical you get these type of responses Stated or Implied whatever...Your words not mine! have a nice day! 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