0

i have these function for create the tooltip:

HWND CreateToolTip(HWND hwndTool, string text)
{

    /*INITCOMMONCONTROLSEX icc;

    icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icc.dwICC = ICC_BAR_CLASSES | ICC_TAB_CLASSES | ICC_WIN95_CLASSES;

    InitCommonControlsEx(&icc);*/
    if (text=="")
    {
        return FALSE;
    }
    // Get the window of the tool.
    //HWND hwndTool = GetDlgItem(hDlg, toolID);

    // Create the tooltip. g_hInst is the global instance handle.
    HWND hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
        TTS_ALWAYSTIP|WS_POPUP, //| TTS_BALLOON,
        CW_USEDEFAULT, CW_USEDEFAULT,
        CW_USEDEFAULT, CW_USEDEFAULT,
        GetParent(hwndTool), NULL,
        hinstance, NULL);

    if (!hwndTool || !hwndTip)
    {
        MessageBox(NULL, "Couldn't create the ToolTip control.", "Error", MB_OK);
        return (HWND)NULL;
    }



    // Associate the tooltip with the tool.
    TOOLINFO toolInfo = { 0 };
    toolInfo.cbSize =sizeof (TOOLINFO);// TTTOOLINFOA_V1_SIZE;
    toolInfo.hwnd = GetParent(hwndTool);
    toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
    toolInfo.uId = (UINT_PTR)hwndTool;
    toolInfo.lpszText =(LPSTR) text.c_str();



    if (!SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &toolInfo)) //Will add the Tool Tip on Control
    {
        MessageBox(NULL,to_string(GetLastError()).c_str(), "Error", MB_OK);
    }

    if (SendMessage(hwndTip, TTM_ACTIVATE, TRUE,0)) //Will add the Tool Tip on Control
    {
        MessageBox(NULL,to_string(GetLastError()).c_str(), "Error", MB_OK);

    }

    return hwndTip;
}

my question is: how can i show the ToolTip manually?
i was trying using the ShowWindow() function, but my region function is affecting if the tooltip is showing or not(i'm testing)

2
Contributors
2
Replies
12
Views
1 Year
Discussion Span
Last Post by cambalinho
0

my Region code affects the ToolTip control. so i did my own ToolTip control and now works fine. thanks for all

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.