Click here to Skip to main content
15,894,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCreating a DLL with Web Browser Embedded Pin
Don Guy17-Sep-13 9:48
Don Guy17-Sep-13 9:48 
AnswerRe: Creating a DLL with Web Browser Embedded Pin
Richard Andrew x6417-Sep-13 15:34
professionalRichard Andrew x6417-Sep-13 15:34 
AnswerRe: Creating a DLL with Web Browser Embedded Pin
Richard MacCutchan17-Sep-13 21:04
mveRichard MacCutchan17-Sep-13 21:04 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Don Guy18-Sep-13 4:15
Don Guy18-Sep-13 4:15 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Richard MacCutchan18-Sep-13 4:33
mveRichard MacCutchan18-Sep-13 4:33 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Don Guy18-Sep-13 6:04
Don Guy18-Sep-13 6:04 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Richard MacCutchan18-Sep-13 6:31
mveRichard MacCutchan18-Sep-13 6:31 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Don Guy18-Sep-13 6:52
Don Guy18-Sep-13 6:52 
GeneralRe: Creating a DLL with Web Browser Embedded Pin
Richard MacCutchan18-Sep-13 6:57
mveRichard MacCutchan18-Sep-13 6:57 
AnswerRe: Creating a DLL with Web Browser Embedded Pin
jschell19-Sep-13 11:19
jschell19-Sep-13 11:19 
QuestionUnable to set focus in CPropertyPage in MFC. update solved?? Pin
Vaclav_17-Sep-13 5:05
Vaclav_17-Sep-13 5:05 
QuestionRe: Unable to set focus in CPropertyPage in MFC. Pin
jeron117-Sep-13 6:27
jeron117-Sep-13 6:27 
AnswerRe: Unable to set focus in CPropertyPage in MFC. Pin
Vaclav_17-Sep-13 7:08
Vaclav_17-Sep-13 7:08 
QuestionRe: Unable to set focus in CPropertyPage in MFC. update solved?? Pin
David Crow17-Sep-13 7:51
David Crow17-Sep-13 7:51 
AnswerRe: Unable to set focus in CPropertyPage in MFC. update solved?? Pin
Vaclav_17-Sep-13 9:54
Vaclav_17-Sep-13 9:54 
QuestionRe: Unable to set focus in CPropertyPage in MFC. update solved?? Pin
David Crow18-Sep-13 2:50
David Crow18-Sep-13 2:50 
AnswerRe: Unable to set focus in CPropertyPage in MFC. update solved?? Pin
Vaclav_18-Sep-13 7:50
Vaclav_18-Sep-13 7:50 
QuestionOutlook Addins Pin
john563216-Sep-13 22:55
john563216-Sep-13 22:55 
AnswerRe: Outlook Addins Pin
Richard MacCutchan17-Sep-13 0:31
mveRichard MacCutchan17-Sep-13 0:31 
Questionhow to lock function? Pin
JoneLe8616-Sep-13 18:09
JoneLe8616-Sep-13 18:09 
AnswerRe: how to lock function? Pin
Richard MacCutchan16-Sep-13 20:41
mveRichard MacCutchan16-Sep-13 20:41 
AnswerRe: how to lock function? Pin
CPallini16-Sep-13 21:18
mveCPallini16-Sep-13 21:18 
AnswerRe: how to lock function? Pin
Freak3016-Sep-13 22:06
Freak3016-Sep-13 22:06 
If you want something inside the function protected from parallel/recursive calls, you can do that by placing a criitical section and a class member variable inside it. If don't want the function to be called at all, you could make it private and add a public function as the only one that calls it. It could look something like that:
C++
void somePublicFunc()
{
    EnterCriticalSection(); // keep other treads out
    try
    {
        if (!alreadyRunning) // static private member variable to prevent recursive calls
        {
            alreadyRunning = true;
            privateFunction();
            alreadyRunning = false;
        }
    }
    catch (...)
    {
        alreadyRunning = false; // important to do that before leaving the critical section
        LeaveCriticalSection(); // prevent a dead lock
        throw; // let the caller decide what to do with the initial exception
    }
    LeaveCriticalSection();
}

So privateFunction() will only be called once at a time no matter from which thread (provided you don't add another member function that calls it or introduce any friend classes).
The good thing about pessimism is, that you are always either right or pleasently surprised.

GeneralRe: how to lock function? Pin
pasztorpisti17-Sep-13 0:27
pasztorpisti17-Sep-13 0:27 
QuestionWhat does it mean when...... Pin
Richard Andrew x6416-Sep-13 10:42
professionalRichard Andrew x6416-Sep-13 10:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.