Programmatic send copy command (CTRL+C)
-
I found this link http://vb-helper.com/howto_copy_all_browser_text.html I tried to imitate the function DoEvents as so
void DoEvents(int milisec=5) { MSG msg; DWORD dwStart=GetTickCount(); while (true) { if(GetTickCount()-dwStart>milisec)return; if(!PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } }
But when I call the functions - it's not working... How do I do it in C++ Thanks in advance -
I found this link http://vb-helper.com/howto_copy_all_browser_text.html I tried to imitate the function DoEvents as so
void DoEvents(int milisec=5) { MSG msg; DWORD dwStart=GetTickCount(); while (true) { if(GetTickCount()-dwStart>milisec)return; if(!PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } }
But when I call the functions - it's not working... How do I do it in C++ Thanks in advance -
I found this link http://vb-helper.com/howto_copy_all_browser_text.html I tried to imitate the function DoEvents as so
void DoEvents(int milisec=5) { MSG msg; DWORD dwStart=GetTickCount(); while (true) { if(GetTickCount()-dwStart>milisec)return; if(!PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } }
But when I call the functions - it's not working... How do I do it in C++ Thanks in advanceWhat in the world does this code snippet have to with this thread's subject? :rolleyes:
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I found this link http://vb-helper.com/howto_copy_all_browser_text.html I tried to imitate the function DoEvents as so
void DoEvents(int milisec=5) { MSG msg; DWORD dwStart=GetTickCount(); while (true) { if(GetTickCount()-dwStart>milisec)return; if(!PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } }
But when I call the functions - it's not working... How do I do it in C++ Thanks in advanceyytg wrote:
I tried to imitate the function DoEvents
:laugh:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
I found this link http://vb-helper.com/howto_copy_all_browser_text.html I tried to imitate the function DoEvents as so
void DoEvents(int milisec=5) { MSG msg; DWORD dwStart=GetTickCount(); while (true) { if(GetTickCount()-dwStart>milisec)return; if(!PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } }
But when I call the functions - it's not working... How do I do it in C++ Thanks in advanceyytg wrote:
I tried to imitate the function DoEvents as so
yytg wrote:
But when I call the functions - it's not working... How do I do it in C++
I've had a need to implement DoEvents in C++ myself, and wrote something that works. Here is what I came up with.
namespace { void DoEventsPumpMessage() { CWinThread *pThread = AfxGetThread(); if( !pThread->PumpMessage() ) { int nResult = (int)AfxGetCurrentMessage()->wParam; // value from PostQuitMessage ::PostQuitMessage(nResult); // so the main message loop will get it. TRACE("DoEvents Received quit message\n"); CQuitMessageException::Throw(); } } } void DoEvents( bool bAtLeastOne ) { if( bAtLeastOne ) { DoEventsPumpMessage(); } MSG message; while( ::PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE ) ) { DoEventsPumpMessage(); } }
Many message loops I've seen just assume there won't be a quit message, but in my case, I really wanted to avoid runaway background threads. Nathan