|
The bit-wise operator << shifts the amount of bits depending on the number after this operator. Therefore,
0x1 (binary 00000001) shifts 1 position you get 0x2 (binary is 00000010).
0x3 (binary 00000011) shifts 3 position you get 0x18 (binary is 00011000).
kuphryn wrote:
#define BIT_MASK(3) (0x1 << (3)) = 0x6
What you wrote this is wrong! Should be 0x8.
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
|
Please read my new article at http://www.codeproject.com/cpp/bitbashing.asp. It was inspired by this thread, and I hope it will help you a lot.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
|
|
|
|
|
Very nice! Thanks.
I do have some questions. However, I have late for class, so I will ask these questions later on today.
Kuphryn
|
|
|
|
|
|
|
I was wondering if there is anyway to add a specific selection to the system menu in the title bar?
|
|
|
|
|
Do this in OnInitDialog() :
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL) {
pSysMenu->AppendMenu(MF_STRING, IDC_MYCOMMAND, "My Command"};
}
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You can use the GetSystemMenu function on the window that you would like to add the menu selection. This will get you the handle to the system menu for that window.
Then you can use all of the menu modification functions on that handle like InsertMenuItem and AddMenuItem.
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Perfect. Thanks. Quick and painless
|
|
|
|
|
I have a pdf file. Currently, I xerox an handful
of blank forms and I just run them through my
printer to print new text on top of the form.
Is there a way to programmatically print text
on top of a pdf file (so that I can then send that
new file to the printer and get nice looking output)?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I don't know how to do this programatically, but recent versions of Adobe Acrobat Writer lets you create PDF forms that can be filled in by a user and printed from Acrobat.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
ok... i have an array that its size always changes... like
array[inc];
array is the array ofcource and inc //incriment.
the program allows you to add a number to a list of numbers... then you press 'p', and you would print the number list.
what i want to do is make it for if you press 's' then the program would sort all the data in array[] to least to greatest.
i have s in a switch of menu "which is a char" so...
case 's' :
{
... //least to greates program
}
how would i accomplish this?
thanks!
~SilverShalkin
|
|
|
|
|
Bubblesort was one of the easiest sorting algorithms I used to implement for most of my school assignments. I wasn't very efficient, but it was easy to implement.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
and if you dont want to write your own try using the quicksort that is built into the c runtimes
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
so... bubblesort and quicksort?
if it is possible.. can you show me an example? if not ill try and figuer how it works in msdn.
thanks
~SilverShalkin
|
|
|
|
|
This link does not take you to Sort
|
|
|
|
|
Learning wrote:
This link does not take you to Sort
Which link?
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
How to convert PWSTR to char * ?
thanx
|
|
|
|
|
Here's an example of doing that:
char szBuffer[255];
WideCharToMultiByte(CP_ACP,
0,
,
-1,
szBuffer,
sizeof(szBuffer),
NULL,
NULL);
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
hey tom
can you not just use:
USES_CONVERSION;
*pChar = W2A(*pWideChar);
????
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Lauren,
I asked Tom this very question just now. I was about 30 seconds later than you were though
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
hehe
great minds nish great minds
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
|
lauren wrote:
great minds nish great minds
Yeah I guess so
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|