Home > Software engineering >  About CToolBar: : _GetButton ()
About CToolBar: : _GetButton ()

Time:10-13

 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;
}

This is the class member function of the source code, want to consult notes that part of how to understand? Why should get TBBUTTON information, to make exclusive or fsState and TBSTATE_ENABLED, what's the purpose?

CodePudding user response:

The same value or the result is 0, is equivalent to reverse

CodePudding user response:

reference 1st floor VisualEleven response:
the same value or the result is 0, is equivalent to the inversion of

I know this, but why do you want to reverse? If the TBSTATE_ENABLED fstate in 1, become a 0, the original zero into 1, why do you want to do it, thank you

CodePudding user response:

Is that the bit inversion, other unchanged ~

CodePudding user response:

Should be equivalent to:
 if (pButton - & gt; FsState & amp; TBSTATE_ENABLED) 
{
PButton - & gt; FsState & amp;=~ TBSTATE_ENABLED;
}
The else
{
PButton - & gt; FsState |=TBSTATE_ENABLED;
}

CodePudding user response:

reference 4 floor VisualEleven response:
should be equivalent to:
 if (pButton - & gt; FsState & amp; TBSTATE_ENABLED) 
{
PButton - & gt; FsState & amp;=~ TBSTATE_ENABLED;
}
The else
{
PButton - & gt; FsState |=TBSTATE_ENABLED;
}

Eldest brother, first of all thank you very much for your detailed and patient explanation, you say part of the all understand, may be my expression ability has a problem, I want to know why after winning a TBBUTTON information button, want to undertake to the ENABLED a reversal, the original function is the purpose of the author do this?

CodePudding user response:

What is the purpose of the original function, the author do this?
Is to reverse ENABLED a!
  • Related