The command to enable large address aware is as follows…

EditBin /LARGEADDRESSAWARE NotePad.exe

How to check if the above command worked or not? Run the above executable (in our case NotePad.exe) with DumpBin.exe.

C:\> DumpBin /Headers NotePad.exe

FILE HEADER VALUES
             14C machine (x86)
               4 number of sections
        4BA1DC16 time date stamp Thu Mar 18 02:53:58 2010
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             122 characteristics
                   Executable
Application can handle large (>2GB) addresses
                   32 bit word machine

See highlighted line.

Share
 

What do we mean by intrinsic?

Most functions are contained in libraries, but some functions are built in (that is, intrinsic) to the compiler. These are referred to as intrinsic functions or intrinsics.

Taken from MSDN…

The __noop intrinsic specifies that a function should be ignored and the argument list be parsed but no code be generated for the arguments. It is intended for use in global debug functions that take a variable number of arguments.

The compiler converts the __noop intrinsic to 0 at compile time. The following code shows how you could use __noop.
 

// compiler_intrinsics__noop.cpp
// compile with or without /DDEBUG
#include <stdio.h>

#if DEBUG
   #define PRINT   printf_s
#else
   #define PRINT   __noop
#endif

int main()
{
   PRINT("\nhello\n");
}

So if you have custom macros which should expand to nought in release version the proper way to do this would be via __noop. Remember this is Microsoft(R) specific.

Share
 

Did you ever want to know how a C++ class was laid out by VC++ compiler? There are few hidden switches which are not known to many hence would like to share those with my blog readers.

So I will blog about these switches one by one. So for today the switch I’m going to discuss is: /d1reportSingleClassLayoutSomeType. SomeType in the name is just a placeholder for actual class name.

So for a demo we know that there is a class called CDialog in MFC. So create a sample MFC project and add the following command line manually to the project’s settings. Goto C/C++->CommandLine->Additional Options and enter /d1reportSingleClassLayoutCDialog manually into the additional options edit control, as shown in the screenshot below…

MFC Project Properties

Once you are done rebuild your project. When I rebuild this is what I see in my output window. You will see the structure of CDialog laid out in the output window. Please know that CDialog is a huge class with several virtual functions hence the output is pretty long.

