i need to see a working example of a tooltip control that is the most basic that you can make. just a simple window and when the mouse hovers on the window a tooltip displays with text. i realize iczelion has tutorial 27 but his tutorial is driving me nuts. his tutorial is also made with a dialog box and hope someone can do a window from me instead. thanks for your time smurf
Posted on 2001-06-14 07:26:00 by smurf
Smurf, Check out the "Toolbar example" by Teraphy at icz's page in source codes ->page 2. It has the simplest ever method of creating a toolbar window with tooltips i have ever seen. This message was edited by MovingFulcrum, on 6/14/2001 1:13:29 PM
Posted on 2001-06-14 13:12:00 by MovingFulcrum
thanks MovingFulcrum for your reply. the source code you recomend is for toolbars. the code im looking for is code that will allow me to show tooltips on a window which is much different from the toolbar tooltips method. smurf This message was edited by smurf, on 6/14/2001 7:01:44 PM
Posted on 2001-06-14 19:00:00 by smurf
I think most simple one is by Betrayed
Posted on 2001-06-15 07:43:00 by LaptoniC
thanks MovingFulcrum for your reply. the source code you recomend is for toolbars. the code im looking for is code that will allow me to show tooltips on a window which is much different from the toolbar tooltips method.
What kinda tooltips do u exactly want? U can even chek out Ewayne's asmedit sourcecode. It has a very different and kinda modern method of putting tooltips. This message was edited by MovingFulcrum, on 6/15/2001 12:36:10 PM
Posted on 2001-06-15 12:31:00 by MovingFulcrum
Smurf, maybe you already figured this out. But just in case... Sorry for minimal comments, If you have questions, send me an email. Contents of ToolTip.asm:

.386
.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\gdi32.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\Comctl32.inc

includelib \MASM32\LIB\gdi32.lib
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
includelib \MASM32\LIB\Comctl32.lib

WinMain      PROTO
WndProc      PROTO :DWORD,:DWORD,:DWORD,:DWORD

.const
IDR_MAINICON equ 500
IDR_MAINMENU equ 501
IDM_EXIT     equ 502

.data
szClassName    db "WinClass",0
szProgramName  db "ToolTip Window",0
szToolTipClass db "tooltips_class32",0
szToolTip      db "Smurf's very own ToolTip",0

wc WNDCLASSEX
ti TOOLINFO<>

.data?
hInstance     dd ?
hWnd          dd ?
hToolTip      dd ?

.code
start:
invoke GetModuleHandle,NULL
mov    hInstance,eax
invoke InitCommonControls
invoke WinMain
invoke ExitProcess,eax

WinMain proc
LOCAL msg:MSG

push   hInstance
pop    wc.hInstance
invoke LoadCursor,NULL,IDC_ARROW
mov    wc.hCursor,eax
invoke RegisterClassEx,addr wc
;CENTER THE PROGRAM WINDOW
invoke GetSystemMetrics,SM_CXSCREEN
mov    esi,eax
invoke GetSystemMetrics,SM_CYSCREEN
mov    ecx,eax
shr    esi,1
shr    ecx,1
sub    esi,500/2
sub    ecx,300/2
;CREATE THE PROGRAM WINDOW
invoke CreateWindowEx,WS_EX_LEFT,addr szClassName,addr szProgramName,
       WS_VISIBLE or WS_OVERLAPPEDWINDOW,esi,ecx,500,300,NULL,NULL,
       hInstance,NULL
mov    hWnd,eax
;MESSAGE LOOP
.while TRUE
   invoke GetMessage,addr msg,NULL,0,0
   .break .if (!eax)
   invoke TranslateMessage,addr msg
   invoke DispatchMessage,addr msg
.endw
mov    eax,msg.wParam
ret
WinMain endp

WndProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL Rct:RECT

.if    uMsg == WM_CREATE
;CREATE TOOLTIP
   invoke CreateWindowEx,WS_EX_TOPMOST,addr szToolTipClass,NULL,
          WS_POPUP or TTS_NOPREFIX,0,0,0,0,hWin,NULL,hInstance,NULL
   mov    hToolTip,eax
   invoke SetWindowPos,hToolTip,HWND_TOPMOST,0,0,0,0,
          SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE
;INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE
   mov    ti.cbSize,sizeof TOOLINFO
   mov    ti.uFlags,TTF_SUBCLASS or TTF_IDISHWND
   push   hWin
   pop    ti.hWnd
   push   hInstance
   pop    ti.hInst
   push   hWin
   pop    ti.uId
   mov    ti.lpszText,offset szToolTip
;TOOLTIP CONTROL COVERS ENTIRE WINDOW
   invoke GetWindowRect,hWin,addr Rct
   push   Rct.left
   pop    ti.rect.left
   push   Rct.top
   pop    ti.rect.top
   push   Rct.right
   pop    ti.rect.right
   push   Rct.bottom
   pop    ti.rect.bottom
;SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW
   invoke SendMessage,hToolTip,TTM_ADDTOOL,0,addr ti
.elseif uMsg == WM_DESTROY
   invoke PostQuitMessage,NULL
   xor    eax,eax
   ret
.endif
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret

WndProc endp

end start
This message was edited by anon, on 6/16/2001 9:27:53 PM
Posted on 2001-06-16 21:24:00 by anon
thanks ANON that was exactly what i was looking for. smurf
Posted on 2001-06-17 09:13:00 by smurf