Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can I show my dialog on the TOP from other window dialog? Pin
THAQCD29-Jul-09 7:38
THAQCD29-Jul-09 7:38 
AnswerRe: How can I show my dialog on the TOP from other window dialog? Pin
Code-o-mat29-Jul-09 9:35
Code-o-mat29-Jul-09 9:35 
QuestionRe: How can I show my dialog on the TOP from other window dialog? Pin
David Crow29-Jul-09 9:45
David Crow29-Jul-09 9:45 
AnswerRe: How can I show my dialog on the TOP from other window dialog? Pin
THAQCD30-Jul-09 8:37
THAQCD30-Jul-09 8:37 
GeneralRe: How can I show my dialog on the TOP from other window dialog? Pin
David Crow1-Aug-09 16:56
David Crow1-Aug-09 16:56 
Question[MISC] - Operators - Meaning of operator & Pin
Thang29-Jul-09 6:59
Thang29-Jul-09 6:59 
AnswerRe: [MISC] - Operators - Meaning of operator & Pin
David Crow29-Jul-09 7:05
David Crow29-Jul-09 7:05 
AnswerRe: [MISC] - Operators - Meaning of operator & Pin
enhzflep29-Jul-09 8:27
enhzflep29-Jul-09 8:27 
Okay, lets say that l = 3131961357

This is the same as 0xBAADF00D
Which is the same as 10111010101011011111000000001101


Which means your expression looks a little something like this:

((WORD)(((DWORD)(0xBAADF00D) >> 16) & 0xFFFF))

3131961357 >> 16 = 47789
0xBAADF00D >> 16 = 0x0000BAAD
10111010101011011111000000001101 >> 16 = 00000000000000001011101010101101

47789 & 65535 = 47789
0x0000BAAD & 0x0000FFFF = 0x0000BAAD
00000000000000001011101010101101 & 00000000000000001111111111111111 = 00000000000000001011101010101101


Basically, the code simply takes a 32 bit number and returns the top (most significant) 16 bits of them.
The >> 16 followed by the & 0xFFFF is unnecessary - the bitshift right 16 bits automatically fills the top 16 bits with 0s.

This code is functionally the same:

(WORD)((DWORD)(l) >> 16)


See how much easier things are when we use hex/binary?

Edited && --> &
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
Maximilien29-Jul-09 9:48
Maximilien29-Jul-09 9:48 
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
enhzflep29-Jul-09 10:00
enhzflep29-Jul-09 10:00 
GeneralRe: [MISC] - Operators - Meaning of operator & Pin
Thang30-Jul-09 6:10
Thang30-Jul-09 6:10 
QuestionSlider control on the status bar (where does WM_HSCROLL go?) Pin
BabakTaati29-Jul-09 5:46
BabakTaati29-Jul-09 5:46 
QuestionReading from and writing to the registry in windows Vista Pin
Sternocera29-Jul-09 5:00
Sternocera29-Jul-09 5:00 
QuestionRe: Reading from and writing to the registry in windows Vista Pin
David Crow29-Jul-09 5:47
David Crow29-Jul-09 5:47 
AnswerRe: Reading from and writing to the registry in windows Vista Pin
bob1697229-Jul-09 5:53
bob1697229-Jul-09 5:53 
GeneralRe: Reading from and writing to the registry in windows Vista Pin
Sternocera29-Jul-09 23:38
Sternocera29-Jul-09 23:38 
QuestionReferences Pin
EliottA29-Jul-09 4:13
EliottA29-Jul-09 4:13 
AnswerRe: References Pin
Chris Losinger29-Jul-09 4:28
professionalChris Losinger29-Jul-09 4:28 
GeneralRe: References Pin
EliottA29-Jul-09 4:35
EliottA29-Jul-09 4:35 
GeneralRe: References Pin
Chris Losinger29-Jul-09 4:40
professionalChris Losinger29-Jul-09 4:40 
GeneralRe: References Pin
Maximilien29-Jul-09 7:59
Maximilien29-Jul-09 7:59 
AnswerRe: References Pin
Rajesh R Subramanian29-Jul-09 4:50
professionalRajesh R Subramanian29-Jul-09 4:50 
QuestionTrimRight() and TrimLeft() for unicode characters. Pin
Rakesh529-Jul-09 3:40
Rakesh529-Jul-09 3:40 
AnswerRe: TrimRight() and TrimLeft() for unicode characters. Pin
Emilio Garavaglia30-Jul-09 1:42
Emilio Garavaglia30-Jul-09 1:42 
QuestionFont Pin
kumar sanghvi29-Jul-09 3:28
kumar sanghvi29-Jul-09 3:28 

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.