News:

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

Balloontip

Started by ctt, December 20, 2005, 02:16:22 PM

Previous topic - Next topic

ctt

Hello everyone, time for another question.  ::)

I've been searching all over the net (including MSDN) to find (do I have to add that i'm a bad searcher ;)) info about those "balloon tool tip"-thingys, does anyone here know if it is a "class"/api or if you have to make your own tooltip window looking like that?
I thought it was something builtin in Win2kXP but I might be wrong?

If someone got any examples it would be highly appreciated too.


ctt

LOL  :lol

I was about to edit my last post, but ofcourse i clicked on QUOTE, and can't find any way to remove my last post ? Sorry!

zooba

Check out the NOTIFYICONDATA structure on MSDN. There's a flag in there that specifies to use a balloon tip instead of a normal one.

However, if you want it to appear somewhere else (besides the system tray), you may have to find the class or create your own.


On the VERSIONINFO question, I don't think there's an easy way. I tried doing it once and all I remember about it is that I gave up  :P

ctt

Quote from: zooba on December 20, 2005, 02:40:57 PM
Check out the NOTIFYICONDATA structure on MSDN. There's a flag in there that specifies to use a balloon tip instead of a normal one.

However, if you want it to appear somewhere else (besides the system tray), you may have to find the class or create your own.
Tons of thanks! :) As i said, bad searcher ;)


Quote from: zooba on December 20, 2005, 02:40:57 PM
On the VERSIONINFO question, I don't think there's an easy way. I tried doing it once and all I remember about it is that I gave up  :P
Heheh, okey! I think i skip that part then ;)

anon

Balloontips are actually ToolTips. You have to create a ToolTip Window and place it where you want the ToolTip to appear
in your programs window. The class name is tooltips_class32.

As for getting the windows version, here is a simple example you can use or expand from.

GetWinVer proc

LOCAL osvi:OSVERSIONINFO
LOCAL buffer[256]:BYTE

pusha
invoke RtlZeroMemory,addr osvi,sizeof OSVERSIONINFO
mov    osvi.dwOSVersionInfoSize,sizeof OSVERSIONINFO
invoke GetVersionEx,addr osvi
.if    osvi.dwPlatformId == VER_PLATFORM_WIN32s
   invoke lstrcpy,addr buffer,CTEXT("Microsoft Win32s")
.elseif osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS
   mov    eax,osvi.dwMajorVersion
   .if    eax == 4
      mov    eax,osvi.dwMinorVersion
      .if    eax == 0
         invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows 95")
      .elseif eax == 10
         invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows 98")
      .elseif eax == 90
         invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows Me")
      .endif
   .endif
.elseif osvi.dwPlatformId == VER_PLATFORM_WIN32_NT
   mov    eax,osvi.dwMajorVersion
   .if    eax <= 4
      invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows NT")
   .elseif eax == 5
      mov    eax,osvi.dwMinorVersion
      .if    eax == 0
         invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows 2000")
      .elseif eax == 1
         invoke lstrcpy,addr buffer,CTEXT("Microsoft Windows XP")
      .endif
   .endif
.endif
popa
lea    eax,buffer
ret

GetWinVer endp

ctt

Thanks anon  :U Just what i needed (not the windows version thing) a working example  :cheekygreen:

Cheers!

ctt

Quote from: anon on December 20, 2005, 03:03:29 PM
Balloontips are actually ToolTips. You have to create a ToolTip Window and place it where you want the ToolTip to appear
in your programs window. The class name is tooltips_class32.

You dont have an example on this as well? I tried an c++ example but i can't get it to show, i've added the new members to the NOTIFYICON struct and everything, but can't get it to show.

anon

OK, here is a simple example of using ToolTips with the Balloon style

.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
ID_BTN1      equ 600
ID_BTN2      equ 601

.data
szClassName    db "WinClass",0
szProgramName  db "ToolTip Window",0
szButtonClass  db "BUTTON",0
szToolTipClass db "tooltips_class32",0
szBtnTxt1      db "Button 1",0
szBtnTxt2      db "Button 2",0
szToolTxt1     db "BalloonToolTip: Button 1",0
szToolTxt2     db "BalloonToolTip: Button 2",0
szToolTxt3     db "BalloonToolTip: Main Window",0

wc WNDCLASSEX<sizeof WNDCLASSEX,\
              CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW,\
              offset WndProc,NULL,NULL,NULL,0,0,COLOR_BTNFACE+1,\
              NULL,offset szClassName,0>
ti TOOLINFO<>

.data?
hInstance     dd ?
hWnd          dd ?
hButton1      dd ?
hButton2      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 BUTTONS
   invoke CreateWindowEx,NULL,addr szButtonClass,addr szBtnTxt1,
          WS_CHILD or WS_VISIBLE,10,10,100,30,hWin,ID_BTN1,hInstance,NULL
   mov    hButton1,eax
   invoke CreateWindowEx,NULL,addr szButtonClass,addr szBtnTxt2,
          WS_CHILD or WS_VISIBLE,210,10,100,30,hWin,ID_BTN2,hInstance,NULL
   mov    hButton2,eax
;CREATE TOOLTIP
   invoke CreateWindowEx,WS_EX_TOPMOST,addr szToolTipClass,NULL,
          WS_POPUP or TTS_NOPREFIX or TTS_BALLOON,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   hButton1
   pop    ti.uId
   mov    ti.lpszText,offset szToolTxt1
;SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW
   invoke SendMessage,hToolTip,TTM_ADDTOOL,0,addr ti
;CHANGE A MEMBER OF THE TOOLINFO STRUCTURE
   push   hButton2
   pop    ti.uId
   mov    ti.lpszText,offset szToolTxt2
;SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW
   invoke SendMessage,hToolTip,TTM_ADDTOOL,0,addr ti
;CHANGE A MEMBER OF THE TOOLINFO STRUCTURE
   push   hWin
   pop    ti.uId
   mov    ti.lpszText,offset szToolTxt3
;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

[attachment deleted by admin]

ToutEnMasm

Hello,
BalloonTips.zip is the first sample that i download and who don't  need to be rewrite or modify in only one word.
I have compiled it at the first time and ....he work.
                 
                 very Good sample,
                                               ToutEnMasm