1>------ Rebuild All started: Project: MFCTest, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  class CDialog size(148):
1>   +---
1>   | +--- (base class CWnd)
1>   | | +--- (base class CCmdTarget)
1>   | | | +--- (base class CObject)
1>   0 | | | | {vfptr}
1>   | | | +---
1>   4 | | | m_dwRef
1>   8 | | | m_pOuterUnknown
1>  12 | | | m_xInnerUnknown
1>  16 | | | XDispatch m_xDispatch
1>  20 | | | m_bResultExpected
1>  24 | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | m_pModuleState
1>   | | +---
1>  32 | | m_hWnd
1>  36 | | m_bEnableActiveAccessibility
1>     | | <alignment member> (size=3)
1>  40 | | m_pStdObject
1>  44 | | m_pProxy
1>  48 | | XAccessible m_xAccessible
1>  52 | | XAccessibleServer m_xAccessibleServer
1>  56 | | m_bIsTouchWindowRegistered
1>  60 | | CPoint m_ptGestureFrom
1>  68 | | m_ulGestureArg
1>  76 | | m_bGestureInited
1>  80 | | m_pCurrentGestureInfo
1>  84 | | m_hWndOwner
1>  88 | | m_nFlags
1>  92 | | m_pfnSuper
1>  96 | | m_nModalResult
1>  100 | | m_pDropTarget
1>  104 | | m_pCtrlCont
1>  108 | | m_pCtrlSite
1>  112 | | m_pMFCCtrlContainer
1>   | +---
1>  116 | m_nIDHelp
1>  120 | m_lpszTemplateName
1>  124 | m_hDialogTemplate
1>  128 | m_lpDialogTemplate
1>  132 | m_lpDialogInit
1>  136 | m_pParentWnd
1>  140 | m_hWndTop
1>  144 | m_pOccDialogInfo
1>   +---
1> 
1>  CDialog::$vftable@:
1>   | &CDialog_meta
1>   |  0
1>   0 | &CDialog::GetRuntimeClass
1>   1 | &CDialog::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CDialog::AssertValid
1>   4 | &CDialog::Dump
1>   5 | &CDialog::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialog::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CWnd::DestroyWindow
1>  27 | &CWnd::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CWnd::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CDialog::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CWnd::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CWnd::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CDialog::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialog::SetOccDialogInfo
1>  89 | &CDialog::GetOccDialogInfo
1>  90 | &CDialog::Create
1>  91 | &CDialog::Create
1>  92 | &CDialog::CreateIndirect
1>  93 | &CDialog::CreateIndirect
1>  94 | &CDialog::DoModal
1>  95 | &CDialog::OnInitDialog
1>  96 | &CDialog::OnSetFont
1>  97 | &CDialog::OnOK
1>  98 | &CDialog::OnCancel
1>  99 | &CDialog::PreInitDialog
1> 
1>  CDialog::GetRuntimeClass this adjustor: 0
1>  CDialog::Create this adjustor: 0
1>  CDialog::Create this adjustor: 0
1>  CDialog::CreateIndirect this adjustor: 0
1>  CDialog::CreateIndirect this adjustor: 0
1>  CDialog::DoModal this adjustor: 0
1>  CDialog::OnInitDialog this adjustor: 0
1>  CDialog::OnSetFont this adjustor: 0
1>  CDialog::OnOK this adjustor: 0
1>  CDialog::OnCancel this adjustor: 0
1>  CDialog::{dtor} this adjustor: 0
1>  CDialog::AssertValid this adjustor: 0
1>  CDialog::Dump this adjustor: 0
1>  CDialog::PreTranslateMessage this adjustor: 0
1>  CDialog::OnCmdMsg this adjustor: 0
1>  CDialog::CheckAutoCenter this adjustor: 0
1>  CDialog::SetOccDialogInfo this adjustor: 0
1>  CDialog::GetOccDialogInfo this adjustor: 0
1>  CDialog::PreInitDialog this adjustor: 0
1>  CDialog::GetMessageMap this adjustor: 0
1>  CDialog::__delDtor this adjustor: 0
1>  CDialog::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogBar size(200):
1>   +---
1>   | +--- (base class CControlBar)
1>   | | +--- (base class CWnd)
1>   | | | +--- (base class CCmdTarget)
1>   | | | | +--- (base class CObject)
1>   0 | | | | | {vfptr}
1>   | | | | +---
1>   4 | | | | m_dwRef
1>   8 | | | | m_pOuterUnknown
1>  12 | | | | m_xInnerUnknown
1>  16 | | | | XDispatch m_xDispatch
1>  20 | | | | m_bResultExpected
1>  24 | | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | | m_pModuleState
1>   | | | +---
1>  32 | | | m_hWnd
1>  36 | | | m_bEnableActiveAccessibility
1>     | | | <alignment member> (size=3)
1>  40 | | | m_pStdObject
1>  44 | | | m_pProxy
1>  48 | | | XAccessible m_xAccessible
1>  52 | | | XAccessibleServer m_xAccessibleServer
1>  56 | | | m_bIsTouchWindowRegistered
1>  60 | | | CPoint m_ptGestureFrom
1>  68 | | | m_ulGestureArg
1>  76 | | | m_bGestureInited
1>  80 | | | m_pCurrentGestureInfo
1>  84 | | | m_hWndOwner
1>  88 | | | m_nFlags
1>  92 | | | m_pfnSuper
1>  96 | | | m_nModalResult
1>  100 | | | m_pDropTarget
1>  104 | | | m_pCtrlCont
1>  108 | | | m_pCtrlSite
1>  112 | | | m_pMFCCtrlContainer
1>   | | +---
1>  116 | | m_pInPlaceOwner
1>  120 | | m_bAutoDelete
1>  124 | | m_cxLeftBorder
1>  128 | | m_cxRightBorder
1>  132 | | m_cyTopBorder
1>  136 | | m_cyBottomBorder
1>  140 | | m_cxDefaultGap
1>  144 | | m_nMRUWidth
1>  148 | | m_nCount
1>  152 | | m_pData
1>  156 | | m_hReBarTheme
1>  160 | | m_nStateFlags
1>  164 | | m_dwStyle
1>  168 | | m_dwDockStyle
1>  172 | | m_pDockSite
1>  176 | | m_pDockBar
1>  180 | | m_pDockContext
1>   | +---
1>  184 | CSize m_sizeDefault
1>  192 | m_pOccDialogInfo
1>  196 | m_lpszTemplateName
1>   +---
1> 
1>  CDialogBar::$vftable@:
1>   | &CDialogBar_meta
1>   |  0
1>   0 | &CDialogBar::GetRuntimeClass
1>   1 | &CDialogBar::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CControlBar::AssertValid
1>   4 | &CControlBar::Dump
1>   5 | &CCmdTarget::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialogBar::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CControlBar::DestroyWindow
1>  27 | &CControlBar::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CWnd::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CControlBar::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CControlBar::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CControlBar::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CWnd::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialogBar::SetOccDialogInfo
1>  89 | &CWnd::GetOccDialogInfo
1>  90 | &CDialogBar::CalcFixedLayout
1>  91 | &CControlBar::CalcDynamicLayout
1>  92 | &CDialogBar::OnUpdateCmdUI
1>  93 | &CControlBar::CalcInsideRect
1>  94 | &CControlBar::DoPaint
1>  95 | &CControlBar::DrawBorders
1>  96 | &CControlBar::DrawGripper
1>  97 | &CControlBar::DrawNCGripper
1>  98 | &CControlBar::DrawThemedGripper
1>  99 | &CControlBar::DrawNonThemedGripper
1>  100 | &CControlBar::DelayShow
1>  101 | &CControlBar::IsVisible
1>  102 | &CControlBar::RecalcDelayShow
1>  103 | &CControlBar::IsDockBar
1>  104 | &CControlBar::OnBarStyleChange
1>  105 | &CControlBar::SetStatusText
1>  106 | &CDialogBar::Create
1>  107 | &CDialogBar::Create
1> 
1>  CDialogBar::GetRuntimeClass this adjustor: 0
1>  CDialogBar::Create this adjustor: 0
1>  CDialogBar::Create this adjustor: 0
1>  CDialogBar::{dtor} this adjustor: 0
1>  CDialogBar::CalcFixedLayout this adjustor: 0
1>  CDialogBar::OnUpdateCmdUI this adjustor: 0
1>  CDialogBar::SetOccDialogInfo this adjustor: 0
1>  CDialogBar::GetMessageMap this adjustor: 0
1>  CDialogBar::__delDtor this adjustor: 0
1>  CDialogBar::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogImpl size(8):
1>   +---
1>   0 | {vfptr}
1>   4 | m_Dlg
1>   +---
1> 
1>  CDialogImpl::$vftable@:
1>   | &CDialogImpl_meta
1>   |  0
1>   0 | &CDialogImpl::{dtor}
1> 
1>  CDialogImpl::{dtor} this adjustor: 0
1>  CDialogImpl::__delDtor this adjustor: 0
1>  CDialogImpl::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogEx size(184):
1>   +---
1>   | +--- (base class CDialog)
1>   | | +--- (base class CWnd)
1>   | | | +--- (base class CCmdTarget)
1>   | | | | +--- (base class CObject)
1>   0 | | | | | {vfptr}
1>   | | | | +---
1>   4 | | | | m_dwRef
1>   8 | | | | m_pOuterUnknown
1>  12 | | | | m_xInnerUnknown
1>  16 | | | | XDispatch m_xDispatch
1>  20 | | | | m_bResultExpected
1>  24 | | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | | m_pModuleState
1>   | | | +---
1>  32 | | | m_hWnd
1>  36 | | | m_bEnableActiveAccessibility
1>     | | | <alignment member> (size=3)
1>  40 | | | m_pStdObject
1>  44 | | | m_pProxy
1>  48 | | | XAccessible m_xAccessible
1>  52 | | | XAccessibleServer m_xAccessibleServer
1>  56 | | | m_bIsTouchWindowRegistered
1>  60 | | | CPoint m_ptGestureFrom
1>  68 | | | m_ulGestureArg
1>  76 | | | m_bGestureInited
1>  80 | | | m_pCurrentGestureInfo
1>  84 | | | m_hWndOwner
1>  88 | | | m_nFlags
1>  92 | | | m_pfnSuper
1>  96 | | | m_nModalResult
1>  100 | | | m_pDropTarget
1>  104 | | | m_pCtrlCont
1>  108 | | | m_pCtrlSite
1>  112 | | | m_pMFCCtrlContainer
1>   | | +---
1>  116 | | m_nIDHelp
1>  120 | | m_lpszTemplateName
1>  124 | | m_hDialogTemplate
1>  128 | | m_lpDialogTemplate
1>  132 | | m_lpDialogInit
1>  136 | | m_pParentWnd
1>  140 | | m_hWndTop
1>  144 | | m_pOccDialogInfo
1>   | +---
1>  148 | m_hBkgrBitmap
1>  152 | CSize m_sizeBkgrBitmap
1>  160 | CBrush m_brBkgr
1>  168 | BackgroundLocation m_BkgrLocation
1>  172 | CDialogImpl m_Impl
1>  180 | m_bAutoDestroyBmp
1>   +---
1> 
1>  CDialogEx::$vftable@:
1>   | &CDialogEx_meta
1>   |  0
1>   0 | &CDialogEx::GetRuntimeClass
1>   1 | &CDialogEx::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CDialog::AssertValid
1>   4 | &CDialog::Dump
1>   5 | &CDialog::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialogEx::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CWnd::DestroyWindow
1>  27 | &CWnd::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CDialogEx::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CDialogEx::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CWnd::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CWnd::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CDialog::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialog::SetOccDialogInfo
1>  89 | &CDialog::GetOccDialogInfo
1>  90 | &CDialog::Create
1>  91 | &CDialog::Create
1>  92 | &CDialog::CreateIndirect
1>  93 | &CDialog::CreateIndirect
1>  94 | &CDialog::DoModal
1>  95 | &CDialog::OnInitDialog
1>  96 | &CDialog::OnSetFont
1>  97 | &CDialog::OnOK
1>  98 | &CDialog::OnCancel
1>  99 | &CDialog::PreInitDialog
1> 
1>  CDialogEx::GetRuntimeClass this adjustor: 0
1>  CDialogEx::PreTranslateMessage this adjustor: 0
1>  CDialogEx::OnCommand this adjustor: 0
1>  CDialogEx::GetMessageMap this adjustor: 0
1>  CDialogEx::{dtor} this adjustor: 0
1>  CDialogEx::__delDtor this adjustor: 0
1>  CDialogEx::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogTemplate size(12):
1>   +---
1>   0 | m_hTemplate
1>   4 | m_dwTemplateSize
1>   8 | m_bSystemFont
1>   +---
1> 
1> 
1> 
1>  MFCTestDlg.cpp
1>  MFCTest.cpp
1>  Generating Code...
1>  MFCTest.vcxproj -> C:\MFCTraining\MFCTest\Debug\MFCTest.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Hope this helps you have a better understanding of how classes are laid out by the Visual C++ compiler.

Share
 

There’s a new C++ Standard and a new version of Visual C++, and it’s time to reveal those features. Read more here…

http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx 

 

Share
 





Share
 

Note: Quote from a mail that I received.

Last fall we shipped Parallel Programming for Microsoft .NET and immediately started working on a companion version of the book for C++ programmers. I’m very happy to announce that Parallel Programming with
Microsoft Visual C++: Design patterns for Decomposition, and Coordination on Multicore Architectures is now available!
Book on native parallel programming

Book on native parallel programming

Where Can I Get The Book?

The content is available right now on MSDN Library: Parallel Programming with Microsoft Visual C++. The layout isn’t quite as nice as the printed book but all the content is there. The publication coincides with the release of Visual Studio SP1 giving us some significant new content to show to developers and help them be successful with the latest parallel programming features in Visual Studio.

The printed book is available for pre-order from O’Reilly:

Parallel Programming with Microsoft® Visual C++

The eBook will also be available for download from O’Reilly and Safari Books Online shortly. Expect to see it on Amazon real soon! When I have hardcopies I’ll be making them available as I did with the .NET book

What’s In The Book?

The book describes six key patterns for data and task parallelism and how to implement them using the Parallel Patterns Library and Asynchronous Agents Library, which shipped with Visual Studio 2010.

