Click here to Skip to main content
15,861,168 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
Michael Hinton21-May-19 19:46
Michael Hinton21-May-19 19:46 
QuestionRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
David Crow22-May-19 2:55
David Crow22-May-19 2:55 
AnswerRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
Victor Nijegorodov22-May-19 4:18
Victor Nijegorodov22-May-19 4:18 
GeneralRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
Michael Hinton23-May-19 7:12
Michael Hinton23-May-19 7:12 
QuestionAdd tool tip to menu Pin
NoviceEx17-May-19 1:28
NoviceEx17-May-19 1:28 
AnswerRe: Add tool tip to menu Pin
Richard MacCutchan17-May-19 3:30
mveRichard MacCutchan17-May-19 3:30 
SuggestionRe: Add tool tip to menu Pin
David Crow17-May-19 3:38
David Crow17-May-19 3:38 
AnswerRe: Add tool tip to menu Pin
leon de boer17-May-19 4:30
leon de boer17-May-19 4:30 
It's easy to add to any window using just the Windows API ..

So you have a window Handle (hWnd) and you have a char* tooltip you wish to display

First you must make sure commoncontrols is kicked

#include <commctrl.h>
#pragma comment(lib, "comctl32.lib")   // Shortcut to add library rather than manual add

INITCOMMONCONTROLSEX icex = {
	.dwSize = sizeof(INITCOMMONCONTROLSEX),
	.dwICC = ICC_STANDARD_CLASSES
};
InitCommonControlsEx(&icex);

Now create the tooltip window .. we will default to same area as window itself you can size it if you want
HWND TTWnd = CreateWindowEx (WS_EX_TOPMOST, TOOLTIPS_CLASS,	NULL, 
	WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_BALLOON,
	CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
	hWnd, 0, 0, NULL); // Create tooltip window

if (TTWnd) // Tooltip window successfully created
{
	TOOLINFO ti = { 0 };
	SetWindowPos(TTWnd, HWND_TOPMOST, 0, 0, 0, 0,
		SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);  // Set window position
	ti.cbSize = sizeof(TOOLINFO); // Size of structure
	ti.uFlags = TTF_SUBCLASS; // Class
	ti.hwnd = hWnd;	// Parent window is YOUR HANDLE OF YOUR WINDOW
	ti.hinst = 0;	// This instance
	ti.uId = 0;	// No uid
	ti.lpszText = tooltip;	// YOUR TOOLTIP text pointer
	GetClientRect(hWnd, &ti.rect);	// Tooltip to cover whole window
	SendMessage(TTWnd, TTM_ADDTOOL, 0, (LPARAM)&ti); // Send message adding tooltip to window
}

Try it on any window you like Smile | :)
In vino veritas

AnswerRe: Add tool tip to menu Pin
NoviceEx20-May-19 0:57
NoviceEx20-May-19 0:57 
GeneralRe: Add tool tip to menu Pin
phil.o20-May-19 1:04
professionalphil.o20-May-19 1:04 
QuestionHow to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 3:52
tianzhili439915-May-19 3:52 
AnswerRe: How to associate a row selected by ListControl with a specified path and file Pin
Richard MacCutchan15-May-19 3:59
mveRichard MacCutchan15-May-19 3:59 
QuestionRe: How to associate a row selected by ListControl with a specified path and file Pin
David Crow15-May-19 6:57
David Crow15-May-19 6:57 
AnswerRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 14:40
tianzhili439915-May-19 14:40 
SuggestionRe: How to associate a row selected by ListControl with a specified path and file Pin
David Crow15-May-19 16:28
David Crow15-May-19 16:28 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 22:42
tianzhili439915-May-19 22:42 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
Richard MacCutchan15-May-19 23:32
mveRichard MacCutchan15-May-19 23:32 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439916-May-19 0:06
tianzhili439916-May-19 0:06 
Questionsolved Linking "foreign" library - not build on running system ? Pin
Vaclav_12-May-19 17:46
Vaclav_12-May-19 17:46 
AnswerRe: Linking "foreign" library - not build on running system ? Pin
Richard MacCutchan12-May-19 21:19
mveRichard MacCutchan12-May-19 21:19 
QuestionC++, java Pin
Benjamin Apire9-May-19 10:47
Benjamin Apire9-May-19 10:47 
QuestionRe: C++, java Pin
David Crow9-May-19 17:10
David Crow9-May-19 17:10 
AnswerRe: C++, java Pin
CPallini9-May-19 21:22
mveCPallini9-May-19 21:22 
AnswerRe: C++, java Pin
Richard MacCutchan9-May-19 21:38
mveRichard MacCutchan9-May-19 21:38 
QuestionAnalyzing make error output - one problem solved.... Pin
Vaclav_8-May-19 6:38
Vaclav_8-May-19 6:38 

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.