----------parameter Description---------------------//////////////////////
H: Handle to a control in a form (prompting a message on a control) (the handle of the control to invoke)
Text: Texts to prompt
Cap: Caption on the cue box
Icontype: A total of three values for the icon displayed on the prompt box. 1, 2, 3 for hints, warnings, error s)
T: The time of the message stay (in milliseconds)
Left: The message box deviates from the control's right-hand distance and is set to 0 to indicate that no
Top: The message box deviates from the top distance of the control and is set to 0 to indicate that no
Procedure Tfrmmain.qipaoshowmessage (H:hwnd;text,cap:string;icontype:integer=1;t:integer=1000;left:integer=0;top : integer=0);
Var
R:trect; is a record that holds the value of a rectangle (two points in the lower-right corner of the upper-left corner) of 4 coordinates or 2 points.
htooltip:cardinal; Cardinal is an unsigned 32-bit integer that takes a value from 0 to 4294967295 in the range.
Ti:ttoolinfo;
Begin
Htooltip: = CreateWindow (' tooltips_class32 ', nil,$40,0,0,0,0,0,0,hinstance,nil);
If Htooltip <> 0 Then
Begin
SetWindowPos (Htooltip, hwnd_topmost,0,0,0,0,swp_nomove or swp_nosize or swp_noactivate); Let the bubbles in the front
Ti.cbsize: = SizeOf (Ttoolinfo);
Ti.uflags: = Ttf_idishwnd or ttf_track;
Ti.hinst: = hinstance;
Ti.lpsztext: =pchar (text);
SendMessage (Htooltip, Ttm_addtool, 0, Integer (@ti));
if (Icontype > 3) or (Icontype < 0) then icontype:=0;
SendMessage (Htooltip,wm_user + 32,icontype,integer (Pchar (CAP)));
GetWindowRect (H,R); Gets the coordinates of the specified control, R.right, R.left, R.bottom, R.top
R.left:=r.left-left;
R.top:=r.top-top;
Define Bubble position
SendMessage (htooltip,ttm_trackposition, 0, Makelong ((r.right-r.left) Div 2 + r.left, (r.bottom-r.top) Div 2 + r.top)); SendMessage (Htooltip, Ttm_trackactivate, Integer (True), Integer (@ti));
Sleep (t);
DestroyWindow (Htooltip);
End
End
The results are as follows:
Delphi pop-up bubble message tip