Balloon Tips
BlitzMax Forums/MaxGUI Module/Balloon Tips
| ||
| I wanted to add some balloon tooltips to my application and it worked fine until i used a winxp theme manifest ( http://blitzbasic.com/Community/posts.php?topic=53082#593812 ). When you click on the tooltip's gadget or point at the gadget for about four seconds the tooltip won't be shown again. Just try it with and without a manifest! There are two separate files: - a C++ file which contains a function to create the balloon tip - the sample program You will need MinGW and MaxGUI to compile it. The C++ file (balloontip.cpp)
#include <windows.h>
#define _WIN32_IE 0x0500
#include <commctrl.h>
extern "C"
{
HWND tooltip;
int ICON_NOTIFY = 1;
int ICON_WARNING = 2;
int ICON_ERROR = 3;
int AddBalloonTip( HWND hwnd, char* text, char* title )
{
tooltip = CreateWindowEx( 0, TOOLTIPS_CLASS, 0, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON | TTS_ALWAYSTIP,
0, 0, 0, 0,
hwnd, NULL, GetModuleHandle( 0 ), 0 );
RECT rc;
GetClientRect( hwnd, &rc );
TOOLINFO ti;
ti.cbSize = sizeof ( TOOLINFO );
ti.hinst = GetModuleHandle(0);
ti.hwnd = tooltip; // tooltip hwnd
ti.lpszText = text; // tooltip for gadget
ti.rect = rc;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.uId = (UINT)hwnd; // gadget hwnd to add tooltip
SendMessage( tooltip, TTM_SETTITLEA, ICON_WARNING, (LPARAM)title );
SendMessage( tooltip,
TTM_ADDTOOL,
0,
(LPARAM)(LPTOOLINFO)(&ti) );
return 0;
}
}
The sample program Import "balloontip.cpp" Extern Function AddBalloonTip( hwnd:Int, text:Byte Ptr, title:Byte Ptr ) End Extern Global window:TGadget = CreateWindow( "BalloonTip test", 100, 100, 300, 200, Null, WINDOW_TITLEBAR ) Global button:TGadget = CreateButton( "Point on me!", 105, 70, 80, 24, window ) AddBalloonTip( QueryGadget( button, QUERY_HWND ), "When you press this button, the tooltip will never come back.", "Warning" ) While True WaitEvent Select EventID( ) Case EVENT_WINDOWCLOSE End End Select Wend |
| ||
| Can you help me? |