Thursday, February 12, 2009

[VC++] You should know this !

Here is a set of things that you should know about your application,
  • Returning 0 from InitInstance( ) will close your application.
  • m_pMainWnd which contains address of your application main window is a public data member of CWinApp class. AfxGetMainWnd( ) function returns the address stored in m_pMainWnd i.e. address of frame window.
  • AfxGetApp( ) returns address of your application object. So AfxGetApp( ) can be used to call member functions or access public data members of CWinApp class.
  • Set WS_VISIBLE style in Create( ) function then no need to call ShowWindow( ).
  • MAKEINTRESOURCE macro (declared in 'windows.h') converts an integer to string.
  • Selecting 'Use MFC in static DLL' (from Project->Settings->General) will create a standalone EXE but the size of your EXE will be much large.
  • Functions with a prefix 'Afx' are global function which can be accessed from anywhere.

No comments: