 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Do you think AutoHotkey should have that features/function internally? |
| Yes |
|
33% |
[ 4 ] |
| Yes, even more ToolTip features please |
|
33% |
[ 4 ] |
| No, I don't need them |
|
0% |
[ 0 ] |
| No, to complex to use |
|
25% |
[ 3 ] |
| No |
|
8% |
[ 1 ] |
|
| Total Votes : 12 |
|
| Author |
Message |
ruespe
Joined: 17 Jun 2008 Posts: 243
|
Posted: Thu May 14, 2009 7:15 am Post subject: |
|
|
| ruespe nli wrote: | Posted: Wed May 13, 2009 5:57 pm Post subject:
It seems, as If X and Y don't work any more. When I include them, no tooltip is shown. When I delete them, ToolTip is shown near mousepointer
Should work now . |
Sorry, but doesn't. Try this | Code: | | ToolTip(1,"This is a usual tooltip`, click to change","","x100 y200") |
Ok, found it. One line ist missing
| Code: | TTM_TRACKPOSITION:
If x is integer
If y is integer
{
DllCall("SendMessage", "Uint", hWnd, "Uint", 1042, "Uint", 0, "Uint", (x & 0xFFFF)|(y & 0xFFFF)<<16)
DllCall("SendMessage", "Uint", hWnd, "Uint", 1041, "Uint", 1, "Uint", &TOOLINFO_%ID%) ; TTM_TRACKACTIVATE
Return
}
|
_________________ Greetings
Rog |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Thu May 14, 2009 2:23 pm Post subject: Re: [REQ] Example: Tooltip hovering over TrayBar |
|
|
Updated version in top post
- x100 y200, positions work now. Thanks ruespe
- flickering might be fixed now, see example
- In example below you can update the title and icon and mouse position much quicker
| Code: | ToolTip(99,"`nJust an example ToolTip following mouse movements"
,"This ToolTip will be destroyed in " . 4 . " Seconds","o1 I" . GetAssociatedIcon(A_AhkPath) . " B0000FF FFFFFFF")
Start:=A_TickCount
While, end < 3
{
ToolTip(99,"","This ToolTip will be destroyed in " . 4 - Round(end:=(A_TickCount-Start)/1000) . " Seconds","I" . GetAssociatedIcon(A_AhkPath))
}
ToolTip(99,"") |
| Drugwash wrote: | Incidentally, few days ago I stumbled into an interesting couple of functions that I needed for one of my toys - hopefully you find them useful:
|
Thanks Drugwash, but unfortunately I could not get the to work, have you got an example?
| hoppfrosch wrote: | Could you please give an example to add a tooltip to the traybar?
I already tried the following, but didn't succeed
| Code: | ControlGet, Tray_hWnd, hWnd,, TrayNotifyWnd1 , ahk_class Shell_TrayWnd
ToolTip(6,"This is a ToolTip with Title and close button","Welcome","C1 D5 P" . Tray_hWnd)
|
|
As far as I understand you cannot associate a ToolTip to a window or control of different program?!? _________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Thu May 14, 2009 7:12 pm Post subject: |
|
|
| Quote: | | have you got an example? | Unfortunately not, just cropped them up some time ago and never got around to actually test them. May need something extra or the syntax could need tweaking. Got so much on my plate that I might choke.
Oh, the flickering is almost gone - dramatic improvement! Danke sehr!  |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Thu May 14, 2009 7:16 pm Post subject: |
|
|
Tried this with the latest version but I think this problem was occurring on earlier versions. I just didn't know what was happening.
Found a problem. With the exception of button objects, Tooltips assigned to most GUI objects disappear and never return once the object is put into focus.
Thanks for your help. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Thu May 14, 2009 8:24 pm Post subject: |
|
|
| Drugwash wrote: | | Oh, the flickering is almost gone - dramatic improvement! Danke sehr! |
I'm glad it got better
| jballi wrote: | Tried this with the latest version but I think this problem was occurring on earlier versions. I just didn't know what was happening.
Found a problem. With the exception of button objects, Tooltips assigned to most GUI objects disappear and never return once the object is put into focus.
Thanks for your help. |
This is normal ToolTip behaviour.
But you can change it using D option, something like this.
Note 1800 is maximum, = 30 minutes.
| Code: | | ToolTip(1,"test","","D18009 P" . hwnd) |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Thu May 14, 2009 9:59 pm Post subject: |
|
|
| HotKeyIt wrote: | This is normal ToolTip behaviour.
But you can change it using D option, something like this.
Note 1800 is maximum, = 30 minutes.
| Code: | | ToolTip(1,"test","","D18009 P" . hwnd) |
|
This is not normal tooltip behavior. Just run any application with tooltips. The tooltip will display regardless of whether the object is in focus or not. In addition, the "D" option is only useful for tooltips that are not attached to a GUI object. |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Fri May 15, 2009 12:56 am Post subject: |
|
|
Total Commander, eMule, SlimBrowser, FreeRAM XP Pro - 4 applications that I happen to run at this moment. None of them shows tooltips when not focused. Hard to guess what the standard is, when devs can do either way, at their convenience.
Probably would be better to have this configurable, if possible. |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Fri May 15, 2009 2:51 am Post subject: |
|
|
| Drugwash wrote: | Total Commander, eMule, SlimBrowser, FreeRAM XP Pro - 4 applications that I happen to run at this moment. None of them shows tooltips when not focused. Hard to guess what the standard is, when devs can do either way, at their convenience.
Probably would be better to have this configurable, if possible. |
I don't have Total Commander, eMule, FreeRAM XP Pro - 4 but I happen to have a copy of SlimBrowser. Tooltips show regardless of whether a GUI object has input focus or not. Try any standard OS app like Paint, Wordpad, Disk Defragmenter, etc., etc, or any Microsoft app like Word, Excel, etc. Tooltips all work the same. If a tooltip is assigned to a GUI object, it will display regardless of whether the object has input focus or not.
The Tooltip function works the same way but with one problem. If a non-Button GUI object gets input focus, the Tooltip for that object goes away and never returns. This is a problem. I can't imagine anyone that wants the function to operate in this manner.
Them be my thoughts... |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Fri May 15, 2009 5:11 am Post subject: |
|
|
| jballi wrote: | | Drugwash wrote: | Total Commander, eMule, SlimBrowser, FreeRAM XP Pro - 4 applications that I happen to run at this moment. None of them shows tooltips when not focused. Hard to guess what the standard is, when devs can do either way, at their convenience.
Probably would be better to have this configurable, if possible. |
I don't have Total Commander, eMule, FreeRAM XP Pro - 4 but I happen to have a copy of SlimBrowser. Tooltips show regardless of whether a GUI object has input focus or not. Try any standard OS app like Paint, Wordpad, Disk Defragmenter, etc., etc, or any Microsoft app like Word, Excel, etc. Tooltips all work the same. If a tooltip is assigned to a GUI object, it will display regardless of whether the object has input focus or not.
The Tooltip function works the same way but with one problem. If a non-Button GUI object gets input focus, the Tooltip for that object goes away and never returns. This is a problem. I can't imagine anyone that wants the function to operate in this manner.
Them be my thoughts... |
Hi jballi
I am not quite sure if I get you right?
Have you got an app that associates only 1 button or control to a ToolTip?
Otherwise you cannot check?!?
If 1 ToolTip is assigned to several controls, ToolTip will shown again.
If 1 ToolTip is assigned to 1 control, It will not be shown again after being hidden by the system.
Does the ToolTip not continue to show for you in this example?
| Code: | text=Willkommen zu ToolTip()|ToolTip mit erweiterten funktionen|I love it!|ToolTip Rocks :)|Viel Spass Damit.|Versucht AutoHotFile
title=Hallo|Wilkommen|AutoHotkey|ToolTip|Enjoy|AutoHotFile
StringSplit,text,text,|
StringSplit,title,title,|
Gui,+LastFound
hwnd.=WinExist()
Loop 6
{
Gui,Add,Edit,xs y+1,Button %A_Index%
ToolTip("Edit" . A_Index,text%A_Index%,title%A_Index%,"P" . hwnd . " I1 B0000FF FFFFFFF D1800 Aedit" . A_Index)
}
Gui,Show,AutoSize,ToolTips
Return
GuiClose:
ExitApp |
or here
| Code: | Gui,+LastFound
Gui,Add,Edit,,Edit1
Gui,Add,ListView,r10 w300, Test
ToolTip(1,"test","title","I1 Aedit1 P" . WinExist())
ToolTip(1,"test","title","I1 ASyslistview321 P" . WinExist())
Gui, show
Return
GuiClose:
ExitApp |
Here some references, possibly you can take a look, I could not find anything more than that: http://msdn.microsoft.com/en-us/library/bb760404(VS.85).aspx
| TTDT_RESHOW wrote: |
Set the amount of time it takes for subsequent ToolTip windows to appear as the pointer moves from one tool to another. To return the reshow delay time to its default value, set iTime to -1. |
So this is only supported from one to another tool not to the same tool. _________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Fri May 15, 2009 9:35 am Post subject: |
|
|
| Quote: | | I happen to have a copy of SlimBrowser. Tooltips show regardless of whether a GUI object has input focus or not. Try any standard OS app like Paint, Wordpad, Disk Defragmenter, etc., etc, or any Microsoft app like Word, Excel, etc. Tooltips all work the same. | Ah, I totally misunderstood you - you were reffering to a focused (or not) object, while I was referring to a focused (or not) application window. Sorry.
You are right in this case: objects should show tooltips regardless of whether they are focused or not, unless the main window loses focus.
So to rephrase your report with a real example, you say if you click i.e. a checkbox - thus focusing it - the associated tooltip will only show once and then never again? Or does the tooltip only show when the checkbox is not focused and after you click it it doesn't show at all?
I hope the example is clear enough for anyone's understanding and again apologies for the misunderstanding. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Fri May 15, 2009 11:44 am Post subject: |
|
|
Hello all,
I'm pleased to announce some new options and little smarter code
I will not include it in the top post until confirmed to works as it should
| Quote: | V1 - show ToolTip when pointing mouse on a control even if Parent window is not active
L1 - Parse links, links have to be enclosed in <a></a>, e.g. <a>http://www.autohotkey.com</a> (no linkclick yet ) |
In this example all ToolTips use V option.
Edit:
Trying to remove flickering
New rewritten function: http://www.autohotkey.com/forum/viewtopic.php?p=269333#269333 _________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun 
Last edited by HotKeyIt on Fri May 15, 2009 10:53 pm; edited 5 times in total |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Fri May 15, 2009 12:24 pm Post subject: |
|
|
Thanks.
Additionaly, it would be good to provide option to move toltip without recreating it. Your "mouse following tooltip" flickers a lot. _________________
 |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Fri May 15, 2009 12:41 pm Post subject: |
