News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ToolTip

Started by Darrel, October 24, 2006, 04:14:13 PM

Previous topic - Next topic

Darrel

I am having problems getting tooltips to display. I did search the forum. Here is the relevant code.

INVOKE GetModuleHandle,NULL

mov ToolInfo.hInst,eax
mov ToolInfo.cbSize,sizeof TOOLINFO
mov ToolInfo.uFlags,TTF_IDISHWND or TTF_SUBCLASS

INVOKE InitCommonControls

The following is in the MainWindowProcedure under WM_CREATE:

INVOKE CreateWindowEx,NULL,ADDR ToolTipClass,NULL,\
WS_CHILD or TTS_ALWAYSTIP,0,0,0,0,hWndMainwindow,NULL,hInstance,NULL

mov hwndToolTip,eax



xor ebx,ebx
mov esi,4
mov edi,4

CreateWindow00006:

INVOKE CreateWindowEx,NULL,ADDR ModeClass,NULL,\
WS_CHILD or WS_VISIBLE,esi,edi,25,25,\
hwndChildofMainWindow,ebx,hInstance,NULL

lea edx,hwndSelect
mov DWORD PTR[edx+4*ebx],eax
inc ebx
mov ToolInfo.hWnd,eax
mov ToolInfo.lpszText,ebx

INVOKE SendMessage,hwndToolTip,TTM_ADDTOOL,NULL,ADDR ToolInfo

cmp bl,13
je CreateWindow00007

add esi,25
cmp esi,35
jb CreateWindow00006

mov esi,4
add edi,25
jmp CreateWindow00006

CreateWindow00007:

The followin is in the resource:

STRINGTABLE DISCARDABLE
BEGIN
IDT_SELECT "Select"
IDT_STAR "Free-Form Select"
IDT_TEXT "Text"
IDT_HOTSPOT "HotSpot"
IDT_PICK "Pick Color"
IDT_FILL "Fill with Color"
IDT_REDEYE "Red-Eye Remover"
IDT_BRUSH "Brush"
IDT_CURVE "Bezier"
IDT_LINE "Line"
IDT_ELLIPSE "Ellipse"
IDT_RECTANGLE "Rectangle"
IDT_SPRAY "Spray"
END



Thanks for your time and consideration.

Darrel

dsouza123

Do a web search for  tooltip eax ( look for links for Iczelion's Tutorial 27)

It will show tooltips for the buttons and the four sections of the background.

Darrel

I forgot to fill in the ToolInfo.uId member.  :red

Thanks for your advice, I did read tutorial 27 before I found my goof.

Regards,

Darrel

PBrennick

Darrel

In my editor, I am using this...


        .elseif eax==WM_NOTIFY          ; Notify?
          mov  edx, lParam              ; Get subcommand
          mov  eax, (NMHDR ptr [edx]).code  ; Save it
          .if eax==TTN_NEEDTEXT         ; Notification message used to retrieve text
;           Toolbar tooltip
            mov  edx, (NMHDR ptr [edx]).idFrom  ; Save it
            inv  LoadString, hInstance, edx, addr buffer, sizeof buffer ; Get the message
            lea  eax, buffer            ; Initialize the buffer pointer
            mov  edx, lParam            ; Get subcommand
            mov  (TOOLTIPTEXT ptr [edx]).lpszText, eax  ; Display tooltip


Paul
The GeneSys Project is available from:
The Repository or My crappy website