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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Handle maps

Handle maps

Scheduled Pinned Locked Moved C / C++ / MFC
helpjsontutorialquestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Budric B
    wrote on last edited by
    #1

    Hi, I'm having trouble with handle maps. I've been reading some information about the topic but I don't see how it applies to the problem I'm having. Basically I have a class that represents a camera. It's a wrapper for API calls to set properties and capture images. The camera class also has a modeless dialog box as one of its members to display camera properties to the user. The dialog is created and exists for the lifetime of the camera class and there are function to show/hide it. For some reason the following fails bool MultipleCameraWrapper::SetShutter(int nShutter) { ... //update the dialog this->m_pConfigDlg->m_nShutter = nShutter; this->m_pConfigDlg->UpdateData(FALSE); //FAIL! } More specifically CHandleMap* pMap = afxMapHWND(); returns NULL inside UpdateData(). Can someone tell me why and how to fix it?

    S 1 Reply Last reply
    0
    • B Budric B

      Hi, I'm having trouble with handle maps. I've been reading some information about the topic but I don't see how it applies to the problem I'm having. Basically I have a class that represents a camera. It's a wrapper for API calls to set properties and capture images. The camera class also has a modeless dialog box as one of its members to display camera properties to the user. The dialog is created and exists for the lifetime of the camera class and there are function to show/hide it. For some reason the following fails bool MultipleCameraWrapper::SetShutter(int nShutter) { ... //update the dialog this->m_pConfigDlg->m_nShutter = nShutter; this->m_pConfigDlg->UpdateData(FALSE); //FAIL! } More specifically CHandleMap* pMap = afxMapHWND(); returns NULL inside UpdateData(). Can someone tell me why and how to fix it?

      S Offline
      S Offline
      S Senthil Kumar
      wrote on last edited by
      #2

      Are you calling it from a different thread than the one that created it? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

      B 1 Reply Last reply
      0
      • S S Senthil Kumar

        Are you calling it from a different thread than the one that created it? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        B Offline
        B Offline
        Budric B
        wrote on last edited by
        #3

        Yes I am.

        S 1 Reply Last reply
        0
        • B Budric B

          Yes I am.

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          Well then that's the problem. MFC stores handles in Thread Local Storage, so they aren't available from another thread. It's not a good idea to update the UI from another thread anyway (http://www.codeproject.com/csharp/begininvoke.asp[^]. I'd suggest posting a message to the UI instead (using PostMessage) and handling the message there. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

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