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. The Lounge
  3. Is MFC thread-safe? DialogBar with DLGTEMPL?

Is MFC thread-safe? DialogBar with DLGTEMPL?

Scheduled Pinned Locked Moved The Lounge
c++data-structuresperformancequestiondiscussion
8 Posts 5 Posters 1 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.
  • H Offline
    H Offline
    HintiFlo
    wrote on last edited by
    #1

    I already posted this 2 questions in the VC Forum, but nobody gave a f..., oops, sorry; nobody was interested in! They're quite general, so I think the fit in the lounge too,... here it comes: 1.) Is MFC thread-safe by itself? I worked with Joseph Newcomers (veryvery good) Queue-class and dicoverd, that it works fine without any syncs! So I used CLists directly in an MT-App and it works fine! 2.) Can I build a CDialogBAR from an in memory resource, a DLGTEMPLATEEX? I prefer memorybased Dialogs then .rc-based one for several reasons and I wanna do so with DialogBars, too. Is it possible? What do you think about DLGTEMPLATE-Dialogs at all, any pros or contras? mfg HintiFlo

    N V 2 Replies Last reply
    0
    • H HintiFlo

      I already posted this 2 questions in the VC Forum, but nobody gave a f..., oops, sorry; nobody was interested in! They're quite general, so I think the fit in the lounge too,... here it comes: 1.) Is MFC thread-safe by itself? I worked with Joseph Newcomers (veryvery good) Queue-class and dicoverd, that it works fine without any syncs! So I used CLists directly in an MT-App and it works fine! 2.) Can I build a CDialogBAR from an in memory resource, a DLGTEMPLATEEX? I prefer memorybased Dialogs then .rc-based one for several reasons and I wanna do so with DialogBars, too. Is it possible? What do you think about DLGTEMPLATE-Dialogs at all, any pros or contras? mfg HintiFlo

      N Offline
      N Offline
      NormDroid
      wrote on last edited by
      #2

      Follow this link to find the appropiate forum for your question. :omg: Normski. - Professional Windows Programmer

      N 1 Reply Last reply
      0
      • N NormDroid

        Follow this link to find the appropiate forum for your question. :omg: Normski. - Professional Windows Programmer

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        I think what he said was that, he had posted it in the VC++ forum, but he didn't get any replies, and so he decided to re-post it here. So obviously he understands the existence of the C++ forum, but he is not happy with the speed of response. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

        N H 2 Replies Last reply
        0
        • N Nish Nishant

          I think what he said was that, he had posted it in the VC++ forum, but he didn't get any replies, and so he decided to re-post it here. So obviously he understands the existence of the C++ forum, but he is not happy with the speed of response. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

          N Offline
          N Offline
          NormDroid
          wrote on last edited by
          #4

          I know :) I need a :sarcastic emoticon: after the link :) Normski. - Professional Windows Programmer

          1 Reply Last reply
          0
          • N Nish Nishant

            I think what he said was that, he had posted it in the VC++ forum, but he didn't get any replies, and so he decided to re-post it here. So obviously he understands the existence of the C++ forum, but he is not happy with the speed of response. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

            H Offline
            H Offline
            HintiFlo
            wrote on last edited by
            #5

            Thank you for not killing me like others want to! important: Whats your opinion about MFCs built in syncs and the memory-based DlgBar? not so important: Is the lounge intended to be free of technical-talk at all? thx&mfg HintiFlo

            _ 1 Reply Last reply
            0
            • H HintiFlo

              I already posted this 2 questions in the VC Forum, but nobody gave a f..., oops, sorry; nobody was interested in! They're quite general, so I think the fit in the lounge too,... here it comes: 1.) Is MFC thread-safe by itself? I worked with Joseph Newcomers (veryvery good) Queue-class and dicoverd, that it works fine without any syncs! So I used CLists directly in an MT-App and it works fine! 2.) Can I build a CDialogBAR from an in memory resource, a DLGTEMPLATEEX? I prefer memorybased Dialogs then .rc-based one for several reasons and I wanna do so with DialogBars, too. Is it possible? What do you think about DLGTEMPLATE-Dialogs at all, any pros or contras? mfg HintiFlo

              V Offline
              V Offline
              Vagif Abilov
              wrote on last edited by
              #6

              1. MFC window classes have thread affinity, so you should not access UI functions from the threads other than the one that own UI object. 2. MFC non-window classes (strings, containers etc.) do not implement concurrent thread protection, but may be used in MT environment. In such case you'll need to extend them with locks, for example: template class CSyncMap : public CMap { protected: CCriticalSection m_cs; // Construction public: CSyncMap(int nBlockSize = 10) : CMap(nBlockSize) {} int GetCount() const { CSingleLock locker(&m_cs, TRUE); int nRet = CMap::GetCount(); return nRet; } BOOL Lookup(ARG_KEY key, VALUE& rValue) const { CSingleLock locker(&m_cs, TRUE); BOOL bRet = CMap::Lookup(key, rValue); return bRet; } VALUE& operator[](ARG_KEY key) { CSingleLock locker(&m_cs, TRUE); VALUE& val = CMap::operator[](key); return val; } void SetAt(ARG_KEY key, ARG_VALUE newValue) { CSingleLock locker(&m_cs, TRUE); CMap::SetAt(key, newValue); } // etc... }; Good luck! Vagif Abilov COM+/ATL/MFC Developer Oslo, Norway

              1 Reply Last reply
              0
              • H HintiFlo

                Thank you for not killing me like others want to! important: Whats your opinion about MFCs built in syncs and the memory-based DlgBar? not so important: Is the lounge intended to be free of technical-talk at all? thx&mfg HintiFlo

                _ Offline
                _ Offline
                _Magnus_
                wrote on last edited by
                #7

                The only things acceptable at the lounge are 'joke of the day' and discussions about inflatable sheeps. Anyone posting anything related to programming in any way will be hunted down, tortured and hung by the neck for others to see. :cool: /Magnus

                H 1 Reply Last reply
                0
                • _ _Magnus_

                  The only things acceptable at the lounge are 'joke of the day' and discussions about inflatable sheeps. Anyone posting anything related to programming in any way will be hunted down, tortured and hung by the neck for others to see. :cool: /Magnus

                  H Offline
                  H Offline
                  HintiFlo
                  wrote on last edited by
                  #8

                  AAAAAAAAAAAAHHHHHH HEEEELP, HEEEELP, HEEEELP! THE CODEPROJECT POLICE ALREADY CAUGHT ME!!! mfg HintiFlo ;) ;) ;) ;) ;)

                  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