edumanilha Posted February 15, 2020 Share Posted February 15, 2020 (edited) Hi again... I saw this transparent GUI but, I created a new topic, so I wont ressurect the older one...I'm trying a transparent GUI with buttons... And code look like this: expandcollapse popup#include <GDIPlus.au3> #include <ButtonConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> #include <File.au3> _GDIPlus_Startup() $hSplashlogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\auto.bmp") $logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) - 50 $logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2) $SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW)) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo)) GUISetState(@SW_SHOWNA, $SplashGUIlogo) ;criação do contexto Local $idContextmenu = GUICtrlCreateContextMenu() ;botão 1 autocompletar $buttonauto = GUICtrlCreateButton ("autocompletar", 10, 10, 150, 170, $BS_BITMAP) GUICtrlSetImage ($buttonauto, @ScriptDir & "\Dados\Imagens\auto.bmp") Local $idButtoncontext = GUICtrlCreateContextMenu($buttonauto) Local $idMenuAboutauto = GUICtrlCreateMenuItem("Só digitar o final da unidade em que você está!", $idButtoncontext) ;botão 2 preencher $buttonfill = GUICtrlCreateButton ("preenchimento", 180, 10, 150, 170, $BS_BITMAP) GUICtrlSetImage ($buttonfill, @ScriptDir & "\Dados\Imagens\fill.bmp") Local $idButtoncontext = GUICtrlCreateContextMenu($buttonfill) Local $idMenuAboutfill = GUICtrlCreateMenuItem("Preencher todo o IP em caso de outra unidade!", $idButtoncontext) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd _GDIPlus_Shutdown() 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 The code show no errors, but load only the image, not the buttons...What I'm doing wrong?...Thanks! EDIT: today when I updated Autoit, I got this error... Edited February 15, 2020 by edumanilha wrong code Link to comment Share on other sites More sharing options...
edumanilha Posted February 16, 2020 Author Share Posted February 16, 2020 (edited) Using this: expandcollapse popup#include <GDIPlus.au3> #include <ButtonConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> #include <File.au3> #include <StaticConstants.au3> _GDIPlus_Startup() $hSplashlogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\background.png") $logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) - 50 $logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2) $SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW)) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo)) GUISetState(@SW_SHOW, $SplashGUIlogo) $button1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\auto.bmp") $buttonheight = 25 $buttonwidth = 30 $SplashGUIbutton1 = GUICreate("", _GDIPlus_ImageGetWidth($button1), _GDIPlus_ImageGetHeight($button1), $buttonwidth, $buttonheight, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $SplashGUIlogo) _SetBitmap($SplashGUIbutton1, $button1, 255, _GDIPlus_ImageGetWidth($button1), _GDIPlus_ImageGetHeight($button1)) GUICtrlCreateLabel("Type the name of a file on your desktop and press Enter", 50, 12, 140, 50) GUISetState(@SW_SHOW, $SplashGUIbutton1) $button2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\fill.bmp") $buttonheight2 = 25 $buttonwidth2 = 190 $SplashGUIbutton2 = GUICreate("", _GDIPlus_ImageGetWidth($button2), _GDIPlus_ImageGetHeight($button2), $buttonwidth2, $buttonheight2, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $SplashGUIlogo) _SetBitmap($SplashGUIbutton2, $button2, 255, _GDIPlus_ImageGetWidth($button2), _GDIPlus_ImageGetHeight($button2)) GUISetState(@SW_SHOW, $SplashGUIbutton2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ;Case $GUI_EVENT_PRYMARYDOWN ; Exit Case $SplashGUIbutton1 Exit EndSwitch WEnd _GDIPlus_Shutdown() Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 500, $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 _SetBitmap2($hGUI, $hImage, $iOpacity, $n_width = 150, $n_height = 170) 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 I managed to show the background and the first two buttons...But I can't place buttons, guigetmsg or anything...I'm planning to use te images as buttons...All images are inserted as GUI...Can anybody help me please?... Images are set as GUI, because I tried as Buttons and images without success... Edited February 16, 2020 by edumanilha more info Link to comment Share on other sites More sharing options...
edumanilha Posted February 17, 2020 Author Share Posted February 17, 2020 I'm trying to put buttons on a png background GUI...I got no error, the buttons is there (It works when I click his position) but I can't show him...I tried GUISetState, GUI_SHOW and GUI_ONTOP...But nothing...Heres the code: expandcollapse popup#include <GDIPlus.au3> #include <ButtonConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> #include <File.au3> #include <StaticConstants.au3> _GDIPlus_Startup() $hSplashlogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\background.png") $logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) - 50 $logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2) $SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW)) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo)) $button2 = GUICtrlCreateButton ("comandos", 25, 30, 150, 170, $BS_BITMAP) GUICtrlSetImage ($button2, @ScriptDir & "\Dados\Imagens\comandos.bmp") GUICtrlSetState ($button2,$GUI_ONTOP) GUISetState(@SW_SHOWNA, $SplashGUIlogo) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ;Case $GUI_EVENT_PRYMARYDOWN ; Exit Case $button2 Exit EndSwitch WEnd _GDIPlus_Shutdown() Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 500, $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 Thanks... Link to comment Share on other sites More sharing options...
Nine Posted February 17, 2020 Share Posted February 17, 2020 And how is this thread different from the other one you just made .... https://www.autoitscript.com/forum/topic/201743-transparent-gui-without-border-with-buttons/ “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 February 17, 2020 Author Share Posted February 17, 2020 3 minutes ago, Nine said: And how is this thread different from the other one you just made .... https://www.autoitscript.com/forum/topic/201743-transparent-gui-without-border-with-buttons/ Sorry...I just changed the aproach to 2 GUI's to a GUI and buttons...Can I delete one of them? I'm really stuck here...Any hint? Link to comment Share on other sites More sharing options...
AutoBert Posted February 17, 2020 Share Posted February 17, 2020 Your script isn't runable: Quote >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\hB\AutoIt3.MySource\LogoGUI.au3 "C:\Users\hB\AutoIt3.MySource\LogoGUI.au3"(60,101) : warning: $ULW_ALPHA: possibly used before declaration. _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\hB\AutoIt3.MySource\LogoGUI.au3"(60,101) : error: $ULW_ALPHA: undeclared global variable. _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\hB\AutoIt3.MySource\LogoGUI.au3"(60,101) : error: _WinAPI_UpdateLayeredWindow(): undefined function. _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\hB\AutoIt3.MySource\LogoGUI.au3 - 2 error(s), 1 warning(s) !>17:41:18 AU3Check ended. Press F4 to jump to next error.rc:2 +>17:41:18 AutoIt3Wrapper Finished. >Exit code: 2 Time: 46.51 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 17, 2020 Developers Share Posted February 17, 2020 1 hour ago, edumanilha said: I just changed the aproach to 2 GUI's to a GUI and buttons...Can I delete one of them? Merged. Please stick to one topic going forward. 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 February 17, 2020 Author Share Posted February 17, 2020 1 hour ago, Jos said: Merged. Please stick to one topic going forward. No prob! Thank you! Link to comment Share on other sites More sharing options...
edumanilha Posted February 17, 2020 Author Share Posted February 17, 2020 2 hours ago, AutoBert said: Your script isn't runable: I can run it...But It only show the white GDI background and don't show the button...I'm making some progress here. brb. Link to comment Share on other sites More sharing options...
AutoBert Posted February 19, 2020 Share Posted February 19, 2020 On 2/17/2020 at 8:37 PM, edumanilha said: I can run it...But It only show the white GDI background and don't show the button...I'm making some progress here. brb. None of the three scripts posted in this (meanwhile merged) thread is runable, at last one include is missing. And please attach used image files. Link to comment Share on other sites More sharing options...
edumanilha Posted February 19, 2020 Author Share Posted February 19, 2020 21 minutes ago, AutoBert said: None of the three scripts posted in this (meanwhile merged) thread is runable, at last one include is missing. And please attach used image files. Weird...I can run...When I try to use buttons, they don't show...I put the images using create GUi...But they aren't clickable...I think the thing that I'm clicking on the image GUI position, suposed to be a button is "the GuiCreateLabel" thats getting the "GUICtrlSetOnEvent(-1, "umapertado")" I Attached the images like you asked... The script is looking like this: expandcollapse popupOpt("GUIOnEventMode",1) #include <GDIPlus.au3> #include <ButtonConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> #include <File.au3> #include <StaticConstants.au3> _GDIPlus_Startup() $hSplashlogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\background.png") $logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) - 50 $logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2) $SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW)) _SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo)) GUISetState(@SW_SHOW, $SplashGUIlogo) ;$button2 = GUICtrlCreateButton ("comandos", 25, 30, 150, 170, $BS_BITMAP) ;GUICtrlSetImage ($button2, @ScriptDir & "\Dados\Imagens\comandos.bmp") ;GUICtrlSetState ($button2,$GUI_SHOW) ;WinSetOnTop($button2,'',1) $button1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\auto.bmp") $buttonheight = 25 $buttonwidth = 30 $SplashGUIbutton1 = GUICreate("", _GDIPlus_ImageGetWidth($button1), _GDIPlus_ImageGetHeight($button1), $buttonwidth, $buttonheight, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $SplashGUIlogo) _SetBitmap($SplashGUIbutton1, $button1, 255, _GDIPlus_ImageGetWidth($button1), _GDIPlus_ImageGetHeight($button1)) GUICtrlSetOnEvent(-1, "umapertado") $label = GUICtrlCreateLabel("Type the name of a file on your desktop and press Enter", 15, 30, 150, 170,$SS_RIGHT) GUICtrlSetState ($label,$GUI_SHOW) GUISetState(@SW_SHOW, $SplashGUIbutton1) $button2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Dados\Imagens\fill.bmp") $buttonheight2 = 25 $buttonwidth2 = 190 $SplashGUIbutton2 = GUICreate("", _GDIPlus_ImageGetWidth($button2), _GDIPlus_ImageGetHeight($button2), $buttonwidth2, $buttonheight2, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $SplashGUIlogo) _SetBitmap($SplashGUIbutton2, $button2, 255, _GDIPlus_ImageGetWidth($button2), _GDIPlus_ImageGetHeight($button2)) GUISetState(@SW_SHOW, $SplashGUIbutton2) GUICtrlSetOnEvent(-1, "doisapertado") $label2 = GUICtrlCreateLabel("Type the name of a file on your desktop and press Enter", 300, 30, 150, 170,$SS_RIGHT) GUICtrlSetState ($label2,$GUI_SHOW) GUISetState(@SW_SHOW, $SplashGUIbutton2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ;Case $GUI_EVENT_PRYMARYDOWN ; Exit Case $button1 Exit Case $button2 Exit Case $SplashGUIbutton1 MsgBox($MB_SYSTEMMODAL, "OK Pressed", "está ok botão switch 1") EndSwitch WEnd _GDIPlus_Shutdown() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $SplashGUIbutton1 MsgBox($MB_SYSTEMMODAL, "OK Pressed", "está ok botão switch 2") ExitLoop EndSwitch WEnd Func umapertado() ;MsgBox($MB_SYSTEMMODAL, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) MsgBox($MB_SYSTEMMODAL, "OK Pressed", "está ok func") ;Exit EndFunc ;==>OKPressed Func doisapertado() ;MsgBox($MB_SYSTEMMODAL, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) MsgBox($MB_SYSTEMMODAL, "OK Pressed", "está ok func 2") ;Exit EndFunc ;==>CancelPressed Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 500, $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 auto.bmp fill.bmp Link to comment Share on other sites More sharing options...
MagnumXL Posted February 19, 2020 Share Posted February 19, 2020 I am by no means an expert in this arena but I looked over my code and I did notice a couple of things: I think you are on the right track with your last post. Setting the buttons as gui's themselves. But you won't be able to use GUICtrlSetOnEvent like that. Use GUIRegisterMsg to get the click from a gui. I noticed that I used png's for my button images not bmps. Maybe this is the issue? And on a side note: consider using _GDIPlus_ImageGetWidth/Height just once for each image and then using the variable it returns. That part of your code works but could be more efficient. Link to comment Share on other sites More sharing options...
edumanilha Posted February 19, 2020 Author Share Posted February 19, 2020 (edited) 3 hours ago, MagnumXL said: I am by no means an expert in this arena but I looked over my code and I did notice a couple of things: I think you are on the right track with your last post. Setting the buttons as gui's themselves. But you won't be able to use GUICtrlSetOnEvent like that. Use GUIRegisterMsg to get the click from a gui. I noticed that I used png's for my button images not bmps. Maybe this is the issue? And on a side note: consider using _GDIPlus_ImageGetWidth/Height just once for each image and then using the variable it returns. That part of your code works but could be more efficient. I'm no expert too, thanks for your response! I'm thinking about work with coords, since I can't put buttons...Maybe fake buttons...A complete png image, with drawn buttons, close, etc...And work with coords...to simulate button presses...I'll try you sugestions! Thanks! EDIT: I've been messing around this script, please don't remind the trash in the example... Edited February 19, 2020 by edumanilha change word 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