[AHL_L/v2] TT() - Full-blown ToolTip Library
Started by
HotKeyIt
, Nov 23 2010 10:18 PM
197 replies to this topic
Yes for TT I use PTR, the other functions do not so you will need to adapt before testing.
#16
-
Posted 24 January 2011 - 06:29 AM
I got BalloonTip to work, except for some string issues I didn't check out:
I think I also spotted a bug in TT.ahk:
You need to set the return value to "UPTR" in this line:
I think you might also have to set "UPtr" return value for all SendMessage calls, since LRESULT is defined as LONG_PTR.
It's still not working for me after those fixes though. Please check if there are any errors like those I mentioned elsewhere, I only checked for some common occurrences that might need fixing.
#Persistent BalloonTip("This is a BalloonTip Test.") BalloonTip(sText, sTitle = "AutoHotkey") { hWnd := DllCall("CreateWindowEx", "Uint", 0x8, "str", "tooltips_class32", "str", "", "Uint", 0xC3, "int", 0, "int", 0, "int", 0, "int", 0, "Ptr", 0, "Ptr", 0, "Ptr", 0, "Ptr", 0, "Ptr") DllCall("GetCursorPos", "int64P", pt) xCursor := pt << 32 >> 32 ; can be negative yCursor := pt >> 32 ; can be negative hDCScr := DllCall("GetDC", "Ptr", 0, "Ptr") nColor := DllCall("GetPixel", "Ptr", hDCScr, "int", xCursor, "int", yCursor) DllCall("ReleaseDC", "Ptr",0, "Ptr", hDCScr) VarSetCapacity(ti, 28 + A_PtrSize * 3, 0) ti := Chr(28 + A_PtrSize * 3) DllCall("ntdll\RtlFillMemoryUlong", "Ptr", &ti + 4, "Uint", 4, "Uint", 0x20) ; TTF_TRACK NumPut(&sText,&ti,24+A_PtrSize*3) DllCall("SendMessage", "Ptr", hWnd, "Uint", 1028, "Ptr", 0, "Ptr", &ti, "Ptr") ; TTM_ADDTOOL DllCall("SendMessage", "Ptr", hWnd, "Uint", 1041, "Ptr", 1, "Ptr", &ti, "Ptr") ; TTM_TRACKACTIVATE DllCall("SendMessage", "Ptr", hWnd, "Uint", 1042, "Ptr", 0, "Ptr", (xCursor & 0xFFFF)|(yCursor & 0xFFFF)<<16, "Ptr") ; TTM_TRACKPOSITION DllCall("SendMessage", "Ptr", hWnd, "Uint", 1043, "Ptr", nColor, "Ptr", 0, "Ptr") ; TTM_SETTIPBKCOLOR DllCall("SendMessage", "Ptr", hWnd, "Uint", 1044, "Ptr", ~nColor & 0xFFFFFF, "Ptr", 0, "Ptr") ; TTM_SETTIPTEXTCOLOR DllCall("SendMessage", "Ptr", hWnd, "Uint", 1056, "Ptr", 1, "Ptr", &sTitle, "Ptr") ; TTM_SETTITLE ; 0: None, 1:Info, 2: Warning, 3: Error. n > 3: assumed to be an hIcon. DllCall("SendMessage", "Ptr", hWnd, "Uint", 1036, "Ptr", 0, "Ptr", &ti, "Ptr") ; TTM_UPDATETIPTEXT }
I think I also spotted a bug in TT.ahk:
static TOOLINFO="cbSize,uFlags,hwnd,UPTR uId,RECT rect,UPTR hinst,LPTSTR lpszText,UPTR lParam,void *lpReserved"should be
static TOOLINFO="cbSize,uFlags,UPTR hwnd,UPTR uId,RECT rect,UPTR hinst,LPTSTR lpszText,UPTR lParam,void *lpReserved"(found this line 2 times)
HWND_TOPMOST=0xffffffffmight also be invalid on x64 systems? Most likely not, but I don't know.
You need to set the return value to "UPTR" in this line:
T.HWND := DllCall("CreateWindowEx", "UInt", (ClickTrough?0x20:0)|0x8, "str", "tooltips_class32", "UPTR", 0 , "UInt",0x80000000|(Style?0x100:0)|(NOFADE?0x20:0)|(NoAlimate?0x10:0)|NOPREFIX+1?(NOPREFIX?0x2:0x2):0x2|(AlwaysTip?0x1:0)|(ParseLinks?0x1000:0)|(CloseButton?0x80:0)|(Balloon?0x40:0) , "int",0x80000000,"int",0x80000000,"int",0x80000000,"int",0x80000000, "UPTR",Parent?Parent:0,"UPTR",0,"UPTR",0,"UPTR",0)
T.HWND := DllCall("CreateWindowEx", "UInt", (ClickTrough?0x20:0)|0x8, "str", "tooltips_class32", "UPTR", 0 , "UInt",0x80000000|(Style?0x100:0)|(NOFADE?0x20:0)|(NoAlimate?0x10:0)|NOPREFIX+1?(NOPREFIX?0x2:0x2):0x2|(AlwaysTip?0x1:0)|(ParseLinks?0x1000:0)|(CloseButton?0x80:0)|(Balloon?0x40:0) , "int",0x80000000,"int",0x80000000,"int",0x80000000,"int",0x80000000, "UPTR",Parent?Parent:0,"UPTR",0,"UPTR",0,"UPTR",0, "UPtr")
I think you might also have to set "UPtr" return value for all SendMessage calls, since LRESULT is defined as LONG_PTR.
It's still not working for me after those fixes though. Please check if there are any errors like those I mentioned elsewhere, I only checked for some common occurrences that might need fixing.
#17
-
Posted 24 January 2011 - 07:23 PM
Many thanks fragman, I will check out on weekend and get back
#18
-
Posted 24 January 2011 - 09:17 PM
I have done some changes and uploaded new TT.ahk (unfortunately I cannot test now).
Can you please try again?
Links might not work, please test as well
Can you please try again?
Links might not work, please test as well
#19
-
Posted 24 January 2011 - 10:10 PM
I now saw the first and second tooltip. Clicking the links didn't do anything, clicking the close button closes it but doesn't proceed.
#20
-
Posted 24 January 2011 - 10:21 PM
Right, can you try changing
[color=red]TT_OnMessage[/color](wParam,lParam,msg,hwnd){ static TTN_FIRST:=0xfffffdf8, @:=TT(9223372036854775808) ;Get main object that holds all ToolTips Loop 4 m += *(lParam + [color=red]16[/color] + A_Index-1) << [color=red]16[/color]*(A_Index-1) m:=TTN_FIRST-m If m not between 1 and 3 Return Loop 4 p += *(lParam + 0 + A_Index-1) << [color=red]16[/color]*(A_Index-1) If (m=3) Loop 4 option += *(lParam + [color=red]32[/color] + A_Index-1) << [color=red]16[/color]*(A_Index-1)
#21
-
Posted 24 January 2011 - 10:47 PM
Thanks a lot...
Can be icon a gif or png file?
Seems to work with square png, but it strentch to 16x16
With not "not-square" 40KB gif crash
Do you know if can be possible to paint the original size file image ? That s mean a photo user (not a 16x16).
Thanks in advance
#24
-
Posted 01 February 2011 - 05:42 PM
Any progress? Do you happen to know how to modify the old ToolTip function to get TrayTips working? There's something wrong with the RemoteBuf usage, but I couldn't work it out.
#25
-
Posted 02 February 2011 - 06:58 PM
@segalion - The function is build the way that associated icon for a file is shown unless it is ico, exe, dll...
You can show any picture, but you need to load it and pass hBitmap.
It is also possible to load a big picture by using margin and loading a picture same way as you do on a Gui (ahk c++ code).
@fragman - I do not have a 64-bit pc now to test, anyway that is what I have so far, can you try that TT.ahk.
You can show any picture, but you need to load it and pass hBitmap.
It is also possible to load a big picture by using margin and loading a picture same way as you do on a Gui (ahk c++ code).
@fragman - I do not have a 64-bit pc now to test, anyway that is what I have so far, can you try that TT.ahk.
#26
-
Posted 02 February 2011 - 11:00 PM
The struct code you pasted there is still crashing. Using the struct code you pasted earlier it works like before, the tooltips show but it's not receiving the close message (or not properly interpreting it).
Btw, for testing x64 you could download a Win7 image from MS, I think they host one somewhere, and run it in a virtual machine. That is, if 60 days are enough
Btw, for testing x64 you could download a Win7 image from MS, I think they host one somewhere, and run it in a virtual machine. That is, if 60 days are enough
#27
-
Posted 03 February 2011 - 07:55 AM
Thanks for patience, Struct() now fully supports 64-bit (thanks Lexikos).
Also TT() should be working fine now.
Also TT() should be working fine now.
#28
-
Posted 05 February 2011 - 10:46 PM
@segalion - The function is build the way that associated icon for a file is shown unless it is ico, exe, dll...
You can show any picture, but you need to load it and pass hBitmap.
It is also possible to load a big picture by using margin and loading a picture same way as you do on a Gui (ahk c++ code).
Hello HotKeyIt, Sorry but I dont understand how I could load the picture and get the hBitmap, put margin options and then use TT with it. Please could you make an example?. Can it be possible only with TT lib and ahk code?
I´ve read this post...
<!-- m -->http://www.autohotke...pic.php?t=67245<!-- m -->
and seem that there are code inside to make the resize
... DllCall( "gdiplus\GdipCreateBitmapFromStream", UInt,pStream, UIntP,pBitmap ) DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream ) ;make a new bitmap and size it up pBitmapResized := Gdip_CreateBitmap(wsize, hsize) G := Gdip_GraphicsFromImage(pBitmapResized) Gdip_SetInterpolationMode(G, 7) ;fill our new bitmap with a solid color pBrush := Gdip_BrushCreateSolid(backgound) Gdip_FillRectangle(G, pBrush, 0, 0, wsize, hsize) ;scale the bitmap width := Gdip_GetImageWidth(pBitmap) height := Gdip_GetImageHeight(pBitmap) hratio := Floor(wsize *(height/width)) wratio := Floor(hsize*(width/height)) if (width>height) { newHeight:=hratio newWidth:=wsize } else if (width<height) { newWidth:=wratio newHeight:=hsize } else if (width=height) { newWidth:=wsize newHeight:=hsize } ;spit out a resized bitmap on top of that new bitmap Gdip_DrawImage(G, pBitmap, 0, 0,newWidth,newHeight) hBitmap:=Gdip_CreateHBITMAPFromBitmap(pBitmapResized) ...
But I dont have skills to do that...
Could be great to have w and h options for the icon... in TT funtion.
Thanks a lot.
#30
-
Posted 07 February 2011 - 03:37 PM