Home > Software engineering >  About CToolBar: : _GetButton function and the effect of doubt
About CToolBar: : _GetButton function and the effect of doubt

Time:10-19

Ask: in the following function annotation part?
Void CToolBar: : _GetButton (int nIndex, TBBUTTON * pButton) const
{
CToolBar * pBar=(CToolBar *) this;
VERIFY (pBar - & gt; DefWindowProc (TB_GETBUTTON nIndex, (LPARAM) pButton));
//TBSTATE_ENABLED==TBBS_DISABLED so invert it
PButton - & gt; FsState ^=TBSTATE_ENABLED;//here: why do you want to do this??????? What's the meaning of
}

CodePudding user response:

An operator has:
& (bitwise and), | (bitwise or) ^ (the bitwise xor), ~ (by invert),

# define TBSTATE_ENABLED 0 x04
# define TBBS_DISABLED MAKELONG (0, TBSTATE_ENABLED)//button is disabled

CodePudding user response:

//# define TBSTATE_ENABLED 0 x04
//# define TBBS_DISABLED MAKELONG (0, TBSTATE_ENABLED)//button is disabled
Int x=TBSTATE_ENABLED;
X ^=TBSTATE_ENABLED;
AfxDump & lt; X ^=TBSTATE_ENABLED;
AfxDump & lt;
  • Related