Hi,
I upgraded my PScript printer driver plug-in to the latest
DDK i.e., XP SP1 DDK and all my balloon tips are not
working now. After some debugging I found out that
registration for the tootip control is failing i.e., my
SendMesssage command with TTM_ADDTOOL fails and return
false. There is no error registered, when I called
GetLastError() it returns success. Same code worked when I
compiled under older windows 2000 DDK.
Also attached is the code snippet.
Thanks,
Athar Ahmad.
Sr. Software Engineer.
MINOLTA-QMS Inc.
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
////////////////////////
static LRESULT RegisterBalloonTips(HWND hDlg)
{
//Ensure that the DLL containing the tooltip control is
loaded
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
BOOL InitCtrlsOk = InitCommonControlsEx(&InitCtrls);
//Create the tooltip control
hwndBalloonTip = CreateWindowEx(NULL, TOOLTIPS_CLASS,
NULL, WS_EX_TOOLWINDOW | WS_POPUP | TTS_NOPREFIX |
TTS_BALLOON | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, hDlg, NULL, ghInstance,
NULL);
SetWindowPos(hwndBalloonTip, HWND_TOPMOST,0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
//Activate the tooltip control
SendMessage(hwndBalloonTip, TTM_ACTIVATE, (WPARAM) TRUE,
(LPARAM) 0);
//Force multi-line ballloon tip
SendMessage(hwndBalloonTip, TTM_SETMAXTIPWIDTH, 0,
MAX_BALLOON_TIP_WIDTH);
//Preset the return code
LRESULT TTMOk = TRUE;
//Set arguments shared among tools
ToolInfo.cbSize = sizeof(TOOLINFO);
ToolInfo.uFlags = TTF_IDISHWND | TTF_TRACK ;
ToolInfo.hwnd = hDlg;
ToolInfo.hinst = NULL;
ToolInfo.lParam = 0;
ToolInfo.lpszText = LPSTR_TEXTCALLBACK;
//Register tools with tooltip control
ToolInfo.uId = (UINT_PTR)GetDlgItem(hDlg, IDC_WIDTH);
TTMOk = (SendMessage (hwndBalloonTip, TTM_ADDTOOL,
(WPARAM) 0, (LPARAM) &ToolInfo) == TRUE) ? TTMOk : FALSE;
//Register tools with tooltip control
ToolInfo.uId = (UINT_PTR)GetDlgItem(hDlg, IDC_HEIGHT);
TTMOk = (SendMessage (hwndBalloonTip, TTM_ADDTOOL,
(WPARAM) 0, (LPARAM) &ToolInfo) == TRUE) ? TTMOk : FALSE;
return TTMOk;
}