Parallel programming patterns

Parallel programming patterns

The book also includes additional material. Appendices on how the Task Scheduler and Resource Manager work and how to use the Visual Studio profiler and debugger to understand your application’s performance. It also include an appendix on Microsoft’s technology roadmap for technical computing, that sets the book in a larger context.

How About Code Samples?

Accompanying the book are code samples for each chapter. This includes small code samples showing how to use each feature of the Task Parallel Library and a larger example for each chapter setting the pattern in a larger context. You can download them from our Parallel Patterns CodePlex site. You can also download answers to the questions at the end of each chapter from CodePlex.

Acknowledgements

Once again I’d like to thank my co-author, Colin Campbell and the team of editors and production specialists who did all the real work. I’d also like to thank the countless people who provided feedback, helped with samples and reviewed material. They are all acknowledged in the book.

Share
 

WinDbg rocks. :) Setting breakpoints is very easy in WinDbg. The command to set a breakpoint is ‘bp’. So if you want to break whenever a dll is loaded into a process then type in following command…

bp kernel32!LoadLibraryW

So to trigger this breakpoint attach ‘notepad.exe’ to the debugger and then type in this command. Now let the app run (press F5). Goto File->Open (this will trigger a definite LoadLibrary :)). Now have a look in WinDbg which will have following output…

