JohnnyThrash Posted May 26, 2010 Share Posted May 26, 2010 The problem is simple, the answer I have no idea about. I really like the tooltip function. It's very simple to use. I'm using it very effectively too. What's nice about it is that I can arbitrarily place it wherever I'd like. _GUIToolTip is not very well documented as it is missing any examples. From what I've gathered though _GUIToolTip can only be displayed at a control. However, GUIToolTip can be extensively customized with different colors and such. My problem: I need to ability to display a tooltip anywhere like you can with ToolTip() but I also need to customize that tooltip so that the colors are not default. What is the best avenue for achieving my goals here? Thanks is advance. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 26, 2010 Share Posted May 26, 2010 This member's (GEOSoft) Autoit website is very useful. I don't know if this will help you in this particular situation, but it maybe can more than I could.. GuiToolTip Management - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
JohnnyThrash Posted May 26, 2010 Author Share Posted May 26, 2010 This member's (GEOSoft) Autoit website is very useful. I don't know if this will help you in this particular situation, but it maybe can more than I could.. GuiToolTip ManagementWell I appreciate your effort to help me, but it would seem that the webpage you've refered me to to is simply a copy of what's already in the manual =S. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 26, 2010 Share Posted May 26, 2010 Did you try _GuiToolTip_SetToolInfo()? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JohnnyThrash Posted May 26, 2010 Author Share Posted May 26, 2010 Did you try _GuiToolTip_SetToolInfo()?Ha, uh, well I gladly would have tried that though I'm quite confounded by the entire _GUIToolTip set of functions. After looking at _GuiToolTip_SetToolInfo() I only further confused myself. I'm not sure of how to properly use any of these functions of GUIToolTip I only barely grasp the concept of them.In the left picture shown below I have accomplished the effect with ToolTip(). I guess my big question is how can I achieve the effect shown in the right picture Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 27, 2010 Share Posted May 27, 2010 (edited) Hmm... my first attempt at a demo was a complete failure. Looking for more info now.Edit: Here is a working example by Rover, though it's not quite what's wanted since it floats independent tooltips not associated with any window/control.Rover's example of multiple tooltips: expandcollapse popup#include <GuiToolTip.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $iIconID = 43 If @OSVersion == "WIN_VISTA" Then $iIconID = 51 Global $hIcon = _WinAPI_LoadShell32Icon($iIconID) Global $hToolTip1 = _GUIToolTip_CreateToolTip(0, "Close tooltip to exit", "ToolTip 1", Default, _ @DesktopWidth / 2, @DesktopHeight / 2 - 120, 2 + 16, 0xFFFFFF, 0x985428, $hIcon) Global $hToolTip2 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 2", 0, _ @DesktopWidth / 2, @DesktopHeight / 2, 2 + 16, 0xFF0000, 0xFFFFFF, $hIcon) Global $hToolTip3 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 3", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 75, 2 + 16) Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 130, 32 + 16) _WinAPI_DestroyIcon($hIcon) ;Sleep(2000) ;Hide ;_GUIToolTip_TrackActivate($hToolTip1, False, 0, 0) ;Sleep(2000) ;Show ;_GUIToolTip_TrackActivate($hToolTip1, True, 0, 0) Do Sleep(10) Local $aPos = MouseGetPos() _GUIToolTip_TrackPosition($hToolTip4, $aPos[0]+10, $aPos[1]+20) _GUIToolTip_UpdateTipText($hToolTip4, 0, 0, "X: " & $aPos[0] & " Y: "&$aPos[1]) Until BitAND(WinGetState($hToolTip1), 2) <> 2 ; exit if Tooltip not visible (closed by balloon tip button) _GUIToolTip_Destroy($hToolTip1) _GUIToolTip_Destroy($hToolTip2) _GUIToolTip_Destroy($hToolTip3) _GUIToolTip_Destroy($hToolTip4) Func _GUIToolTip_CreateToolTip($hwnd, $sTitle, $sText, $iStyle = Default, $iX = -1, _ $iY = -1, $iFlags = 0, $iColTxt = Default, $iColBk = Default, $iIcon = 0) ;Author: rover and et al. ;$iIcon [optional] Pre-defined icon to show next to the title: Requires a title. ;0 = No icon, 1 = Info icon, 2 = Warning icon, 3 = Error Icon ; From _GUIToolTip_SetTitle() remarks ; As of Windows XP SP2 and later, $iIcon can contain an HICON value. ; Any value greater than 3 is assumed to be an HICON. Local Const $CW_USEDEFAULT = 0x80000000 If Not IsHWnd($hwnd) Or IsKeyword($hwnd) Then $hwnd = 0 If IsKeyword($iX) Or $iX < 0 Or Not IsNumber($iX) Then $iX = 0 If IsKeyword($iY) Or $iY < 0 Or Not IsNumber($iY) Then $iY = 0 If IsKeyword($iFlags) Or $iFlags <= 0 Or Not IsNumber($iFlags) Then $iFlags = 32 + 8 + 1 If IsKeyword($iStyle) Then $iStyle = BitOR($TTS_BALLOON, $TTS_CLOSE) Local $hTip = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, "tooltips_class32", "", _ BitOR($iStyle, $TTS_ALWAYSTIP, $TTS_NOPREFIX), _ $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $hWnd) _GUIToolTip_AddTool($hTip, $hwnd, $sText, $hwnd, 0, 0, 0, 0, $iFlags, 0) If Number($iIcon) > 3 And @OSVersion = "WIN_XP" And Number(StringRight(@OSServicePack, 1)) < 2 Then $iIcon = 0 If Not IsNumber($iIcon) Or $iIcon < 0 Then $iIcon = 0 _GUIToolTip_SetTitle($hTip, $sTitle, $iIcon) If IsInt($iColTxt) Then _GUIToolTip_SetTipTextColor($hTip, $iColTxt) If IsInt($iColBk) Then _GUIToolTip_SetTipBkColor($hTip, $iColBk) If $hwnd = 0 Or $hwnd = -1 Or IsKeyword($hwnd) Then _GUIToolTip_TrackPosition($hTip, $iX, $iY) _GUIToolTip_TrackActivate($hTip, True, $hwnd, $hwnd) Return $hTip EndIf Return $hTip EndFunc ;==>_GUIToolTip_CreateToolTipAlso found an alternative UDF by rasim: ToolTip_UDF Edited May 27, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JohnnyThrash Posted May 27, 2010 Author Share Posted May 27, 2010 Hmm... my first attempt at a demo was a complete failure. Looking for more info now. Edit: Here is a working example by Rover, though it's not quite what's wanted since it floats independent tooltips not associated with any window/control. Rover's example of multiple tooltips: expandcollapse popup#include <GuiToolTip.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $iIconID = 43 If @OSVersion == "WIN_VISTA" Then $iIconID = 51 Global $hIcon = _WinAPI_LoadShell32Icon($iIconID) Global $hToolTip1 = _GUIToolTip_CreateToolTip(0, "Close tooltip to exit", "ToolTip 1", Default, _ @DesktopWidth / 2, @DesktopHeight / 2 - 120, 2 + 16, 0xFFFFFF, 0x985428, $hIcon) Global $hToolTip2 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 2", 0, _ @DesktopWidth / 2, @DesktopHeight / 2, 2 + 16, 0xFF0000, 0xFFFFFF, $hIcon) Global $hToolTip3 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 3", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 75, 2 + 16) Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 130, 32 + 16) _WinAPI_DestroyIcon($hIcon) ;Sleep(2000) ;Hide ;_GUIToolTip_TrackActivate($hToolTip1, False, 0, 0) ;Sleep(2000) ;Show ;_GUIToolTip_TrackActivate($hToolTip1, True, 0, 0) Do Sleep(10) Local $aPos = MouseGetPos() _GUIToolTip_TrackPosition($hToolTip4, $aPos[0]+10, $aPos[1]+20) _GUIToolTip_UpdateTipText($hToolTip4, 0, 0, "X: " & $aPos[0] & " Y: "&$aPos[1]) Until BitAND(WinGetState($hToolTip1), 2) <> 2 ; exit if Tooltip not visible (closed by balloon tip button) _GUIToolTip_Destroy($hToolTip1) _GUIToolTip_Destroy($hToolTip2) _GUIToolTip_Destroy($hToolTip3) _GUIToolTip_Destroy($hToolTip4) Func _GUIToolTip_CreateToolTip($hwnd, $sTitle, $sText, $iStyle = Default, $iX = -1, _ $iY = -1, $iFlags = 0, $iColTxt = Default, $iColBk = Default, $iIcon = 0) ;Author: rover and et al. ;$iIcon [optional] Pre-defined icon to show next to the title: Requires a title. ;0 = No icon, 1 = Info icon, 2 = Warning icon, 3 = Error Icon ; From _GUIToolTip_SetTitle() remarks ; As of Windows XP SP2 and later, $iIcon can contain an HICON value. ; Any value greater than 3 is assumed to be an HICON. Local Const $CW_USEDEFAULT = 0x80000000 If Not IsHWnd($hwnd) Or IsKeyword($hwnd) Then $hwnd = 0 If IsKeyword($iX) Or $iX < 0 Or Not IsNumber($iX) Then $iX = 0 If IsKeyword($iY) Or $iY < 0 Or Not IsNumber($iY) Then $iY = 0 If IsKeyword($iFlags) Or $iFlags <= 0 Or Not IsNumber($iFlags) Then $iFlags = 32 + 8 + 1 If IsKeyword($iStyle) Then $iStyle = BitOR($TTS_BALLOON, $TTS_CLOSE) Local $hTip = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, "tooltips_class32", "", _ BitOR($iStyle, $TTS_ALWAYSTIP, $TTS_NOPREFIX), _ $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $hWnd) _GUIToolTip_AddTool($hTip, $hwnd, $sText, $hwnd, 0, 0, 0, 0, $iFlags, 0) If Number($iIcon) > 3 And @OSVersion = "WIN_XP" And Number(StringRight(@OSServicePack, 1)) < 2 Then $iIcon = 0 If Not IsNumber($iIcon) Or $iIcon < 0 Then $iIcon = 0 _GUIToolTip_SetTitle($hTip, $sTitle, $iIcon) If IsInt($iColTxt) Then _GUIToolTip_SetTipTextColor($hTip, $iColTxt) If IsInt($iColBk) Then _GUIToolTip_SetTipBkColor($hTip, $iColBk) If $hwnd = 0 Or $hwnd = -1 Or IsKeyword($hwnd) Then _GUIToolTip_TrackPosition($hTip, $iX, $iY) _GUIToolTip_TrackActivate($hTip, True, $hwnd, $hwnd) Return $hTip EndIf Return $hTip EndFunc ;==>_GUIToolTip_CreateToolTip Also found an alternative UDF by rasim: ToolTip_UDF Woowww, Thanks alot. This is pretty much exactly what I need =D. one thing though, I don't know if this is merely an bug on my end or what, but the text and background color parameters in his function won't change the text or background color. The values he has inserted do not work and neither do the ones I tried. Any ideas? Is that value supposed to be a hexadecimal? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 27, 2010 Share Posted May 27, 2010 I don't know if this is merely an bug on my end or what, but the text and background color parameters in his function won't change the text or background color. The values he has inserted do not work and neither do the ones I tried. Any ideas? Is that value supposed to be a hexadecimal?It is a 24bit RGB value, but it should be converted to Microsoft COLORREF, or BGR when actually sent in the TTM_SETTIPBKCOLOR message. It doesn't look like the old _GUIToolTip_SetTipBkColor() function makes that conversion, but it is an old PaulIA function that might date from the times when AutoIt functions in general were BGR by default. The alternate UDF by rasim does a conversion from RGB to BGR in its _ToolTip_SetBkColor().Neither the GuiToolTip.au3, nor rasim's UDF produce different background colors for me. That leads me to believe you have to turn off a default theme or style selection before it will take. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JohnnyThrash Posted May 27, 2010 Author Share Posted May 27, 2010 (edited) It is a 24bit RGB value, but it should be converted to Microsoft COLORREF, or BGR when actually sent in the TTM_SETTIPBKCOLOR message. It doesn't look like the old _GUIToolTip_SetTipBkColor() function makes that conversion, but it is an old PaulIA function that might date from the times when AutoIt functions in general were BGR by default. The alternate UDF by rasim does a conversion from RGB to BGR in its _ToolTip_SetBkColor().Neither the GuiToolTip.au3, nor rasim's UDF produce different background colors for me. That leads me to believe you have to turn off a default theme or style selection before it will take.Okay, so I disabled the vista theme and chose windows classic. I tried the balloon...it worked. Which is good...but I'll need it to work with any theme turned on. I hope I'm not being irritating. But were you suggesting that there is a way to disable theme styling on the balloon itself? If that were the case this would be perfect.EDIT: Ehh, nevermind. No matter what the background was black. Also setting the text color was odd too. I changed it to several values, some in hexadecimal and some in BGR they all came out either burnt orange or dark gray. And oddly enough some of the color values messed up the positioning on the balloon. Edited May 27, 2010 by JohnnyThrash Link to comment Share on other sites More sharing options...
ResNullius Posted May 28, 2010 Share Posted May 28, 2010 But were you suggesting that there is a way to disable theme styling on the balloon itself? If that were the case this would be perfect.Does this help #798720 ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2010 Share Posted May 28, 2010 (edited) Okay, so I disabled the vista theme and chose windows classic. I tried the balloon...it worked. Which is good...but I'll need it to work with any theme turned on. I hope I'm not being irritating. But were you suggesting that there is a way to disable theme styling on the balloon itself? If that were the case this would be perfect.The post ResNullius linked to shows how to disable the theme for a particular handle, which could be either a window or a control, I believe. EDIT: Ehh, nevermind. No matter what the background was black. Also setting the text color was odd too. I changed it to several values, some in hexadecimal and some in BGR they all came out either burnt orange or dark gray. And oddly enough some of the color values messed up the positioning on the balloon.I'd like to see examples of the values you tried. There is no such thing as BGR, RGB, Binary, Decimal, or Hexadecimal in the actual value used. It's a 32-bit integer, regardless. Those are just different ways of presenting the data for human viewing. BGR and RGB do put the colors in different bit locations, but Hexadecimal is just a convenient format for humans to read either one. This modification of Rover's example works for me. It uses a modification of ResNullius' function to achieve the color changes, and Siao's conversion of the colors from RGB to BGR: expandcollapse popup#include <GuiToolTip.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $iIconID = 43 If @OSVersion == "WIN_VISTA" Then $iIconID = 51 Global $hIcon = _WinAPI_LoadShell32Icon($iIconID) Global $hToolTip1 = _GUIToolTip_CreateToolTip(0, "Close tooltip to exit", "ToolTip 1", Default, _ @DesktopWidth / 2, @DesktopHeight / 2 - 120, 2 + 16, 0xFF00, 0xFF0000, $hIcon) _SetTipColors($hToolTip1, 0xFF00, 0xFF0000) Global $hToolTip2 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 2", 0, _ @DesktopWidth / 2, @DesktopHeight / 2, 2 + 16, 0xFF0000, 0x00FF00, $hIcon) _SetTipColors($hToolTip2, 0xFF0000, 0x00FF00) Global $hToolTip3 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 3", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 75, 2 + 16, 0, 0xFFFFFF) _SetTipColors($hToolTip3, 0, 0xFFFFFF) Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 130, 32 + 16, 0xFFFFFF, 0) ; _SetTipColors($hToolTip4, 0xFFFFFF, 0) _WinAPI_DestroyIcon($hIcon) Do Sleep(10) Local $aPos = MouseGetPos() _GUIToolTip_TrackPosition($hToolTip4, $aPos[0] + 10, $aPos[1] + 20) _GUIToolTip_UpdateTipText($hToolTip4, 0, 0, "X: " & $aPos[0] & " Y: " & $aPos[1]) Until BitAND(WinGetState($hToolTip1), 2) <> 2 ; exit if Tooltip not visible (closed by balloon tip button) _GUIToolTip_Destroy($hToolTip1) _GUIToolTip_Destroy($hToolTip2) _GUIToolTip_Destroy($hToolTip3) _GUIToolTip_Destroy($hToolTip4) Func _GUIToolTip_CreateToolTip($hWnd, $sTitle, $sText, $iStyle = Default, $iX = -1, _ $iY = -1, $iFlags = 0, $iColTxt = Default, $iColBk = Default, $iIcon = 0) ;Author: rover and et al. ;$iIcon [optional] Pre-defined icon to show next to the title: Requires a title. ;0 = No icon, 1 = Info icon, 2 = Warning icon, 3 = Error Icon ; From _GUIToolTip_SetTitle() remarks ; As of Windows XP SP2 and later, $iIcon can contain an HICON value. ; Any value greater than 3 is assumed to be an HICON. Local Const $CW_USEDEFAULT = 0x80000000 If Not IsHWnd($hWnd) Or IsKeyword($hWnd) Then $hWnd = 0 If IsKeyword($iX) Or $iX < 0 Or Not IsNumber($iX) Then $iX = 0 If IsKeyword($iY) Or $iY < 0 Or Not IsNumber($iY) Then $iY = 0 If IsKeyword($iFlags) Or $iFlags <= 0 Or Not IsNumber($iFlags) Then $iFlags = 32 + 8 + 1 If IsKeyword($iStyle) Then $iStyle = BitOR($TTS_BALLOON, $TTS_CLOSE) Local $hTip = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, "tooltips_class32", "", _ BitOR($iStyle, $TTS_ALWAYSTIP, $TTS_NOPREFIX), _ $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $hWnd) _GUIToolTip_AddTool($hTip, $hWnd, $sText, $hWnd, 0, 0, 0, 0, $iFlags, 0) If Number($iIcon) > 3 And @OSVersion = "WIN_XP" And Number(StringRight(@OSServicePack, 1)) < 2 Then $iIcon = 0 If Not IsNumber($iIcon) Or $iIcon < 0 Then $iIcon = 0 _GUIToolTip_SetTitle($hTip, $sTitle, $iIcon) If IsInt($iColTxt) Then _GUIToolTip_SetTipTextColor($hTip, $iColTxt) If IsInt($iColBk) Then _GUIToolTip_SetTipBkColor($hTip, $iColBk) If $hWnd = 0 Or $hWnd = -1 Or IsKeyword($hWnd) Then _GUIToolTip_TrackPosition($hTip, $iX, $iY) _GUIToolTip_TrackActivate($hTip, True, $hWnd, $hWnd) Return $hTip EndIf Return $hTip EndFunc ;==>_GUIToolTip_CreateToolTip Func _SetTipColors($hWnd, $iBkColor, $iTxtColor) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hWnd, "wstr", "", "wstr", "") DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $TTM_SETTIPBKCOLOR, "int", _RGB2BGR($iBkColor), "int", 0) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $TTM_SETTIPTEXTCOLOR, "int", _RGB2BGR($iTxtColor), "int", 0) EndFunc ;==>_SetTipColors ; #FUNCTION# ============================================================= ; Name............: RGB2BGR ; Description.....: Convert a RGB color mode to a BGR color mode ; Syntax..........: RGB2BGR($sColor) ; Parameter(s)....: $sColor - The color in HEX value ; Return value(s).: Converted color in HEX value ; Requirement(s)..: ; Note(s).........: ; Author(s).......: Siao ; ======================================================================== Func _RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc ;==>_RGB2BGR Edited May 28, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
KaFu Posted May 28, 2010 Share Posted May 28, 2010 (edited) This modification of Rover's example works for me. It uses a modification of ResNullius' function to achieve the color changes, and Siao's conversion of the colors from RGB to BGR...Nice combo, works on Win7, well done Edited May 28, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
JohnnyThrash Posted June 1, 2010 Author Share Posted June 1, 2010 The post ResNullius linked to shows how to disable the theme for a particular handle, which could be either a window or a control, I believe. I'd like to see examples of the values you tried. There is no such thing as BGR, RGB, Binary, Decimal, or Hexadecimal in the actual value used. It's a 32-bit integer, regardless. Those are just different ways of presenting the data for human viewing. BGR and RGB do put the colors in different bit locations, but Hexadecimal is just a convenient format for humans to read either one. This modification of Rover's example works for me. It uses a modification of ResNullius' function to achieve the color changes, and Siao's conversion of the colors from RGB to BGR: expandcollapse popup#include <GuiToolTip.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $iIconID = 43 If @OSVersion == "WIN_VISTA" Then $iIconID = 51 Global $hIcon = _WinAPI_LoadShell32Icon($iIconID) Global $hToolTip1 = _GUIToolTip_CreateToolTip(0, "Close tooltip to exit", "ToolTip 1", Default, _ @DesktopWidth / 2, @DesktopHeight / 2 - 120, 2 + 16, 0xFF00, 0xFF0000, $hIcon) _SetTipColors($hToolTip1, 0xFF00, 0xFF0000) Global $hToolTip2 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 2", 0, _ @DesktopWidth / 2, @DesktopHeight / 2, 2 + 16, 0xFF0000, 0x00FF00, $hIcon) _SetTipColors($hToolTip2, 0xFF0000, 0x00FF00) Global $hToolTip3 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 3", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 75, 2 + 16, 0, 0xFFFFFF) _SetTipColors($hToolTip3, 0, 0xFFFFFF) Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _ @DesktopWidth / 2, @DesktopHeight / 2 + 130, 32 + 16, 0xFFFFFF, 0) ; _SetTipColors($hToolTip4, 0xFFFFFF, 0) _WinAPI_DestroyIcon($hIcon) Do Sleep(10) Local $aPos = MouseGetPos() _GUIToolTip_TrackPosition($hToolTip4, $aPos[0] + 10, $aPos[1] + 20) _GUIToolTip_UpdateTipText($hToolTip4, 0, 0, "X: " & $aPos[0] & " Y: " & $aPos[1]) Until BitAND(WinGetState($hToolTip1), 2) <> 2 ; exit if Tooltip not visible (closed by balloon tip button) _GUIToolTip_Destroy($hToolTip1) _GUIToolTip_Destroy($hToolTip2) _GUIToolTip_Destroy($hToolTip3) _GUIToolTip_Destroy($hToolTip4) Func _GUIToolTip_CreateToolTip($hWnd, $sTitle, $sText, $iStyle = Default, $iX = -1, _ $iY = -1, $iFlags = 0, $iColTxt = Default, $iColBk = Default, $iIcon = 0) ;Author: rover and et al. ;$iIcon [optional] Pre-defined icon to show next to the title: Requires a title. ;0 = No icon, 1 = Info icon, 2 = Warning icon, 3 = Error Icon ; From _GUIToolTip_SetTitle() remarks ; As of Windows XP SP2 and later, $iIcon can contain an HICON value. ; Any value greater than 3 is assumed to be an HICON. Local Const $CW_USEDEFAULT = 0x80000000 If Not IsHWnd($hWnd) Or IsKeyword($hWnd) Then $hWnd = 0 If IsKeyword($iX) Or $iX < 0 Or Not IsNumber($iX) Then $iX = 0 If IsKeyword($iY) Or $iY < 0 Or Not IsNumber($iY) Then $iY = 0 If IsKeyword($iFlags) Or $iFlags <= 0 Or Not IsNumber($iFlags) Then $iFlags = 32 + 8 + 1 If IsKeyword($iStyle) Then $iStyle = BitOR($TTS_BALLOON, $TTS_CLOSE) Local $hTip = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, "tooltips_class32", "", _ BitOR($iStyle, $TTS_ALWAYSTIP, $TTS_NOPREFIX), _ $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $hWnd) _GUIToolTip_AddTool($hTip, $hWnd, $sText, $hWnd, 0, 0, 0, 0, $iFlags, 0) If Number($iIcon) > 3 And @OSVersion = "WIN_XP" And Number(StringRight(@OSServicePack, 1)) < 2 Then $iIcon = 0 If Not IsNumber($iIcon) Or $iIcon < 0 Then $iIcon = 0 _GUIToolTip_SetTitle($hTip, $sTitle, $iIcon) If IsInt($iColTxt) Then _GUIToolTip_SetTipTextColor($hTip, $iColTxt) If IsInt($iColBk) Then _GUIToolTip_SetTipBkColor($hTip, $iColBk) If $hWnd = 0 Or $hWnd = -1 Or IsKeyword($hWnd) Then _GUIToolTip_TrackPosition($hTip, $iX, $iY) _GUIToolTip_TrackActivate($hTip, True, $hWnd, $hWnd) Return $hTip EndIf Return $hTip EndFunc ;==>_GUIToolTip_CreateToolTip Func _SetTipColors($hWnd, $iBkColor, $iTxtColor) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hWnd, "wstr", "", "wstr", "") DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $TTM_SETTIPBKCOLOR, "int", _RGB2BGR($iBkColor), "int", 0) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $TTM_SETTIPTEXTCOLOR, "int", _RGB2BGR($iTxtColor), "int", 0) EndFunc ;==>_SetTipColors ; #FUNCTION# ============================================================= ; Name............: RGB2BGR ; Description.....: Convert a RGB color mode to a BGR color mode ; Syntax..........: RGB2BGR($sColor) ; Parameter(s)....: $sColor - The color in HEX value ; Return value(s).: Converted color in HEX value ; Requirement(s)..: ; Note(s).........: ; Author(s).......: Siao ; ======================================================================== Func _RGB2BGR($iColor) Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF) EndFunc ;==>_RGB2BGR Thanks alot! Between you and the other help I've gotten I've been able to achieve my desired effect! Also I made a function that might be useful to some people. It's just to simply convert hexadecimal values to ColorRef Format. Func _HexToColorRef($Hex) $Hex=StringRight($Hex, 6) $R=StringLeft($Hex, 2) $G=StringMid($Hex, 3, 2) $B=StringRight($Hex, 2) $Colorref=Number("0x00" & $B & $G & $R) Return $Colorref EndFunc 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