I need help on adding tooltips to controls
Hi, i´m using DEV-CPP 4.9.7.0 (MingW32 2.0, GCC 3.2) to (try to) develop C + Win32API programs. Things were going OK until i started trying to add TOOLTIPS for each controls of my app, i just can´t make it work, couldn´t also find a good example anywhere.
Maybe i should just post the code so that you can all have a good laugh at me :)
Code:
/* Part of main.h*/
...
HWND name_s1;
HWND tip_s1;
TOOLINFO toolInfo;
...
/* Part of main.c */
...
/*This hole thing is inside a WM_CREATE case: */
/*This is the control i´m trying to add a tooltip */
name_s1 = CreateWindow (TEXT ("edit"), TEXT(strname_s1),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
25, 50, 109, 15, mainWindow, (HMENU) 201, ((LPCREATESTRUCT) lParam)->hInstance, NULL) ;
toolInfo.cbSize = sizeof(toolInfo); /* Noy much to say :) */
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; /* The styles */
toolInfo.hwnd = mainWindow; /* The Main Window HWND */
toolInfo.uId = (unsigned int) 201; /* The ID of the Control i´m adding the tooltip (name_s1) */
toolInfo.lpszText = "Some useful info"; /*The tooltip text */
tip_s1 = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mainWindow, NULL, ((LPCREATESTRUCT) lParam)->hInstance,
NULL);
SendMessage(tip_s1, TTM_ACTIVATE, TRUE, 0);
SendMessage(name_s1, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &toolInfo);
...
I got -lcomctl32 and -user32.lib in my Linker Options. The rest of the app is working ok, GCC outputs no warn or error (even using -Wall).
Can you help me?