0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by destiny.city
If somebody can send me the answers for the MFC questions plzzzzzzzzzzzzzzz, i have an interview
All answers are there in the thread itself. Try and read the thread and you will find them.
0
Jegan's Avatar, Join Date: Aug 2007
Newbie Member
CObject is the base class for almost all of the MFC classes.
0
riddhi's Avatar, Join Date: Apr 2008
Newbie Member
Quote:
Originally Posted by rajeswaridvssnr
Run-Time Type Information is a mechanism that allows the type of an object to be determined during the program execution.
3 main elements to RTTI in MFC are

1.Dynamic_cast operator
Used for conversion of polymorphic types.
2.typeid - used for identifying the exact type of an object
3. type_info class
used to hold the type information returned by typeid.
RTTI in MFC can be done using RUNTIME_CLASS Macro in conjunction with CObject's IsKindOf member function. The argument to IsKindOf is a CRuntimeClass object, which you can get using the RUNTIME_CLASS macro with the name of the class.
0
riddhi's Avatar, Join Date: Apr 2008
Newbie Member
Message Maps, maps the user action in to the appropriate MFC class functions to handle it. The MFC Class which can handle message should be member of CCmdTarget, (i.e) it should be hierarchically derived from CCmdTarget.

The BEGIN_MESSAGE_MAP macro at the start of the message map specifies two class names as its arguments:
BEGIN_MESSAGE_MAP(CMyView, CView)
The first argument names the class to which the message map belongs. The second argument provides a connection with the immediate base class — CView here — so the framework can search its message map, too.

The message handlers provided in a base class are thus inherited by the derived class. This is very similar to normal virtual member functions without needing to make all handler member functions virtual which is an advantage since overhead of creating VTable is eliminated.

If no handler is found in any of the base-class message maps, default processing of the message is performed. If the message is a command, the framework routes it to the next command target. If it is a standard Windows message, the message is passed to the appropriate default window procedure.
0
riddhi's Avatar, Join Date: Apr 2008
Newbie Member
Quote:
Originally Posted by shabbir
Use the SetTimer function
Code: CPP
UINT_PTR SetTimer(          HWND hWnd,
    UINT_PTR nIDEvent,
    UINT uElapse,
    TIMERPROC lpTimerFunc
);
To kill the timer use
Code: CPP
BOOL KillTimer(int nIDEvent);
Where the nIDEvent is the ID returned by the SetTimer Function.
Also overide the OnTimer message to do the handling in your class
0
bhagvat4u's Avatar, Join Date: May 2008
Newbie Member
Why are some classed are not derived from CObject?
0
bhagvat4u's Avatar, Join Date: May 2008
Newbie Member
Some additin to Que - Why we need 4 types of synchronization objects ? What is the exact diff between these?
0
bhagvat4u's Avatar, Join Date: May 2008
Newbie Member
What is the diff between SDI/MDI and Dialog based app? Is Dialog based app support Doc/View Arc?
0
freeray's Avatar, Join Date: Jul 2008
Newbie Member
Quote:
Originally Posted by rajeswaridvssnr
Create a Named Mutex.
HANDLE hMutex=CreateMutex(TRUE,_T(“NamedMutex”))
delcare the structure function as private

create a static instance as private

a static function return the point to the instance

like

class MyClass
{
public:
~MyClass();

static MyClass* GetInstance(){static MyClass instance; return &instance}

private:
MyClass();

};
0
ramarao44's Avatar, Join Date: Apr 2010
Newbie Member
thank you