Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Use CFileDialog and get Unicode filenames in a Multi-Byte project Pin
manchukuo24-Jul-09 4:31
manchukuo24-Jul-09 4:31 
QuestionTitleBar Pin
kumar sanghvi23-Jul-09 17:20
kumar sanghvi23-Jul-09 17:20 
AnswerRe: TitleBar Pin
Mahesh Kulkarni23-Jul-09 20:57
Mahesh Kulkarni23-Jul-09 20:57 
GeneralRe: TitleBar Pin
kumar sanghvi24-Jul-09 0:51
kumar sanghvi24-Jul-09 0:51 
QuestionI am not able to get WM_GETMINMAXINFO Message in CDockablePane derived control. Please Help Me! Pin
jeet51123-Jul-09 15:59
jeet51123-Jul-09 15:59 
QuestionSerialize Linked List Pin
Esaias Pech23-Jul-09 15:32
Esaias Pech23-Jul-09 15:32 
AnswerRe: Serialize Linked List Pin
KarstenK23-Jul-09 21:24
mveKarstenK23-Jul-09 21:24 
AnswerRe: Serialize Linked List Pin
killabyte24-Jul-09 0:22
killabyte24-Jul-09 0:22 
GeneralStructure Pin
resolvequestion23-Jul-09 12:20
resolvequestion23-Jul-09 12:20 
GeneralRe: Structure Pin
killabyte23-Jul-09 13:51
killabyte23-Jul-09 13:51 
QuestionActive Document Server Menu question. Pin
ancere23-Jul-09 9:14
ancere23-Jul-09 9:14 
AnswerRe: Active Document Server Menu question. Pin
transoft23-Jul-09 9:18
transoft23-Jul-09 9:18 
GeneralRe: Active Document Server Menu question. Pin
ancere24-Jul-09 3:19
ancere24-Jul-09 3:19 
Questionmouse cursor not shown in the CScrollView Pin
transoft23-Jul-09 8:38
transoft23-Jul-09 8:38 
AnswerRe: mouse cursor not shown in the CScrollView Pin
Iain Clarke, Warrior Programmer23-Jul-09 9:03
Iain Clarke, Warrior Programmer23-Jul-09 9:03 
GeneralRe: mouse cursor not shown in the CScrollView Pin
transoft23-Jul-09 9:17
transoft23-Jul-09 9:17 
GeneralRe: mouse cursor not shown in the CScrollView Pin
Iain Clarke, Warrior Programmer23-Jul-09 9:26
Iain Clarke, Warrior Programmer23-Jul-09 9:26 
GeneralRe: mouse cursor not shown in the CScrollView Pin
transoft23-Jul-09 10:09
transoft23-Jul-09 10:09 
QuestionUsing vista's virtualisation Pin
Kees195823-Jul-09 7:25
Kees195823-Jul-09 7:25 
QuestionBit Shift and Mask Pin
resolvequestion23-Jul-09 6:29
resolvequestion23-Jul-09 6:29 
AnswerRe: Bit Shift and Mask Pin
Cedric Moonen23-Jul-09 7:40
Cedric Moonen23-Jul-09 7:40 
AnswerRe: Bit Shift and Mask Pin
Iain Clarke, Warrior Programmer23-Jul-09 9:17
Iain Clarke, Warrior Programmer23-Jul-09 9:17 
That article Cedric pointed you at is great, but doesn't cover bit fields, which is what I'd use in your place.

Not by a compiler, so take this with healthy doubt over the exact syntax, but you can read a book, right?
struct {
  union
  {
     unsigned char Byte;
     struct {
       unsigned char Flag1 : 1;   // : 1 means take 1 bit
       unsigned char Option1 : 2;   // : 1 means take 2 bits
       unsigned char Flag2 : 1;   // : 1 means take 1 bit
       unsigned char Flag3 : 1;   // : 1 means take 1 bit
       unsigned char Flag4 : 1;   // : 1 means take 1 bit
       unsigned char Flag5 : 1;   // : 1 means take 1 bit
       unsigned char Flag6 : 1;   // : 1 means take 1 bit
     } Bits;
   } Flags;
   unsigned char Checksum;
   unsigned short int Sequence;
} PacketHeader


You can use it like:
PacketHeader packet;
ReadPacketSomehow (packet);
if (packet.Flags.Bits.Flag3)
{
   ....
}
if (packet.Flags.Bits.Option3 == 3)  // 2 bits, 0..3
{
   ....
}


Hope that helps you,

Iain.

I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[^]

GeneralRe: Bit Shift and Mask Pin
resolvequestion23-Jul-09 9:59
resolvequestion23-Jul-09 9:59 
GeneralRe: Bit Shift and Mask Pin
Iain Clarke, Warrior Programmer23-Jul-09 20:46
Iain Clarke, Warrior Programmer23-Jul-09 20:46 
GeneralRe: Bit Shift and Mask Pin
CPallini23-Jul-09 10:30
mveCPallini23-Jul-09 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.