c++ - Tooltip in winapi -


i have tried use tooltip in winapi , worked want set position control specified. tooltip balloon. code, can tooltip appear , can set position of tooltip in screen not set position control specified. want set position of tooltip control specified eg: above, bellow, left or right of control image shows:

the tooltip left of control edit: the tooltip left of control edit

i have read in-place tooltips it's not helping!

so, how can set position tooltip? can give me example code?

this code:

void createtooltip (hwnd hwnd, tchar *tip, hwnd &hwndtooltip, toolinfo &tootip, bool ishow, int nx, int ny) {     // struct specifying control classes register     initcommoncontrolsex iccex;      hwnd hwndtt; // handle tooltip control     // struct specifying info tool in tooltip control      unsigned int uid = 0; // ti initialization     wchar_t strtt[30] = l"this tooltip string.";     lptstr lptstr = strtt;     rect rect; // client area coordinates      /* initialize common controls */     iccex.dwicc = icc_win95_classes;     iccex.dwsize = sizeof(initcommoncontrolsex);     initcommoncontrolsex(&iccex);      /* create tooltip window */     hwndtt = createwindowex(ws_ex_topmost,         tooltips_class,         null,         ws_popup | tts_noprefix | tts_alwaystip |tts_balloon,          cw_usedefault,         cw_usedefault,         cw_usedefault,         cw_usedefault,         hwnd,         null,         hinst_tooltip,         null         );     if (hwndtt==null)     {         messagebox(null,l"couldn't create tooltip control.",l"error",mb_ok);     }     setwindowpos(hwndtt,         hwnd_topmost,         0,         0,         0,         0,         swp_nomove | swp_nosize | swp_noactivate);      /* coordinates of main client area */     getclientrect (hwnd, &rect);     toolinfo ti;     /* initialize members of toolinfo structure */     //ti.cbsize = sizeof(toolinfo);     ti.cbsize = tttoolinfow_v2_size;//set size nhu vay moi chay dc project unicode     //ti.uflags = ttf_subclass;     //ti.uflags = ttf_centertip;     //ti.uflags = ttf_subclass;     ti.uflags = ttf_track|ttf_absolute;     ti.hwnd = hwnd;     ti.hinst = hinst_tooltip;     ti.uid = uid;     ti.lpsztext = tip;     // tooltip control cover whole window     ti.rect.left = rect.left;      ti.rect.top = rect.top;     ti.rect.right = rect.right;     ti.rect.bottom = rect.bottom;      hwndtooltip = hwndtt;     tootip = ti;      /* send addtool message tooltip control window */     if(!sendmessage(hwndtt, ttm_addtool, 0, (lparam) (lptoolinfo) &ti))     {         messagebox(null,l"couldn't create tooltip control.",l"error",mb_ok);     }     //sendmessage(hwndtt, ttm_setmargin,0, (lparam)&rectsetmargin);      //sendmessage(hwndtt, ttm_trackactivate, ishow, (lparam)(lptoolinfo) &ti);      sendmessage(hwndtt, ttm_trackposition, 0, (lparam)(dword) makelong(nx, ny));     sendmessage(hwndtt, ttm_trackactivate, ishow, (lparam)(lptoolinfo) &ti); }  


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -