c++ - How do I refresh a browser window? -
currently, i'm refreshing browser window using following sendinput
hack:
void generatekey ( int vk , bool bextended) { keybdinput kb={0}; input input={0}; // generate down if ( bextended ) kb.dwflags = keyeventf_extendedkey; kb.wvk = vk; input.type = input_keyboard; input.ki = kb; ::sendinput(1,&input,sizeof(input)); // generate ::zeromemory(&kb,sizeof(keybdinput)); ::zeromemory(&input,sizeof(input)); kb.dwflags = keyeventf_keyup; if ( bextended ) kb.dwflags |= keyeventf_extendedkey; kb.wvk = vk; input.type = input_keyboard; input.ki = kb; ::sendinput(1,&input,sizeof(input)); }
i use like:
browserhandle = cwnd::findwindow(null, "mytitle - <insert browser name here>"); browserhandle->setforegroundwindow(); generatekey(vk_f5, false);
i think flaky approach , unpredictable. know approach fail unpredictably because user might typing real fast in text editor , f5 key generation may never reach browser window.
basically need to:
- display html file first on user event a.
- on user event again, modify html file.
- if file displayed, refresh window.
is there no winapi me this? need respect user preferences default associations, tab behaviour, etc. looked @ iwebbrowser2
interface wasn't impressed because seemed support internet explorer.
can please tell me of better way?
Comments
Post a Comment