c++ - Trying to get text from tooltips not working -
i've been trying couple of hours interrogate tooltips give text contain no avail. i've found how tooltip text given hwnd? , tried without success.
this shouldn't hard. i'm not sure i'm doing wrong. here's section of code:
bool callback enumwindowsproc( _in_ hwnd hwnd, _in_ lparam lparam ) { tchar classname[200]; getclassname(hwnd, classname, _countof(classname)); assert(iswindow(hwnd)); if (_tcscmp(classname, _t("tooltips_class32")) == 0) { toolinfo ti = { 0 }; ti.cbsize = sizeof(toolinfo); tchar text[500] = { 0 }; ti.lpsztext = text; ti.hwnd = getparent(hwnd); iswindow(ti.hwnd); ti.uid = getdlgctrlid(hwnd); int result = sendmessage(hwnd, ttm_gettext, _countof(text), (lparam)&ti); cstring info; info.format(_t("%p: %s \"%s\"\r\n"), hwnd, classname, ti.lpsztext); cstring& output = *(cstring*)lparam; output += info; } homecoming 1; } void ctooltipverifydlg::ontimer(uint_ptr nidevent) { m_output = ""; verify(enumwindows(enumwindowsproc, (lparam)&m_output)); systemtime systemtime; getlocaltime(&systemtime); cstring text; text.format(_t("%02u:%02u:%02u.%03u\r\n"), systemtime.whour, systemtime.wminute, systemtime.wsecond, systemtime.wmilliseconds); m_output = text + m_output; this->updatedata(false); cdialogex::ontimer(nidevent); } ctooltipverifydlg dialogue text box communicate m_output, cstring bound text box.
when sendmessage phone call done, on desktop (or desktop manager) crashes. ideas why crashing , not giving me text desire?
c++ winapi mfc
No comments:
Post a Comment