|
Actually I want to generate 12 bit unsigned int and 4 bit signed int and stores in 2 bytes(unsigned int) which is as follow.
2 bytes unsigned int = 12 bit unsigned int*10^(4-bit signed int)
thx
|
|
|
|
|
long bit12 = (long)rand() + (long)(rand() << 8);
This is wrong.
-- modified at 9:07 Saturday 6th January, 2007
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
thx but it gives number -424735897 which is not 12 bit
|
|
|
|
|
crap my mistake! that makes an 32bit random number
the code you need is
int value12bit = rand() & 0x0FFF;
Sorry bout' that
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
no prb thanks..;) but i am bit confused that integer is of 4 bytes but how can i get 12 bit from this..it would be nice if u plz explain the same.
|
|
|
|
|
MSDN wrote: The int and unsigned int types have the size of the system word. This is two bytes (the same as short and unsigned short) in MS-DOS and 16-bit versions of Windows, and 4 bytes in 32-bit operating systems. However, portable code should not depend on the size of int.
If you need a 16bit integer use the __int16 data type
to get 12bits from an int you can
int bits12 = intVar & 0xFFF
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
I am asuming that your 4bit value is also comming from and integer so ...
int total16 = (bit14 & 0xFFF) + ((bit4 & 0xF) << 12);
that should add your 2 values into one.
The & operator will mask the left value with the right.
example
int value = 151;
int value2 = value & 0xAA;
value2 = value2 >> 1;
Hope this is what you needed
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
how can we track a webpage title and website address(Link)? If anyone of you know, i humbly request you to reply me!
thanks in advance!
|
|
|
|
|
ShaluMalu wrote: how can we track a webpage title and website address(Link)? If anyone of you know, i humbly request you to reply me!
what do you mean by track, please explain further.
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
ShaluMalu wrote: track a webpage title and website address(Link)?
Can you re more specific
|
|
|
|
|
Hi all
I have a group of buttons in a dialog resource . I want them to appear behind a bitmap . When the bitmap is loaded with LoadBitmap() and when WM_PAINT is not defined then the buttons are invible but they work when we click on the bitmap . Problem comes when I stretch the bitmap by calling StretchBlt() in WM_PAINT . This time the buttons appear above the bitmap !
I tried calling ShowWindow(hButton,SW_HIDE); But this call disables the button itself .
So I tried calling EnableWindow(hButton,TRUE); to enable it in invisible mode - but to my surprise this call also does not enable the button ...I do not know what I am missing ...
Can anyone tell me pls ?
redindian
|
|
|
|
|
This must be the weirdest thing i heard, why do all this, why don't you handle the dialog's OnLButtonDown and define some rectanges ...
...OnLButtonDown(...)
{
.....
if(m_rcArea2.PtInRect(&pt))
OnArea2();
}
something like that.
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
can anyone help in using the Slider control in win32. I have the handle of the dailog item. I mean The slider control on dialog. and now I want to do SetRange and SetPos.
"A winner is not one who never fails...but the one who never quits"
|
|
|
|
|
To set range:
BOOL fRedraw = TRUE;
WORD Min = 0;
WORD Max = 100;
SendMessage(hwndTrackbar, TBM_SETRANGE, (WPARAM)fRedraw, (LPARAM)MAKELONG(Min,Max));
To set position:
BOOL fRedraw = TRUE;
LONG Position = 50;
SendMessage(hwndTrackbar, TBM_SETPOS, (WPARAM)fRedraw, (LPARAM)Position);
|
|
|
|
|
I wrote a timer function in which TextOut() fn draws currunt time on the dialog for every second. But the text background is becoming white.I want the background color to be remained as dialog color.
How to do this?
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Rather try using the DrawText() function or if you want to use the TextOut() function use SetBKColor to change the background color of TextOut()
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
You must set backcolor mode to TRANSPARENT : pDC->SetBkMode(TRANSPARENT);
but it will draw the text on the previous one, so you must erase prevoius one area each time you want to draw your new text(in your timer function).
For solving this problem one way is to use FillSolidRect() method to erase it, but first get your dialog color.
hope this helps
|
|
|
|
|
When i wanted to get the bkcolor of dialog using Getbkcolor() i could not get that gray color of default dialog box. How to get the color?
KIRAN PINJARLA
|
|
|
|
|
You can change color of background on WM_CTLCOLOR with SetBkColor for background and SetTextColor
|
|
|
|
|
You shouldn't be drawing only in a timer function as when the drawing is obscured and then exposed the text will not be redrawn until the next second. It’s ok to draw in a timer function but your WM_PAINT handler should also have code to draw the current time. More conventionally the timer function would only invalidate the region of the window which contains the text and all drawing done in the WM_PAINT handler.
Steve
|
|
|
|
|
Hi,
I am interested in creating an Automation Client similar to Outlook.
Outlook exposes the IDTExtensibility2 interface via which we can connect to Outlook and it also exposes methods and properties via which we can use Outlook's functionality. These methods and properties are in mso9.dll and msoutl9.olb.
Could someone explain how to go about creating my own IDTExtensibility2 Interface for my application and how do I separate the COM portion in a separate dll. Also, what is an .olb file. It it similar to a .tlb file?
Thanks.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
"I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
|
|
|
|
|
What's the maximum item count in 98. my need is to load 70000 items. it's fine 2000 and higher os. in 98 31,XXX is loaded. any one help me out.
thanks in advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Why you want to insert 70,000 to combobox ?
|
|
|
|
|
The number is 32767 (16 bit signed int maximum value).
Look at LB_INITSTORAGE Message in MSDN[^].
It refers to ListBoxes, but I think it also applies to ComboBoxes.
hope that helps
-- modified at 4:44 Saturday 6th January, 2007
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You can't store 70000 items. (Anyway is impractical to let user choose from 70000 items in a combobox - that's a lot of unique keys by the way).
You may consider using a virtual listbox or virtual listview to store data.
Alternatively, you may consider usage a "view|scroll" mechanism to store and display (i.e. your combo will display only a part of data - view - that will scroll depending on what user does in combo); possibly a dictionary-oriented will do it, or using partitions of data. Good luck anyway.
Nuclear launch detected
|
|
|
|