Advertisement
carlosfeitozafilho

MSQA#786101V1.0

Mar 24th, 2022 (edited)
1,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.78 KB | None | 0 0
  1. var HwndTip: HWND := CreateWindowEx(WS_EX_NOACTIVATE or WS_EX_TOPMOST
  2.                                    ,TOOLTIPS_CLASS
  3.                                    ,nil // Same as NULL in C or Zero
  4.                                    ,TTS_ALWAYSTIP or TTS_BALLOON
  5.                                    ,0,0,0,0
  6.                                    ,Self.Handle // Handle of Window containing the buttons
  7.                                    ,0
  8.                                    ,HInstance   // Handle of Application (Application Instance Handle)
  9.                                    ,nil);
  10.  
  11. SendMessage(HwndTip,TTM_SETTITLE,TTI_INFO,LPARAM(PChar('Title')));
  12. SendMessage(HwndTip,TTM_SETMAXTIPWIDTH,0,300);
  13.  
  14. var TI: TToolInfo;
  15.  
  16. ZeroMemory(@TI,SizeOf(TToolInfo));
  17.  
  18. TI.cbSize := SizeOf(TToolInfo);
  19. TI.hwnd := Self.Handle;  // Handle of Window containing the buttons
  20.  
  21. // Configuring a ToolTip for the First Button
  22. TI.uId := BUTN1.Handle; // Handle of the first button
  23. TI.lpszText := 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tincidunt dictum dui vel luctus. Duis ornare arcu a varius pharetra. Curabitur tempor sit amet dui id malesuada. Aliquam efficitur, massa consectetur tristique iaculis, dolor diam tincidunt.';
  24. TI.uFlags := TTF_IDISHWND or TTF_SUBCLASS;
  25. SendMessage(HwndTip,TTM_ADDTOOL,0,LPARAM(@TI));
  26.  
  27. // Configuring a ToolTip for the Second Button
  28. TI.uId := BUTN2.Handle; // Handle of the second button
  29. TI.lpszText := 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tincidunt dictum dui vel luctus. Duis ornare arcu a varius pharetra. Curabitur tempor sit amet dui id malesuada. Aliquam efficitur, massa consectetur tristique iaculis, dolor diam tincidunt.';
  30. TI.uFlags := TTF_IDISHWND or TTF_SUBCLASS or TTF_CENTERTIP;
  31. SendMessage(HwndTip,TTM_ADDTOOL,0,LPARAM(@TI));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement