In Visual Studio 2005 or a later version, you can use APIs to create a tootip. After creation, messages such as ttm_addtool will fail to be sent because the loaded commctrl dll version does not match. The solution is as follows:
1. Change # DEFINE _ win32_winnt 0x0501 to # DEFINE _ win32_winnt 0x0500 in the stdafx. h file.
2. Add the following code before # include "commctrl. H" # pragma comment (Lib, "comctl32.lib:
# If _ win32_winnt> 0x0500
# If defined _ m_ix86
# Pragma comment (linker, "/manifestdependency:/" type = 'win32 'name = 'Microsoft. windows. common-controls 'version = '6. 0.0.0 'processorarchitecture = 'x86 'publickeytoken = '6595b64144ccf1df' Language = '*'/"")
# Elif defined _ m_ia64
# Pragma comment (linker, "/manifestdependency:/" type = 'win32 'name = 'Microsoft. windows. common-controls 'version = '6. 0.0.0 'processorarchitecture = 'ia64' publickeytoken = '6595b64144ccf1df 'Language = '*'/"")
# Elif defined _ m_x64
# Pragma comment (linker, "/manifestdependency:/" type = 'win32 'name = 'Microsoft. windows. common-controls 'version = '6. 0.0.0 'processorarchitecture = 'amd64' publickeytoken = '6595b64144ccf1df 'Language = '*'/"")
# Else
# Pragma comment (linker, "/manifestdependency:/" type = 'win32 'name = 'Microsoft. windows. common-controls 'version = '6. 0.0.0 'processorarchitecture = '*' publickeytoken = '6595b64144ccf1df 'Language = '*'/"")
# Endif
# Endif
3. Change the cbsize when filling the toolinfo structure, as shown below:
Toolinfo Ti;
Memset (& Ti, 0, sizeof (toolinfo ));
# If _ win32_winnt> 0x0500
Ti. cbsize = sizeof (toolinfo)-sizeof (void *);
# Else
Ti. cbsize = sizeof (toolinfo );
# Endif
The reason is that when _ win32_winnt is greater than 0x0500, The toolinfo struct has an additional lparam definition, resulting in a mismatch between sizeof (toolinfo) and the old version.
We recommend that you use 3rd methods. Because the previous two methods modify the entire commctrl dll version, the system will use a lower version of commctrl DLL.
The sample code is as follows:
Hwnd hwindow =: createjavaswex (null, tooltips_class, null, ws_popup | tts_noprefix | average, cw_usedefault, null, (hmenu) 0, null, null );
Toolinfo Ti;
Memset (& Ti, 0, sizeof (toolinfo ));
# If _ win32_winnt> 0x0500
Ti. cbsize = sizeof (toolinfo)-sizeof (void *);
# Else
Ti. cbsize = sizeof (toolinfo );
# Endif
... // Other data Filling
: Sendmessage (hwindow, ttm_addtool, 0, & Ti );