Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDumb question.. Pin
RobJones8-Aug-03 11:37
RobJones8-Aug-03 11:37 
GeneralNevermind I figured it out :-) Pin
RobJones8-Aug-03 11:53
RobJones8-Aug-03 11:53 
GeneralNon recursive Tree Control Traversal Pin
Binayak8-Aug-03 10:45
Binayak8-Aug-03 10:45 
GeneralNeed correction on this code Pin
Binayak8-Aug-03 10:26
Binayak8-Aug-03 10:26 
QuestionAutostart installation? Pin
SIerus8-Aug-03 10:11
SIerus8-Aug-03 10:11 
GeneralBitmap editor Pin
Gagnon Claude8-Aug-03 9:22
Gagnon Claude8-Aug-03 9:22 
GeneralRe: Bitmap editor Pin
David Crow8-Aug-03 9:27
David Crow8-Aug-03 9:27 
QuestionTool tips on dialog buttons with no MFC? Pin
Kayembi8-Aug-03 9:13
Kayembi8-Aug-03 9:13 
Hi,

I want to show tool tips when the mouse is over normal button controls (ie. *not* a toolbar, just on buttons) in my dialog-based app (using the WinAPI with *no MFC*). I have searched here, CodeGuru, Google and MSDN, but all I come up with are ways of doing this in MFC. Does anybody know of a non-MFC way to do this? The only post I found on this gave this code, but I can't get it to work:


// Create a tool tip class and set its parent to the Parent Window
ToolTipWnd = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP, 0,0,0,0, hWnd, NULL, NULL, 0);

if ( ToolTipWnd != NULL )
// Send this message to Activate ToolTips for the window:
SendMessage(ToolTipWnd, TTM_ACTIVATE, TRUE, 0);
// Pass a FALSE when you wish to deactivate the tool tip.

//To assign a tool tip to a control do the following:
TOOLINFO toolinfo; // Tool Tip Info structure

memset(&toolinfo, 0, sizeof(TOOLINFO));

toolinfo.cbSize = sizeof(TOOLINFO);
toolinfo.hwnd = hWnd;
toolinfo.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
toolinfo.uId = IDC_EXEBROWSE;
toolinfo.hinst = NULL;
toolinfo.lpszText = "Select executable"; // Text you wish displayed

SendMessage ( ToolTipWnd, TTM_ADDTOOL, 0, (LPARAM)&toolinfo );


I placed this in WM_INITDIALOG, with no joy. I have tried sending messages via WM_NOTIFY, as you would with a toolbar, like this:

case WM_NOTIFY:
{
//handle tooltip text:
NMHDR FAR *tem=(NMHDR FAR *)lParam;
switch(tem->code)
{
case TTN_NEEDTEXT:
LPTOOLTIPTEXT Tooltip = LPTOOLTIPTEXT(tem);
switch(wParam)
{
case IDC_EXEBROWSE:
Tooltip->lpszText="Select executable";

//............etc...

But all to no avail.

If anybody could tell me a way of getting tool tips working on my button controls using the standard Windows API with no MFC, I would be really grateful.

Many thanks,
KB
AnswerRe: Tool tips on dialog buttons with no MFC? Pin
Michael Dunn8-Aug-03 10:23
sitebuilderMichael Dunn8-Aug-03 10:23 
GeneralRe: Tool tips on dialog buttons with no MFC? Pin
Kayembi8-Aug-03 12:13
Kayembi8-Aug-03 12:13 
GeneralRe: Tool tips on dialog buttons with no MFC? Pin
Michael Dunn9-Aug-03 6:51
sitebuilderMichael Dunn9-Aug-03 6:51 
GeneralRe: Tool tips on dialog buttons with no MFC? Pin
Kayembi10-Aug-03 3:34
Kayembi10-Aug-03 3:34 
Generaltelnet server/ TCP client Pin
lightyear8-Aug-03 8:59
lightyear8-Aug-03 8:59 
GeneralRe: telnet server/ TCP client Pin
Ryan Binns8-Aug-03 21:47
Ryan Binns8-Aug-03 21:47 
Questionmalloc ? Pin
_skidrow_vn_8-Aug-03 8:42
_skidrow_vn_8-Aug-03 8:42 
AnswerRe: malloc ? Pin
Gary Kirkham8-Aug-03 8:56
Gary Kirkham8-Aug-03 8:56 
GeneralRe: malloc ? Pin
_skidrow_vn_8-Aug-03 9:03
_skidrow_vn_8-Aug-03 9:03 
GeneralRe: malloc ? Pin
David Crow8-Aug-03 9:33
David Crow8-Aug-03 9:33 
GeneralRe: malloc ? Pin
User 66588-Aug-03 9:44
User 66588-Aug-03 9:44 
GeneralRe: malloc ? Pin
Tim Smith8-Aug-03 13:10
Tim Smith8-Aug-03 13:10 
GeneralRe: malloc ? Pin
Gary Kirkham8-Aug-03 15:27
Gary Kirkham8-Aug-03 15:27 
AnswerRe: malloc ? Pin
Rick York8-Aug-03 12:38
mveRick York8-Aug-03 12:38 
GeneralVideo frame transmission Pin
Chikka8-Aug-03 8:39
Chikka8-Aug-03 8:39 
GeneralSave Changes to... screwing up in WinXP Pin
mcguile2578-Aug-03 8:31
mcguile2578-Aug-03 8:31 
GeneralRe: Save Changes to... screwing up in WinXP Pin
Neville Franks8-Aug-03 11:11
Neville Franks8-Aug-03 11:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.