|
unit WZWSTXJK;
interface
uses
Business.System.CommCtrl,Business.System, Business.Forms,Borland.Delphi.Messages,
Borland.Delphi.Windows;
type
TWZWSTXJK = class(TForm)
Image1: TImage;
Timer1: TTimer;
Shape1: TShape;
procedure Timer1Timer(Sender: TObject);
private
{private declarations}
public
{public declarations}
end;
const
TTS_BALLOON = $40;
TTM_SETTITLE = (WM_USER + 32);
var
hTooltip: Cardinal;
ti: TToolInfo;
buffer : array of char;
implementation
{static function CreateWindowEx(dwExStyle: Longword; lpClassName: string; lpWindowName: string;
dwStyle: Longword; X: Longint; Y: Longint; nWidth: Longint; nHeight: Longint; hWndParent:
Longword; hMenu: Longword; hInstance: Longword; lpParam: Business.System.TObject): }
procedure CreateToolTips(hWnd: Cardinal);
begin
hToolTip := CreateWindowEx(0, 'Tooltips_Class32', nil, TTS_ALWAYSTIP or TTS_BALLOON,
Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT),Integer(CW_USEDEFAULT),
Integer(CW_USEDEFAULT), hWnd, 0, hInstance, nil);
if hToolTip <> 0 then
begin
SetWindowPos(hToolTip, HWND_TOPMOST, 0,0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
ti.cbSize := SizeOf(TToolInfo);
ti.uFlags := TTF_SUBCLASS or TTF_TRANSPARENT;
ti.hInst := hInstance;
end;
end;
procedure AddToolTip(hwnd: dword; lpti: PToolInfo; IconType: Integer; Text, Title: PChar;
BackColor,TextColor:TColor);
//BackColor,TextColor分别是背景颜色和文本颜色,如果是0则取默认值.
var
Rect: TRect;
begin
SetLength(buffer,255);
if (hwnd <> 0) AND (GetClientRect(hwnd, Rect)) then
begin
lpti.hwnd := hwnd;
lpti.Rect := Rect;
lpti.lpszText := Text;
SendMessage(hToolTip, TTM_ADDTOOL, 0, Integer(lpti));
FillChar(buffer, sizeof(buffer), #0);
lstrcpy(buffer, Title);
if (IconType > 3) or (IconType < 0) then IconType := 0;
if BackColor<>0 then SendMessage(hToolTip, TTM_SETTIPBKCOLOR, BackColor, 0);
if TextColor<>0 then SendMessage(hToolTip, TTM_SETTIPTEXTCOLOR, TextColor, 0);
// SendMessage(hToolTip, TTM_SETTITLE, IconType, Integer(@buffer));
end;
end;
procedure TWZWSTXJK.Timer1Timer(Sender: TObject);
begin
//
end;
end.
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(38, 37): Undeclared identifier "hInstance"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(44, 18): Undeclared identifier "hInstance"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(60, 53): Incompatible types: "Int32" and "tagTOOLINFOA*"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(61, 7): Undeclared identifier "FillChar"
[错误]Biz:\SPACE_SYGLXXXT\FOLDER_YWZX\TXGL\WZWS\WZWSJK.FUNC.DIR\WZWSTXJK.Form.pas(62, 15): Incompatible types: "String" and "Char[]" |
|