Click here to Skip to main content
15,905,229 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to use msxml4.dll in project? Pin
David Crow3-May-04 7:37
David Crow3-May-04 7:37 
GeneralRe: How to use msxml4.dll in project? Pin
Anonymous3-May-04 9:54
Anonymous3-May-04 9:54 
Generaladd headers --->>>(request) webBrowser control Pin
Moschous Manos3-May-04 4:10
Moschous Manos3-May-04 4:10 
GeneralRe: add headers --->>>(request) webBrowser control Pin
Moschous Manos3-May-04 23:28
Moschous Manos3-May-04 23:28 
QuestionHow do I set up a CRITICAL_SECTION object? Pin
jerry1211a3-May-04 2:40
jerry1211a3-May-04 2:40 
AnswerRe: How do I set up a CRITICAL_SECTION object? Pin
Alexander M.,3-May-04 2:43
Alexander M.,3-May-04 2:43 
AnswerRe: How do I set up a CRITICAL_SECTION object? Pin
Monty23-May-04 3:26
Monty23-May-04 3:26 
AnswerRe: How do I set up a CRITICAL_SECTION object? Pin
Paul Ranson3-May-04 12:57
Paul Ranson3-May-04 12:57 
class CriticalSection
{
private :
    CRITICAL_SECTION cs_ ;
public :
    CriticalSection ()
    {
        ::InitializeCriticalSection ( &cs_ ) ;
    }
    ~CriticalSection ()
    {
        ::UninitializeCriticalSection ( &cs_ ) ;
    }
    operator CRITICAL_SECTION* ()
    {
        return &cs_ ;
    }
} ;

class CriticalSectionGuard
{
private :
    CRITICAL_SECTION * pcs_ ;
public :
    CriticalSectionGuard ( CRITICAL_SECTION * pcs ) : pcs_ ( pcs )
    {
        ::EnterCriticalSection ( pcs_ ) ;
    }
    ~CriticalSectionGuard ()
    {
        ::LeaveCriticalSection ( pcs_ ) ;
    }
} ;

class SharingSomeResource
{
private :
    CriticalSection cs_ ;
    ...
public :
    SomeMethodRequiringSynchronisation ()
    {
        CriticalSectionGuard csg ( cs_ ) ;
        // do your worst one at a time
    }
    ...
} ;

Above not compiled so probably rife with typos. Also not considered copy construction and operator=, as one ought. But should give the general idea.

Paul
Generalshrink parent window to fit child window Pin
Maxime Labelle3-May-04 2:10
Maxime Labelle3-May-04 2:10 
GeneralRe: shrink parent window to fit child window Pin
mangellj3-May-04 4:55
mangellj3-May-04 4:55 
GeneralRe: shrink parent window to fit child window Pin
Maxime Labelle3-May-04 5:51
Maxime Labelle3-May-04 5:51 
GeneralRe: shrink parent window to fit child window Pin
mangellj3-May-04 6:28
mangellj3-May-04 6:28 
GeneralRe: shrink parent window to fit child window Pin
David Crow3-May-04 7:36
David Crow3-May-04 7:36 
GeneralRe: shrink parent window to fit child window Pin
Blake Miller3-May-04 10:29
Blake Miller3-May-04 10:29 
GeneralDetecting ICS Pin
Anorexic Tribble3-May-04 2:07
Anorexic Tribble3-May-04 2:07 
GeneralRe: Detecting ICS Pin
Alexander M.,3-May-04 2:19
Alexander M.,3-May-04 2:19 
GeneralRe: Detecting ICS Pin
jcsston3-May-04 8:06
jcsston3-May-04 8:06 
QuestionHow to Use CRITICAL_SECTION and InitializeCriticalSection(&CriticalSection); Pin
jerry1211a3-May-04 2:02
jerry1211a3-May-04 2:02 
AnswerRe: How to Use CRITICAL_SECTION and InitializeCriticalSection(&CriticalSection); Pin
Alexander M.,3-May-04 2:07
Alexander M.,3-May-04 2:07 
GeneralApplication Error Pin
lvidot3-May-04 1:55
lvidot3-May-04 1:55 
GeneralRe: Application Error Pin
Alexander M.,3-May-04 2:02
Alexander M.,3-May-04 2:02 
GeneralRe: Application Error Pin
lvidot3-May-04 7:32
lvidot3-May-04 7:32 
GeneralRe: Application Error Pin
jmkhael3-May-04 3:02
jmkhael3-May-04 3:02 
GeneralRe: Application Error Pin
Joe Woodbury3-May-04 4:53
professionalJoe Woodbury3-May-04 4:53 
GeneralRe: Application Error Pin
lvidot3-May-04 21:33
lvidot3-May-04 21:33 

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.