Breakpoint 0 hit
kernel32!LoadLibraryW:
00000000`76e50420 4533c0          xor     r8d,r8d

 To view call stack, type in ‘kpn’. I’ll blog more on breakpoints as and when I get time. Happy debugging. :)

Share
 

This is one cool feature of Visual Studio which I very much like, the shortcut for this feature makes life even more easy. :) So what does this feature do?

Imagine we’re are stuck in a heavy duty for loop and you want to immediately break after the for loop but don’t want to traverse through the entire for loop iteration, move your cursor to the line below the for loop (of course it must be a c++ statement) and press Ctrl + F10. The result of this action is that the debugger will ‘execute’ (no it won’t skip) the entire for loop and break at the line that you chose.

I used to use this feature frequently so I guess this will help save sometime for you too.

Share
 

If you are creating a dialog with style WS_CHILD then make sure you also have DS_CONTROL  and DS_CONTROLPARENT enabled for the dialog.

The reason being that the dialog at a time is a control (embedded inside another window) and a control parent (housing other controls). If these styles are not specified calls to GetWindowRect and then a subsequent ScreenToClient will return top co-ordinates in negative leading to some confusion.

Share
 

Recently one of my colleagues and also another user in MSDN forum asked a question related to this. The question is as follows…

If I have a string vector with few elements like “Nibu” “Babu” “Thomas”, how can I get all combinations of these three strings? Results should look like…

“NibuBabuThomas”
“NibuThomasBabu”
“BabuNibuThomas”
“BabuThomasNibu”
“ThomasNibuBabu”
“ThomasBabuNibu”

So in C++ there is a standard C++ algorithm function called next_permutation. Use this function on an array of sorted strings to get required result. So some sample code follows…

typedef std::string VT;
typedef std::vector&lt; VT &gt; VTVec;

// For dumping contents of vector to a stream
void Dump( VTVec&amp; VecToPrint, std::ostream&amp; stream )
{
  // Get iterator for given stream, every element will be separated with second
  // parameter.
  std::ostream_iterator&lt;VTVec::value_type&gt; Itr( stream, &quot;, &quot; );
  // Just one line to dump vector contents, no loops needed
  std::copy( VecToPrint.begin(), VecToPrint.end(), Itr );

  // Remove redundant space and bracket ( &quot;, &quot; ) from the end
  stream &lt;&lt; &quot;\b\b  \b\b\n&quot;;
}// End Dump

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
  int nRetCode = 0;

  VTVec vecNames;
  vecNames.push_back(&quot;Nibu&quot;);
  vecNames.push_back(&quot;Babu&quot;);
  vecNames.push_back(&quot;Thomas&quot;);

  std::sort(vecNames.begin(), vecNames.end());

  std::cout &lt;&lt; &quot;\nNames before applying permutations: &quot;;
  Dump(vecNames, std::cout);
  std::cout &lt;&lt; std::endl;

  int Count = 0;
  while(next_permutation(vecNames.begin(), vecNames.end()))
  {
    Dump(vecNames, std::cout);
    ++Count;
  }

  std::cout &lt;&lt; &quot;\nFound a total of &quot; &lt;&lt; Count &lt;&lt; &quot; combinations!\n&quot;;
  return nRetCode;
}

Result is as follows…

Share
© 2012 bits and bytes Suffusion theme by Sayontan Sinha