Is MFC thread-safe? DialogBar with DLGTEMPL?
-
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
-
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
Follow this link to find the appropiate forum for your question. :omg: Normski. - Professional Windows Programmer
-
Follow this link to find the appropiate forum for your question. :omg: Normski. - Professional Windows Programmer
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
-
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
-
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
-
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
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
-
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
-
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