Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Roger65

@Roger65
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Are you a coffee snob?
    R Roger65

    I use MJB only $5.99 for 3 pounds.

    Old dog learning new tricks!

    The Lounge question

  • VS2010 Application Wizard
    R Roger65

    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!

    C / C++ / MFC c++ question learning

  • Worker Thread
    R Roger65

    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!

    C / C++ / MFC help learning

  • Worker Thread
    R Roger65

    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!

    C / C++ / MFC help learning

  • Worker Thread
    R Roger65

    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!

    C / C++ / MFC help learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups