Solved

How to check if certain bit is set

Posted on 1999-01-14
1
189 Views
Last Modified: 2010-04-02
How do I check if bit 24 of a 32-bit value(LPARAM)is set?
0
Comment
Question by:mpatter
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 1182212
AS LPARAM is identical to a LONG, try

LONG lParam = somewhat;

if ( 0x1000000 & lParam)
{
 // bit is set
}
else
{
 // bit isn't set
}

0x1000000 is the hex representation of the bit you want to check for.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now