I use MJB only $5.99 for 3 pounds.
Old dog learning new tricks!
I use MJB only $5.99 for 3 pounds.
Old dog learning new tricks!
In the application wizard, next to the last screen there is an option to have a Properties window added to your MFC Doc/View app. It is static, what does it take to make it functional?
Old dog learning new tricks!
That was version 1.0 it didn't get the cursor from the desktop, just the dialog box. You did however give me a clue, I put a Sleep(1) inside the while(exitcode == STILL_ALIVE), cpu usage dropped to 0. Old dog learning new tricks!
The reason for the seperate thread is if the SetCapture is in the same thread as the controls window they don't get mouse messages. You say wait for the thread handle, what is it destrored? Old dog learning new tricks!
Here is my worker thread that I create ever 100ms in the OnTimer() function, it works but uses 97% of the cpu. Any help would be appreciated. POINT pt; // Global for GetMouseProc & OnTimer. UINT GetMouseProc(LPVOID pParam) { HWND hwnd = ::GetDesktopWindow(); ::SetCapture(hwnd); ::GetCursorPos(&pt); ::ReleaseCapture(); ::ExitThread(0); return 0; } void CColorTakeDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default HWND m_hwnd = ::GetDesktopWindow(); CString str; // ======================================================================= // Get the mouse pointer position and display it // ======================================================================= DWORD ExitCode = STILL_ACTIVE; HANDLE m_hThread; if(pThread == NULL) { pThread = AfxBeginThread(GetMouseProc, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED, NULL); pThread->m_bAutoDelete = FALSE; m_hThread = pThread->m_hThread; } pThread->ResumeThread(); while(ExitCode == STILL_ACTIVE) { ::GetExitCodeThread(m_hThread, &ExitCode); } delete(pThread); pThread = NULL; str.Format("X: %d, Y: %d", pt.x, pt.y); m_mouse.SetWindowText((LPCTSTR)str); Old dog learning new tricks!