|
|
Yep, the first tooltip flickers again; it's been working almost correctly in previous version though.
Details: in all versions except previous version, it used to flicker badly even when the cursor was not moving. It did flicker (thought not very badly) when moving the cursor.
The Link example tooltip in this version remains on screen indefinitely.
The V option works fine in the example above.
Shouldn't the links be formed HTML-like < a href=actual link >description< /a > ? Would be a lot easier to point tooltips to real web pages/forms. Unless I'm missing the point, in which case I apologize in advance. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Fri May 15, 2009 1:02 pm Post subject: |
|
|
| majkinetor wrote: | Thanks.
Additionaly, it would be good to provide option to move toltip without recreating it. Your "mouse following tooltip" flickers a lot. |
Can you try above again?
| Drugwash wrote: | | The Link example tooltip in this version remains on screen indefinitely. |
Link text can be anything, I though do not know how it works
You can close it but not click it yet  _________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 748 Location: Texas, USA
|
Posted: Fri May 15, 2009 1:38 pm Post subject: |
|
|
Re: Tooltip disappearing and never returning.
Here is an example script that should demonstrate the problem. I've included the Tooltip function from today's post.
When you run the script, notice that tooltips are assigned to all GUI objects. If you click on any (read: most) of the non-button objects, the Tooltip for that object disappears and never returns again. I hope this helps to demonstrate the problem. Thanks for your help.
| Code: | #NoEnv
#SingleInstance Force
;-- Collect hWnd for GUI
Gui,+LastFound
GuiHwnd:=WinExist()
;-- Build GUI
gui -MinimizeBox
gui Add,Button,w150 hwndButton1_hWnd gButton1,Test Button 1
Tip:="Button 1: Press me to change my tooltip"
ToolTip(1,Tip,"","A" . Button1_hWnd . " P" . GuiHwnd)
gui Add,Button,y+0 w150 hwndButton2_hWnd gButton2,Test Button 2
Tip:="Button 2: Press me to turn off the tooltip for this button"
ToolTip(2,Tip,"","A" . Button2_hWnd . " P" . GuiHwnd)
gui Add,Button,y+0 w150 hwndButton3_hWnd gButton3,Test Button 3
Tip=
(ltrim
A Multiline Test Tooltip
2nd line
3rd line
4th line.
Press me to turn off all tooltips
)
ToolTip(3,Tip,"","A" . Button3_hWnd . " P" . GuiHwnd)
gui Add,Checkbox,w150 hwndCheckbox_hWnd,Checkbox Control
Tip:="Tooltip for the Checkbox control"
ToolTip(4,Tip,"","A" . Checkbox_hWnd . " P" . GuiHwnd)
gui Add,Radio,w150 hwndRadio_hWnd,Radio Control
Tip:="Tooltip for the Radio control"
ToolTip(5,Tip,"","A" . Radio_hWnd . " P" . GuiHwnd)
gui Add,Edit,w150 hwndEdit_hWnd,Edit Control
Tip:="Tooltip for the Edit control"
ToolTip(6,Tip,"","A" . Edit_hWnd . " P" . GuiHwnd)
gui Add,Text,w150 hwndText_hWnd gNull,Text Control
Tip=
(ltrim join`s
Tooltip for the Text control.`nNote that the Tooltip for a Text control does
not show unless a g-label for the control is defined.
)
ToolTip(7,Tip,"","A" . Text_hWnd . " P" . GuiHwnd)
gui Add,Picture,w150 h100 hwndPicture_hWnd gnull,Picture.bmp
Tip=
(ltrim join`s
Tooltip for the Picture control.`nNote that the Tooltip for a Picture
control does not show unless a g-label for the control is defined.
)
ToolTip(9,Tip,"","A" . Picture_hWnd . " P" . GuiHwnd)
gui Add,DropDownList,w150 r3 hwndDropDownList_hWnd,DropDownList Control||2|3
Tip:="Tooltip for the DropDownList control"
ToolTip(10,Tip,"","A" . DropDownList_hWnd . " P" . GuiHwnd)
gui Add,ComboBox,w150 r3 hwndComboBox_hWnd,ComboBox Control||2|3
;-- A ComboBox is actually two controls: An Edit control and a Drop-down
; button. Note that handle returned for this control is for the
; drop-down button, not for the Edit control.
Tip=
(ltrim join`s
Tooltip for the drop-down button piece of the ComboBox control.`nNote that
this tip is different than the Edit piece of the control.
)
ToolTip(11,Tip,"","A" . ComboBox_hWnd . " P" . GuiHwnd)
gui Add,ListBox,w150 r3 hwndListBox_hWnd,ListBox Control||2|3
Tip:="Tooltip for the ListBox control"
ToolTip(12,Tip,"","A" . ListBox_hWnd . " P" . GuiHwnd)
gui Add,ListView,w150 h50 hwndListView_hWnd,ListView Control
Tip=
(ltrim join`s
Tooltip for the ListView control.`nNote that this tip is different than
the header piece of the control.
)
ToolTip(13,Tip,"","A" . ListView_hWnd . " P" . GuiHwnd)
gui Add,DateTime,w150 hwndDateTime_hWnd ;,DateTime Control
Tip:="Tooltip for the DateTime control"
ToolTip(14,Tip,"","A" . DateTime_hWnd . " P" . GuiHwnd)
;-- Uncomment this if you want to see the MonthCal control. Works the same as DateTime
;;;;;gui Add,MonthCal,w150 hwndMonthCal_hWnd ;,MonthCal Control
;;;;;Tip:="Tooltip for the MonthCal control"
;;;;;ToolTip(15,Tip,"","A" . MonthCal_hWnd . " P" . GuiHwnd)
gui Add,Progress,w150 hwndProgress_hWnd,65 ;Progress Control
Tip:="Tooltip for the Progress control"
ToolTip(16,Tip,"","A" . Progress_hWnd . " P" . GuiHwnd)
gui Add,Slider,w150 hwndSlider_hWnd,45 ;Slider Control
Tip:="Tooltip for the Slider control"
ToolTip(17,Tip,"","A" . Slider_hWnd . " P" . GuiHwnd)
gui Add,Hotkey,w150 hwndHotkey_hWnd,45 ;Hotkey Control
Tip:="Tooltip for the Hotkey control"
ToolTip(18,Tip,"","A" . Hotkey_hWnd . " P" . GuiHwnd)
gui Add,Edit,w150 h20 hwndEdit2_hWnd,Dummy Edit Control ;-- Used by UpDown control
Tip=
(ltrim join`s
This Edit control was created so that the attached UpDown control could be
demonstrated.
)
ToolTip(19,Tip,"","A" . Edit2_hWnd . " P" . GuiHwnd)
gui Add,UpDown,hwndUpDown_hWnd Range 1-10,5
Tip:="Tooltip for the UpDown control"
ToolTip(20,Tip,"","A" . UpDown_hWnd . " P" . GuiHwnd)
gui Show,,Tooltip Test
;-- Note: The following information cannot be collected until after the window
; has been rendered
;-- Get hWnd to the Edit control piece of the ComboBox
ControlGet EditComboBox_hWnd,hWnd,,Edit2,Tooltip Test
Tip=
(ltrim join`s
Tooltip for the Edit piece of the ComboBox control.`nNote that this tip is
different than the drop-down button piece of this control.
)
ToolTip(11,Tip,"","A" . EditComboBox_hWnd . " P" . GuiHwnd)
;-- Get hWnd to the Edit control piece of the ComboBox
ControlGet ListViewHeader_hWnd,hWnd,,SysHeader321,Tooltip Test
Tip=
(ltrim join`s
Tooltip for the header of the ListView control.`nNote that this tip is
different than the rest of the ListView control.
)
ToolTip(13,Tip,"","A" . ListViewHeader_hWnd . " P" . GuiHwnd)
return
Button1:
ToolTip(1,"Button 1: New Text","","AButton1 P" . GuiHwnd)
return
Button2:
ToolTip(2,"","","AButton2 P" . GuiHwnd)
return
Button3:
ToolTip()
MsgBox 64,ToolTips Cleared,All Tooltips destroyed. %A_Space%
return
Null:
return
GUIClose:
GUIescape:
ExitApp
;;;;;#include ToolTip.ahk
ToolTip(ID="", text=" ", title="",options=""){ ;i x y b f d t o c m p a
static
local option, a, b, c, d, f, i, m, o, p, C_ID, hWnd, #_DetectHiddenWindows
C_ID:=ID
If ((#_DetectHiddenWindows:=A_DetectHiddenWindows)="Off")
DetectHiddenWindows, On
If !ID
{
Loop, Parse, hWndArray, % Chr(2)
If (hwnd:=WinExist("ahk_id " hWndArray%A_LoopField%))
DllCall("DestroyWindow","Uint",hwnd)
hWndArray=
DetectHiddenWindows,%#_DetectHiddenWindows%
Return
}
If options
Loop,Parse,options,%A_Space%
If (option:= SubStr(A_LoopField,1,1))
%option%:= SubStr(A_LoopField,2)
hwnd:=hWndArray%ID%
If (!hwnd and text)
{
hWndArray.=(hWndArray ? Chr(2) : "") . ID
hWnd := DllCall("CreateWindowEx", "Uint", 0x8, "str", "tooltips_class32", "str", "", "Uint", (C ? 80 : 0)+(O ? 115 : 50), "int", 0, "int", 0, "int", 0, "int", 0, "Uint", P, "Uint", 0, "Uint", 0, "Uint", 0) ;param4 0xc3 0x80
hWndArray%ID%:=hwnd
DllCall("SendMessage", "Uint", hWnd, "Uint", 1048, "Uint", 0, "Uint", A_ScreenWidth) ;TTM_SETMAXTIPWIDTH
} else if !(text){
If (title){
Gosub, TTM_SETTITLE
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x41D, "Uint", 0, "Uint", 0) ; TTM_UPDATE
Gosub, TTM_TRACKPOSITION
} else
DllCall("DestroyWindow","Uint",hwnd), hWndArray%ID%:=""
DetectHiddenWindows,%#_DetectHiddenWindows%
Return
}
If P
{
ID := Abs(P)
If A {
If A is not Xdigit
ControlGet,A,Hwnd,,%A%,ahk_id %P%
ID :=Abs(A)
hWndArray.=(hWndArray ? Chr(2) : "") . ID
}
If !TOOLINFO_%ID%
VarSetCapacity(TOOLINFO_%ID%, 40, 0),TOOLINFO_%ID%:=Chr(40)
else
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x405, "Uint", 0, "Uint", &TOOLINFO_%ID%) ; TTM_DELTOOL
Numput(ID,TOOLINFO_%ID%,12)
Numput(1|16,TOOLINFO_%ID%,4)
Numput(P,TOOLINFO_%ID%,8)
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x403, "Uint", 2, "Uint", (D ? D*1000 : -1)) ; TTDT_INITIAL
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x404, "Uint", 0, "Uint", &TOOLINFO_%ID%) ; TTM_ADDTOOL
} else {
If !TOOLINFO_%ID%
VarSetCapacity(TOOLINFO_%ID%, 40, 0),TOOLINFO_%ID%:=Chr(40)
If O
NumPut(0x20,TOOLINFO_%ID%,4)
else
NumPut(0x20|0x80,TOOLINFO_%ID%,4)
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x403, "Uint", 2, "Uint", (D ? D*1000 : -1)) ; TTDT_INITIAL
DllCall("SendMessage", "Uint", hWnd, "Uint", 1028, "Uint", 0, "Uint", &TOOLINFO_%ID%) ; TTM_ADDTOOL
}
If B
Gosub, TTM_SETTIPBKCOLOR
If F
Gosub, TTM_SETTIPTEXTCOLOR
NumPut(&text,TOOLINFO_%ID%,36)
If title
Gosub, TTM_SETTITLE
Gosub, TTM_UPDATETIPTEXT
If (D and !P)
{
A_Timer := A_TickCount, D *= 1000
Gosub, TTM_TRACKPOSITION
Loop
{
Gosub, TTM_TRACKPOSITION
If (A_TickCount - A_Timer > D)
Break
}
DllCall("DestroyWindow","Uint",hwnd), hWndArray%C_ID%:=""
}
If !P
{
Gosub, TTM_TRACKPOSITION
If !C
WinSet, Disable,,ahk_id %hwnd%
If M
WinSet,ExStyle,^0x20,ahk_id %hwnd%
If T
WinSet,Transparent,%T%,ahk_id %hwnd%
}
Return hwnd
TTM_SETTITLE:
title := (StrLen(title) < 96) ? title : ("…" . SubStr(title, -97))
DllCall("SendMessage", "Uint", hWnd, "Uint", 1056, "Uint", I, "Uint", &Title)
Return
TTM_TRACKPOSITION:
If x is integer
If y is integer
{
DllCall("SendMessage", "Uint", hWnd, "Uint", 1042, "Uint", 0, "Uint", (x & 0xFFFF)|(y & 0xFFFF)<<16)
DllCall("SendMessage", "Uint", hWnd, "Uint", 1041, "Uint", 1, "Uint", &TOOLINFO_%ID%) ; TTM_TRACKACTIVATE
Return
}
MouseGetPos, xc,yc
xc+=15,yc+=15
If (x="caret" or y="caret"){
WinGetPos,xw,yw,,,A
If x=caret
{
SysGet,xl,76
SysGet,xr,78
xc:=xw+A_CaretX +1
xc:=(xl>xc ? xl : (xr<xc ? xr : xc))
}
If (y="caret"){
SysGet,yl,77
SysGet,yr,79
yc:=yw+A_CaretY+15
yc:=(yl>yc ? yl : (yr<yc ? yr : yc))
}
}
DllCall("SendMessage", "Uint", hWnd, "Uint", 1042, "Uint", 0, "Uint", (xc & 0xFFFF)|(yc & 0xFFFF)<<16)
DllCall("SendMessage", "Uint", hWnd, "Uint", 1041, "Uint", 1, "Uint", &TOOLINFO_%ID%) ; TTM_TRACKACTIVATE
Return
TTM_SETTIPBKCOLOR:
B := (StrLen(B) < 8 ? "0x" : "") . B
B := ((B&255)<<16)+(((B>>8)&255)<<8)+(B>>16) ; rgb -> bgr
DllCall("SendMessage", "Uint", hWnd, "Uint", 1043, "Uint", B, "Uint", 0)
Return
TTM_SETTIPTEXTCOLOR:
F := (StrLen(F) < 8 ? "0x" : "") . F
F := ((F&255)<<16)+(((F>>8)&255)<<8)+(F>>16) ; rgb -> bgr
DllCall("SendMessage", "Uint", hWnd, "Uint", 1044, "Uint",F & 0xFFFFFF, "Uint", 0)
Return
TTM_UPDATETIPTEXT:
DllCall("SendMessage", "Uint", hWnd, "Uint", 0x40c, "Uint", 0, "Uint", &TOOLINFO_%ID%)
Return
}
MI_ExtractIcon(Filename, IconNumber, IconSize)
{
If A_OSVersion in WIN_VISTA,WIN_2003,WIN_XP,WIN_2000
{
DllCall("PrivateExtractIcons", "Str", Filename, "Int", IconNumber-1, "Int", IconSize, "Int", IconSize, "UInt*", hIcon, "UInt*", 0, "UInt", 1, "UInt", 0, "Int")
If !ErrorLevel
Return hIcon
}
If DllCall("shell32.dll\ExtractIconExA", "Str", Filename, "Int", IconNumber-1, "UInt*", hIcon, "UInt*", hIcon_Small, "UInt", 1)
{
SysGet, SmallIconSize, 49
If (IconSize <= SmallIconSize) {
DllCall("DeStroyIcon", "UInt", hIcon)
hIcon := hIcon_Small
}
Else
DllCall("DeStroyIcon", "UInt", hIcon_Small)
If (hIcon && IconSize)
hIcon := DllCall("CopyImage", "UInt", hIcon, "UInt", 1, "Int", IconSize, "Int", IconSize, "UInt", 4|8)
}
Return, hIcon ? hIcon : 0
}
GetAssociatedIcon(File){
static
sfi_size:=352
local Ext,Fileto,FileIcon,FileIcon#
If not sfi
VarSetCapacity(sfi, sfi_size)
SplitPath, File,,, Ext
if Ext in EXE,ICO,ANI,CUR,LNK
{
If ext=LNK
{
FileGetShortcut,%File%,Fileto,,,,FileIcon,FileIcon#
File:=!FileIcon ? FileTo : FileIcon
}
SplitPath, File,,, Ext
If !(hIcon%Ext%:=MI_ExtractIcon(InStr(File,"`n") ? SubStr(file,1,InStr(file,"`n")-1) : file,FileIcon# ? FileIcon# : 1,32))
hIcon%Ext%:=#_hIcon_3
}
else If !(InStr(hIcons,"|" . Ext . "|")){
If DllCall("Shell32\SHGetFileInfoA", "str", File, "uint", 0, "str", sfi, "uint", sfi_size, "uint", 0x101){
Loop 4
hIcon%Ext% += *(&sfi + A_Index-1) << 8*(A_Index-1)
}
hIcons.= "|" . Ext . "|"
}
return hIcon%Ext%
}
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|