|
unsigned can make a big difference if the top bit is one of those involved.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
not really, not if you're dealing with bit level operations... as long as you're not using the data to do arithmetic, but this type of logic is usually used for dealing with APIs and hardware type of operations.
|
|
|
|
|
As mentioned above, use '&' to test for a bit pattern. I've illustrated that in the inline function extract below.
If you don't have the actual values of the bits to test for though, you may need to combine the variables that contain the test bits. In that case use the bitwise or operator '|'. I've illustrated that in the inline function test2Flags below.
You can easily combine more than 2 flags to test for by combining several of them with '|'. See the last call to extract below.
typedef unsigned char byte;
const byte indicator1 = 0x01;
const byte indicator2 = 0x02;
const byte indicator3 = 0x04;
const byte indicator4 = 0x08;
const byte indicator5 = 0x10;
const byte indicator6 = 0x20;
const byte indicator7 = 0x40;
const byte indicator8 = 0x80;
inline byte extract(byte indicators, byte mask) {
return indicators & mask;
}
inline test2Flags(byte indicators, byte flag1, byte flag2) {
return extract(indicators, flag1 | flag2);
}
int main() {
byte myIndicator = 0x34;
byte testMyIndicators3and5 = test2Flags(myIndicator, indicator2, indicator5);
byte testSeveralFlags = extract(myIndicators, indicator2 | indicator3 | indicator4);
return 0;
}
Of course, you don't need to define any function for that, I just did this to enhance readability and focus on the relevant syntax.
|
|
|
|
|
Hi,
We are going to support our application for French localization (iso-8859-1 Windows-1252). The application developed using C++ and C# technologies. As per my understanding, if we support Unicode or MBCS (Multi-byte character set), we won’t get any data loss. Can we use normal string function for handle French characters or _MBCS requires for handle French characters?
Example:
Can we
if( *sz1 == 'A' ) for Character Comparison or
if( !_mbccmp( sz1, sz2) )
Thanks and Regards,
Selvam,
http://www15.brinkster.com/selvamselvam/
|
|
|
|
|
It looks like you plucked your question from here[^] where it explains the issue. It does not matter what character encoding you use if it's the same everywhere, just use the correct functions for your string manipulation, and ensure all constants are held in the correct encoding.
|
|
|
|
|
Hi Richard,
Thanks for your help. so, I can use ASCII functions(string manipulations, Windows API functions , etc) for my French application. Is it?
Thanks and Regards,
Selvam,
http://www15.brinkster.com/selvamselvam/
|
|
|
|
|
R.selvam wrote: so, I can use ASCII functions(string manipulations, Windows API functions , etc) for my French application. Is it?
Yes, assuming all your text is in ASCII.
|
|
|
|
|
Thank you.
Thanks and Regards,
Selvam,
http://www15.brinkster.com/selvamselvam/
|
|
|
|
|
On a tree control , with
m_Tree.ModifyStyle(TVS_CHECKBOXES,0);
m_Tree.ModifyStyle(0,TVS_CHECKBOXES);
I put checkbox style , but how can I turn off this style if they already exist ?
I try this , but it is a stupid :
m_Tree.ModifyStyle(~TVS_CHECKBOXES,0);
m_Tree.ModifyStyle(0,~TVS_CHECKBOXES);
modified on Tuesday, March 29, 2011 3:58 AM
|
|
|
|
|
Flaviu 2 wrote: m_Tree.ModifyStyle(TVS_CHECKBOXES,0);
Use GetStyle() [^] to check what styles are already set, and modify as appropriate.
|
|
|
|
|
And how to modify them if I want to set back to 0 ?
|
|
|
|
|
Check if that style bit is set in the return from GetStyle() and if so you can remove it; if not set then no action.
|
|
|
|
|
|
Hello,
How to capture key board event in a dll having dialog box ? I tried with PreTranslateMessage() but no events reached to PreTranslateMessage() either.
Thank you.
|
|
|
|
|
|
Hello Friends
I am Drawing a image using GDI+ on OnPaint().And Its Flickering Whenever I resize Window.I tried all the ways to reduce Flicker but no Luck.
Actually,I am drawing it as background Image and I dont want to call it again and again.SO,Is there any way to draw background image using DC or some way so that OnPaint doesnt effect it and it remains there?
Thanks & Regards
Yogesh
|
|
|
|
|
Hi
Please find the following link which answers your problem.
<a href="http://www.codeproject.com/Messages/3825718/Re-How-to-reduce-Flickering.aspx">Flicker Solution</a>[<a href="http://www.codeproject.com/Messages/3825718/Re-How-to-reduce-Flickering.aspx" target="_blank"></a>]
Nitheesh George
http://www.simpletools.co.in
|
|
|
|
|
You might want to make sure your OnEraseBkgnd()[^] doesn't clear the screen (if you're going to fill it with a bitmap anyway). Return TRUE from this method.
|
|
|
|
|
You have three opportunities to reduce flicker:
1. Draw the image in the OnEraseBkgnd() handler and return TRUE.
2. Do other drawing in the OnPaint() handler. Use CMemDC to double buffer the dc. Since the entire background (I assume) is being covered with the image, there is no need to do a "fill" in OnPaint() ; in fact, doing do would wipe out the image that was just drawn in OnEraseBkgnd() .
3. In the OnSize() handler, tell Windows to defer re-positioning your controls until you are finished, You do this by using the DeferWindowPos() function (there are two other functions you will need, they are explained at that link).
The way Windows works, anything that obscures your window causes a WM_ERASEBKGND message to be sent to your window. This means that your window has to be redrawn when it is uncovered. Examples: moving another window on top of your window, or minimizing/restoring your window. So to answer your question, there is no way to "permanently" paint the background, because it is constantly being redrawn due to normal window operations.
It is also somewhat customary to do background stuff in OnEraseBkgnd() and foreground stuff in OnPaint() , although this is not a hard rule you have to follow; you can be sure that every WM_ERASEBKGND message will be followed by a WM_PAINT message.
|
|
|
|
|
Hi Guys
Thanks for your valuable time for my posting.
I tried all the things but no Luck
Thanks
Yogesh
|
|
|
|
|
Hi I get this error message when trying to run my program on another computer running Windows XP. I also get a different error when running on another persons computer with Windows 7.
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
Any ideas on what the issue is?
Thanks.
|
|
|
|
|
Cyclone_S wrote: Any ideas...?
yes, over 82,000 ideas[^]
Cyclone_S wrote: I also get a different error when...
different how?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Cyclone_S wrote: confused what I need to do
collect more information, formulate an hypothesis, verify it, and when it seems correct, fix it.
IMO the two most likely categories of issues causing behavior somewhat like what you get, would be:
1.
the system failing to locate or load a required piece of code, say a missing DLL. But then in my experience one gets a dialog box with a different message.
2.
anything that could go wrong at the application level PLUS the app itself lacking proper error catching and reporting.
e.g. if one has try-catch constructs with an empty catch, then all clues get swallowed and all that is left is guessing at what the problem is.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I've seen this with missing DLLs or other components, such as configuration files (as Luc Pattyn stated), or there's a missing registry entry (or the registry entry doesn't contain the information expected).
|
|
|
|