What is CMutex? How can we use it?

What is CMutex? How can we use it? What are frames and CFrameWnd?

a.)What is CMutex? How can we use it?

CMutex is a synchronization class which uses synchronization object named as mutex. It allows multiple program thread can share the same resource by taking turns. At the starting of the program it creates a mutex at beginning and then a system gives a unique ID or name for it. After that, any thread which needs the resource can use the mutex to lock the resource. For example access of a file. To use CMutex construct its object when it is needed to be accessed. Give the name of mutex and to the application will own it. You can access mutex when constructor returns again to the start. When you are done accessing the controlled resource then call CSyncObject::Unlock.

b.) What are frames and CFrameWnd?

Frames contain view windows. Frame windows allow the user the capability to use status bars, toolbars, and splitters.

CFrameWnd contains the implementation to perform the function of a main window as wells as it keeps track of currently active view that is independent of Windows active window or input focus. It also provides the functionality of a Windows single document interface (SDI) overlapped. This is contained in CFrameWnd class.

For example:
class CFrameWnd : public CWnd
What is CWinThread class? Explain its advantages.
At the beginning of every application has one and only one thread, called as primary thread. CWinApp which is the user derived class encapsulates this thread..............
Explain the significance of InitApplication() in VC++.
InitApplication() function is a Boolean method to display an output. This gives output as true if application executes correctly..............
What is a copy constructor? What is the need for it?
Copy constructor is a constructor type which is of the same name as the class and it is used to constructs an object by copying the state from another object.........
Post your comment