enkriptix Posted April 15, 2009 Share Posted April 15, 2009 I want to be able to show a window with an image and a line of text, but have the background be completely transparent, so it looks like the image and text are "floating" on the desktop. Any suggestions? Free software reviews, suggestions, and computer help: The Free Man's Blog. Link to comment Share on other sites More sharing options...
BlackDragonBE Posted April 15, 2009 Share Posted April 15, 2009 GUICtrlSetBkColor ( controlID, $GUI_BKCOLOR_TRANSPARENT ) Link to comment Share on other sites More sharing options...
enkriptix Posted April 15, 2009 Author Share Posted April 15, 2009 GUICtrlSetBkColor ( controlID, $GUI_BKCOLOR_TRANSPARENT )I tried that, but I couldn't get it to work properly. Could you give an example of a transparent window with a floating image, or something, please? Free software reviews, suggestions, and computer help: The Free Man's Blog. Link to comment Share on other sites More sharing options...
ResNullius Posted April 15, 2009 Share Posted April 15, 2009 I tried that, but I couldn't get it to work properly. Could you give an example of a transparent window with a floating image, or something, please?Maybe this (by martin) will get you started:http://www.autoitscript.com/forum/index.ph...st&p=454249 Link to comment Share on other sites More sharing options...
Tec Posted April 15, 2009 Share Posted April 15, 2009 Try this for Example #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" $pic = GUICreate("test", 169, 68, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) $basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68,-1, $GUI_WS_EX_PARENTDRAG) $hDC = GUICtrlCreateLabel("This is text on a transparent Layered GUI",0, 0, 200, 20 ) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
enkriptix Posted April 15, 2009 Author Share Posted April 15, 2009 Try this for Example #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" $pic = GUICreate("test", 169, 68, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) $basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68,-1, $GUI_WS_EX_PARENTDRAG) $hDC = GUICtrlCreateLabel("This is text on a transparent Layered GUI",0, 0, 200, 20 ) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Func Terminate() Exit 0 EndFunc Fantastic! Thanks, Tec! Free software reviews, suggestions, and computer help: The Free Man's Blog. Link to comment Share on other sites More sharing options...
enkriptix Posted April 15, 2009 Author Share Posted April 15, 2009 Just a few more questions: How can I keep the window behind all other windows? Is there any way I can "trim" or "defringe" the image when it shows, because it shows a jagged white outline (even though the image itself has none)? Can I change the text color? If so, how? Can I make it so that if a user right-clicks the image, a menu appears? Thanks a lot for all the help! Free software reviews, suggestions, and computer help: The Free Man's Blog. Link to comment Share on other sites More sharing options...
Tec Posted April 15, 2009 Share Posted April 15, 2009 hmm dont now if it is perfekt, but it works i think. if someone find a misstake, correct it please expandcollapse popup#include <Constants.au3> #include <GuiMenu.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global Enum $idOpen = 1000, $idSave, $idExit Global $hWndProc, $hFunc _Main() Func _Main() Local $hGUI, $Button, $hDC, $pic Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" ; Create GUI $hGUI = GUICreate("Menu", 169, 68, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $pic = GUICtrlCreatePic($sFile, 0, 0, 169, 68, -1, $GUI_WS_EX_PARENTDRAG) $hWndProc = _WinAPI_GetWindowLong(GUICtrlGetHandle($pic), $GWL_WNDPROC) $hFunc = DllCallbackRegister('Button_WindowProcefure', 'long', 'hwnd;uint;wparam;lparam') _WinAPI_SetWindowLong(GUICtrlGetHandle($pic), $GWL_WNDPROC, DllCallbackGetPtr($hFunc)) $hDC = GUICtrlCreateLabel("This is text",0, 0, 169, 20 ) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xff00ff ) GUISetState() ; Register message handlers GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") ; Loop until user exits Do Sleep( 10 ) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() DllCallbackFree($hFunc) EndFunc ;==>_Main ; Handle WM_COMMAND messages Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch $iwParam Case $idOpen _WinAPI_ShowMsg ("Open") Case $idSave _WinAPI_ShowMsg ("Save") Case $idExit _WinAPI_ShowMsg ("Info") EndSwitch EndFunc ;==>WM_COMMAND ; Handle WM_CONTEXTMENU messages Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam) Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup () _GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem ($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem ($hMenu, 3, "Exit", $idExit) _GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam) _GUICtrlMenu_DestroyMenu ($hMenu) Return True EndFunc ;==>WM_CONTEXTMENU Func Button_WindowProcefure($hWnd, $iMsg, $iwParam, $ilParam) If $iMsg = $WM_COMMAND Then Switch _WinAPI_LoWord($iwParam) Case $idOpen _WinAPI_ShowMsg("Child Open") Case $idSave _WinAPI_ShowMsg("Child Save") Case $idExit Exit EndSwitch EndIf Return _WinAPI_CallWindowProc($hWndProc, $hWnd, $iMsg, $iwParam, $ilParam) EndFunc ;==>Button_WindowProcefure Link to comment Share on other sites More sharing options...
enkriptix Posted April 15, 2009 Author Share Posted April 15, 2009 hmm dont now if it is perfekt, but it works i think. if someone find a misstake, correct it pleaseWorks great! Thanks again, Tec! Free software reviews, suggestions, and computer help: The Free Man's Blog. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2009 Moderators Share Posted April 15, 2009 enkriptix, In future, please do not post the same question in different areas of the forum. I would then not have wasted my time answering this one. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 (edited) I think you could benefit from this thread: >link EDIT: bringing up a 6 year thread might be a little old, creating your own topic might have been a better idea. Edited April 15, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ 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