|
hi,
i want to know format specifier for WORD and BYTE.
Example:
int nValue;
CString str;
str.Format("%d",nValue);
afxMessageBox(str);
%d for integer,same way i want to know for WORD and BTYE.
Thanks in before
James
|
|
|
|
|
A WORD is a 16 bit unsigned integer. use %u for that
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi,
"%d" -> Signed integers
"%u" -> UnSigned integers
as BYTE is unsigned type use "%u"
Urs,
-Pons
-----------------------
The greatest of faults, I should say, is to be conscious of none.
|
|
|
|
|
I create a CMyButton and handled WM_SIZE
void CMyButton::OnSize(...)<br />
{<br />
CButton::OnSize(...);<br />
<br />
CRect rect;<br />
GetClientRect(rect);<br />
<br />
m_rgn.DeleteObject(); <br />
SetWindowRgn(NULL, FALSE);<br />
m_rgn.CreateEllipticRgnIndirect(rect);<br />
SetWindowRgn(m_rgn, TRUE);<br />
<br />
}
But when the button size changed, round size not change, why?
Thanks.
|
|
|
|
|
Need to change the values in the rect that is being passed to m_rgn.CreateEllipticRgnIndirect
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
"Need to change the values in the rect" how to do?
|
|
|
|
|
rect.top = 20; etc . Do likewise for rect.left,rect.right,rect.bottom
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i want "when button size is changed, the round size same with button size"
|
|
|
|
|
Instead of the code that you are writing try this.
void CMyButton::OnSize(...)
{
CButton::OnSize(...);
CRect rect(10,10,30,30);
m_rgn.DeleteObject();
SetWindowRgn(NULL, FALSE);
m_rgn.CreateEllipticRgnIndirect(rect);
SetWindowRgn(m_rgn, TRUE);
}
I hope this helps
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Its not good
<br />
CRect rect;<br />
GetClientRect(rect);<br />
ScreenToClient(rect);<br />
whitesky
|
|
|
|
|
question still exist.
if in non-child windows have not this question, but in button happen.
|
|
|
|
|
Hi ,
HOW WHAT wrote: CRect rect;
GetClientRect(rect);
I'm not sure , but according to MSDN , GetClientRect()
gets as parameter the pointer to the rect , and not the rect
itself :
CWnd::GetClientRect
void GetClientRect( LPRECT lpRect ) const;
So try the following instead :
CRect rect;
GetClientRect(&rect);
Hopes this helps ,
Eli
|
|
|
|
|
CRect::operator LPRECT
CRect rect;GetClientRect(rect);
==
RECT rect;GetClientRect(&rect);
|
|
|
|
|
Hi all,
I created combo box with control variable. I like to set the no of characters to be keyed in in the combobox(editable).
In brief, set the text limit to the Combobox control variable. Can anyone help me in this problem?
Thanks in Advance.
Regards,
Ram
|
|
|
|
|
BOOL LimitText( int nMaxChars );
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
Use LimitText( long lLimit )
ComboBox m_Combobox;
m_Combobox.LimitText( 64 );
"Dream bigger...Do bigger...Expect smaller"
aji
|
|
|
|
|
hello all,
I want to serially transmit float variables/data types between the PC and the serial device (RABBIT 3000 -an 8bit microcontroller).
I am transmitting with databits as 8 for serial transmission as my microcontroller is an 8bit one.
I convert float to long and bitshift to assign it to a buffer of type char.
But if I do this, then say,
I want to transmit 3.4,then I can transmit only 3 and not the .4
as I convert form float to long before transmitting.
How can I transmit a float data variable from PC to microcontroller or the vice-versa serially.?
|
|
|
|
|
Use...
typedef union
{
float fFloatVar;
UCHAR ucFloatByteArray;
}FloatConverter;
FloatConverter fc;
fc.fFloatVar = 23.456f;
Now just send the bytes in FloatConverter.ucFloatByteArray one by one.
Now while receiving store each byte into the byte array FloatConverter.ucFloatByteArray and then
float fFloatNumber = FloatConverter.fFloatVar;
I guess this should help you.
Thanks to toxcct ...
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
thanks very much.
It works perfectly.
thanks for ur help.
|
|
|
|
|
Or how about:
unsigned char* byteptr = (unsigned char*)&floatVal;
for(int i = 0; i < sizeof(float); ++i)
Send(byteptr[i]); You can use this technique for any struct/basic type, without having to create a "converter" union for each type.
--
For External Use Only
|
|
|
|
|
I need to use a ccontrol list to show data, after pressing button 'showdata'.....in a old project(DIALOG BASED).....the problem is that..... in this project i can't use class wizard.
kamalesh
|
|
|
|
|
Have you removed the wizard comments from source?
AFAIK we can use class wizard, only if we created the project by classwizard.
When pressing the Ctrl+W it will ask for the list of files. I think it appears only for the projects created through class wizard
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
I set a treeview toolbar in my MDI project.
just like the VC++ 6.0 workspace toolbar,Click the item/filename of the fileview, the related file opens and become active. and insert/delete item of the tree, it will new/close the related doc/file .
1.>how to create a new file for the new item ?
2.>when DbclickTree() happens, how to active the related file?
3.>does the files can searched/sort by filename as the treeview item sort?
thanks for ur kind help!
|
|
|
|
|
Hey Guys,
does anybody know a good implementation of the Sorenson H.263 Codec ? I couldn't find a nice on. Well I found some links but they were dead
I appreciate any help.
Thanks,
Ben
|
|
|
|
|
Hi all,
I created combo box with control variable. I like to set the no of characters to be keyed in in the combobox(editable).
In brief, set the text limit to the Combobox control variable. Can anyone help me in this problem?
Thanks in Advance.
Regards,
Ram
|
|
|
|