Mar 25, 2013 at 10:22am UTC
Am working on VC++ background application that saves the url of browser whenever the user visits a page. With the below code i can able to track the url thats comes from INTERNET EXPLORER but when i visit the url through FIREFOX, i cant able to track the url.
I can access the log after "bstrVal && wcslen(bstrVal) > 4" in IE but not in firefox. Please help
if ( event == EVENT_OBJECT_VALUECHANGE || EVENT_OBJECT_NAMECHANGE == event /*|| event == EVENT_OBJECT_SHOW ||
event == EVENT_OBJECT_CREATE || event == EVENT_OBJECT_STATECHANGE */ )
{
if ( IsUserInputIdle()) // do not monitor UI events if there is no user input.
{
return;
}
IAccessible* pAcc = NULL;
VARIANT varChild;
HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
if ( (hr == S_OK) && (pAcc != NULL) )
{
BSTR bstrName;
WCHAR wstr[1500]={L""};
WCHAR wstr_event[1500]={L""};
WCHAR wstr_win_class[500]={L""};
pAcc->get_accName(varChild, &bstrName);
BSTR bstrVal=0;
pAcc->get_accValue(varChild, &bstrVal);
if (bstrVal && wcslen(bstrVal) > 4)
{
if ( wcsstr(bstrVal, L"http") || wcsstr(bstrVal, L"www") || wcsstr(bstrVal, L"ftp") || wcsstr(bstrVal, L":\\\\") )
{
char txt[6000], buff[6000] ;
if ( wcslen(bstrVal) > 250)
bstrVal[250]=0;
wcstombs(txt, bstrVal, 590);
txt[250]=0;
if ( stricmp(last_url, txt) !=0)
{
// the new url differs from old one.
strcpy(last_url, txt);
if ( 1 == _safe_logger )
{
AddLOG_message(txt, 0, 0);
AddLOG_message(cr,2, 0);
}
else
{
sprintf(buff, "<br><a href='%s'>%s</a><br>", txt, txt);
AddLOG_message(buff, 0, 0);
}
}
}
SysFreeString(bstrVal);
}
pAcc->Release();
} else
{
//SendMessage( GetDlgItem(hwnd1, IDC_LIST1 ), LB_ADDSTRING, 0, (LPARAM)"Error");
}
}