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)

Recommended Answers

All 2 Replies

And what do you mean by manually?
Please explain....

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.