1

Тема: AHK: стиль или тип balloon tooltip

Добрый вечер. Помогите пожалуйста.
Нашел вот такой код для создания balloon tooltip:

BalloonTip("This is a`t`tBalloonTip`tTest.`nThis is a BalloonTip Test.", "BalloonTip`t-`tAHK, AHK_L compatible", "I=1 Y=200")
BalloonTip("This is a`t`tBalloonTip`tTest.`nThis is a BalloonTip Test.", "BalloonTip`t-`tAHK, AHK_L compatible", "I=1 Y=400 Q=0 W=1")
ExitApp

;================================================================================
BalloonTip(sText, sTitle="BalloonTip", Options="") { ;		BalloonTip  -  AHK, AHK_L compatible
	; *****************************************************************************************************************************
	;	Options: Space separated string of options bellow like (X=10 Y=10 I=1 T=2000 C=FFFFFF). ( Default Options in [] ).
	;	X= x position [mouse x]
	;	Y= y position [mouse y]
	;	T= Timeout in milliseconds [0]
	;	W= Waits until Closed, by user or by Timeout or by WinClose command [0]
	;	I= Icon 0:None, [1], 2:Warning, 3:Error, >3:assumed to be an hIcon.
	;	C= RGB color for background (like 0xFF00FF or FF00FF), text uses compliment color, [1]
	;	Q= Theme [1], Use 0 to disable Theme for colors to work in Vista, Win7.
	;	NOTE: To Close it before Timeout, use command (WinClose,  ahk_id %<Returned hWnd>%)
	; ******************************************************************************************************************************
	STATIC hWnd, X, Y, T, W, I, C, Q	; Options STATIC to force local variables
	X:=Y:="", T:=W:=0, I:=C:=Q:=1, Ptr:=(A_PtrSize ? "Ptr" : "UInt"), sTitle:=((StrLen(sTitle)<99) ? sTitle : (SubStr(sTitle,1,95) . " ..."))
	loop, Parse, Options, %A_Space%=, %A_Space%%A_Tab%`r`n
		A_Index & 1  ? (Var:=A_LoopField) : (%Var%:=A_LoopField)
	DllCall("GetCursorPos", "int64P", pt), X:=(!X ? pt << 32 >> 32 : X), Y:=(!Y ? pt >> 32 : Y)
	a:=((C=1) ? ((hDC:=DllCall("GetDC","Uint",0)) (C:=DllCall("GetPixel","Uint",hDC,"int",X,"int",Y)) (DllCall("ReleaseDC","Uint",0,"Uint",hDC))) : ((C:=(StrLen(C)<8 ? "0x" : "") . C) (C:=((C&255)<<16)+(((C>>8)&255)<<8)+(C>>16)))) ; rgb -> bgr
	VarSetCapacity(ti,(A_PtrSize ? 28+A_PtrSize*3 : 40),0), ti:=Chr((A_PtrSize ? 28+A_PtrSize*3 : 40)), NumPut(0x20,ti,4,"UInt"), NumPut(&sText,&ti,(A_PtrSize ? 24+A_PtrSize*3 : 36))
	hWnd:=DllCall("CreateWindowEx",Ptr,0x8,"str","tooltips_class32","str","",Ptr,0xC3,"int",0,"int",0,"int",0,"int",0,Ptr,0,Ptr,0,Ptr,0,Ptr,0,Ptr)
	a:=(Q ? DllCall("SendMessage","Uint",hWnd,Ptr,0x200b,Ptr,0,Ptr,"") : DllCall("uxtheme\SetWindowTheme","Uint",hWnd,Ptr,0,"UintP",0)) ; TTM_SETWINDOWTHEME
	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, (X & 0xFFFF)|(Y & 0xFFFF)<<16,Ptr)	; TTM_TRACKPOSITION
	DllCall("SendMessage", Ptr, hWnd, "Uint", 1043, Ptr, C, Ptr,   0, Ptr)				; TTM_SETTIPBKCOLOR
	DllCall("SendMessage", Ptr, hWnd, "Uint", 1044, Ptr, ~C & 0xFFFFFF,  Ptr, 0,Ptr)		; TTM_SETTIPTEXTCOLOR
	DllCall("SendMessage", Ptr, hWnd, "Uint",(A_IsUnicode ? 1057 : 1056),Ptr, I,Ptr, &sTitle, Ptr)	; TTM_SETTITLE 0:None, 1:Info, 2:Warning, 3:Error, >3:assumed to be an hIcon.
	DllCall("SendMessage", Ptr, hWnd, "Uint", 1048, Ptr, 0, Ptr, A_ScreenWidth)			; TTM_SETMAXTIPWIDTH
	DllCall("SendMessage", Ptr, hWnd, "UInt",(A_IsUnicode ? 0x439 : 0x40c), Ptr, 0, Ptr, &ti, Ptr)	; TTM_UPDATETIPTEXT (OLD_MSG=1036)
	IfGreater, I, 0, SoundPlay, % "*" . (I=2 ? 48 : I=3 ? 16 : 64)
	IfGreater, T, 0, SetTimer, BalloonTip_TimeOut, %T%
	IfGreater, W, 0, WinWaitClose, ahk_id %hWnd%
	SetTimer, BalloonTip_TimeOut, Off
	Return hWnd
	BalloonTip_TimeOut:
	SetTimer, BalloonTip_TimeOut, Off
	WinClose, ahk_id %hWnd%
	Return
}

Все что находил у сообщений хвостик показывает верх, а мне надо вниз.
Вот как тут на первой картинке:
https://msdn.microsoft.com/en-us/librar … s.85).aspx

2

Re: AHK: стиль или тип balloon tooltip

Насколько я понял, если Ballontip нужно показывать в конкретных координатах, то хвостик будет вверх (за исключением расположения близко к нижнему краю экрана). Если Ballontip привязан к контролу либо к позиции курсора, тогда хвостик по возможности вниз.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

3

Re: AHK: стиль или тип balloon tooltip

Спасибо. Нашел тут на сайте то что надо