Proc to set uo Tool Tips

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
gsbr gsbr is offline Offline Aug 17th, 2008, 1:18 pm |
0
First it is in RosAsm style.
Sorry I am addicted to its simplicity of use.
The Proc is called from Dialog initiation

  1.  
  2. [Counter:D$ 0]
  3.  
  4. ; Call for the first ToolTip
  5. Call SetTTip D$hdlg, ; H Dialog Handle of Dialog or Window
  6. 1, ; Tool tip number ID
  7. 1, ; Normal (not balloon 2 is balloon type)
  8. b_calculate,; Control ID number
  9. 1 ; Text Pointer to Ressource or pointer to a String
  10.  
  11. ;To show success it returns with the HANDLE of the created Tool tip
Quick reply to this message  
Assembly Syntax
  1. [ToolTipsHandles: 0 #16] ; Space for 16 handles
  2. [TOOLINFOS: 0 #(48*16)] ; Space for 16 Structures
  3.  
  4. [Mode1 &TTS_NOPREFIX + &TTS_ALWAYSTIP] ; declaration of values
  5. [Mode2 Mode1 + &TTS_BALLOON]
  6. [uFlags &TTF_SUBCLASS + &TTF_IDISHWND]
  7.  
  8. Proc SetTTip:
  9. ;;
  10. Only individuals
  11. Each one has its complete system.
  12. The Proc maintains the data
  13. ;;
  14.  
  15. Arguments @hWnd, ; Dialog or Window H
  16. @ttnb, ; Tool tip Number
  17. @Mode, ; Normal 1, Balloons 2
  18. @CtlID, ; ID of Control
  19. @ttText
  20. Uses ebx
  21.  
  22. [@ToolMode: ?]
  23. [@hToolHandle: ?]
  24. If D@ttnb > 16
  25. Call 'USER32.MessageBoxA' D$hdlg,
  26. {'Only 16 Possible',0}, ; Text message
  27. {'ToolTip Id TOO High',0}, ; Box title
  28. 0 ; Box style
  29. jmp X1>>
  30.  
  31. End_If
  32. ; Setup TOLINFO
  33. mov eax 48
  34. ; Set for Base 0
  35. dec D@ttnb
  36. mul D@ttnb
  37. add eax TOOLINFOS
  38.  
  39. ;ToolInfo base
  40. mov ebx eax
  41. nop
  42. ;Setup TOOLINFO(Array)
  43. mov D$ebx 48 ; .cbSize
  44. mov D$ebx + 4 uFlags ; .uFlags
  45. mov eax D@hWnd
  46. mov D$ebx + 8 eax ; .hWnd
  47. Call 'USER32.GetDlgItem' eax , D@CtlID
  48. mov D$ebx + 12 eax
  49. mov eax D$hInstance
  50. mov D$ebx + 32 eax
  51. mov eax D@ttText
  52. mov D$ebx + 36 eax
  53. If D@Mode = 1
  54. mov D@ToolMode Mode1
  55. Else
  56. mov D@ToolMode Mode2
  57. End_If
  58.  
  59. Call 'USER32.CreateWindowExA' 0,TOOLTIPS_CLASS,0,
  60. D@ToolMode,0,0,0,0,
  61. D@hWnd,0,
  62. D$hinstance,0
  63. ; Local Handle of Tool Tip
  64. mov D@hToolHandle eax
  65.  
  66.  
  67. Call 'USER32.SendMessageA' eax,;D@hToolHandle, ; Handle to tooltip 1
  68. &TTM_ADDTOOL,
  69. 0,
  70. ebx;TOOLINFO ; Ptr to tool
  71. mov eax D@hToolHandle ; show valid handle,it is in the array anyway
  72. mov edx D@ttNb
  73. ;dec edx ; base to 0 was done at top
  74. sal edx 2 ; mult by 4
  75. mov ebx HandlesArray
  76. add ebx edx
  77. mov D$ebx eax
  78. inc D$Counter ; Satellite for Controlling display
  79.  
  80. X1:
  81. EndP
0
gsbr gsbr is offline Offline | Aug 17th, 2008
Sorry I saw a little thin missing
and I cannopt find < EDIT >
(being new here)

[HandlesArray: 0 #16]
the place holder for the handles.

An other thing:
I assumed that the Handle for the Instance is called hInstance
to allow other names an extra parameter shoud be passed to the proc
declaring it as @hInstance
and changing all $ to @ $=Global @ = Stack local for hInstance(not many)

Sorry for the inconveniance.

I am in the editing buisness !!!
; to toggle vision of tool tip
Proc TTToggle:

Arguments @ID,
@ONOFF ;0,1 ON OFF
uses ebx


mov ebx HandlesArray
mov eax D@ID
dec eax
shl eax 2
add ebx eax
mov eax D@ONOFF
;mov edx D$ebx
mov ebx D$ebx
Call 'USER32.SendMessageA' ebx,
&TTM_ACTIVATE,
eax, ; True/False
0

EndP



gbr.
 
 

Message:


Thread Tools Search this Thread



Tag cloud for Assembly
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC