Assembly code snippets

Back to the snippets overview

Details

TitleTooltips colors procedure
Authorsmurf
Submitted by:smurf
Date added:2002-03-25 02:20:48
Date modified:2002-03-25 02:20:48

Comments

This is a procedure that will change the tooltips text and background colors of either a listview, toolbar, treeview, rebar, tab, or trackbar control. Depending on which control tooltip you need to modify, will depend on which notification message you will use when you call/invoke the procedure.

Snippet

;// for example purposes the code is setup to change the tooltips colors of
;// a listview.

;// place right below your include section.
ToolTipColors  PROTO :DWORD,:DWORD

;// the color macro that allows you to use RGB color settings.
;// place this macro somewhere before your .code section.
RGB macro red,green,blue
        xor eax,eax
        mov ah,blue
        shl eax,8
        mov ah,green
        mov al,red
endm

;// these constants have yet to be added to Hutch's/Icz windows include file.
;// place these above your .code section.
TTM_SETTIPBKCOLOR    equ  WM_USER + 19
TTM_SETTIPTEXTCOLOR  equ  WM_USER + 20

;// these constants also have yet to be added. depending on which control
;// your using will depend on which one of the below you will use. the
;// toolbar, rebar, and tab controls you dont need to worry about they have
;// already been added to the windows include file
LVM_GETTOOLTIPS      equ  LVM_FIRST + 78  ;// listview message
;TBM_GETTOOLTIPS     equ  WM_USER   + 30  ;// trackbar message
;TVM_GETTOOLTIPS     equ  TV_FIRST  + 25  ;// treeview message

;// this line will invoke the ToolTipColors procedure and will need to be
;// changed depending on which control you use.
invoke ToolTipColors,hListView,LVM_GETTOOLTIPS

;// place the procdure below in your code section somewhere.
ToolTipColors proc cHandle:DWORD,nMsg:DWORD
   LOCAL hTip:DWORD
      invoke SendMessage,cHandle,nMsg,0,0
      mov hTip,eax
      RGB 255,255,0
      invoke SendMessage,hTip,TTM_SETTIPBKCOLOR,eax,0
      RGB 0,0,255
      invoke SendMessage,hTip,TTM_SETTIPTEXTCOLOR,eax,0
      invoke SetWindowPos,hTip,HWND_TOPMOST,0,0,0,0,SWP_SHOWWINDOW
      ret
ToolTipColors endp