Delphi pop-up bubble message tip

Source: Internet
Author: User

----------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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.