|
i want to see the binary values 1 equal to 00000001 and etc
HelpMe
|
|
|
|
|
Hi,
A string is composed by characters and each of them has a corresponding ASCII number. You need to cast each char into integer (and therefore ASCII code) then turn the integer into string with base = 2. For that purpose use itoa function. Finally, append each converted chars to a destintaion string.
--
======
Arman
|
|
|
|
|
thanks i solved the problem
HelpMe
|
|
|
|
|
Oh!!, but Did I get you right?
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
<br />
CString cs="4";<br />
int intVal=atoi(cs.GetBuffer());<br />
char *txtBin= new char(cs.GetLength());<br />
printf("\nBinary%s\n",itoa(intVal,txtBin,2));<br />
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
then you can write like..
<br />
CFile cf;<br />
cf.Open("BinaryFile",CFile::write);<br />
cs.write(txtBin,strlen(txtBin));<br />
cs.Close();<br />
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
AHH!! this absolutely solved my problem..then i want to ask u
what is the meaning of private, public and protected in MSVC++ framework??
can u give the example how to use it??
how can i call a function in a protected function
e.g
void MyPSMDlg::OnButtonEncode()
{
//i want to call my own function like ChangeToBinary(char letter)
}
HelpMe
|
|
|
|
|
These are access specifiers, Without knowing these, you cannot move into MFC, I suggest you study c++ (O-O) concepts well.
beardy janggut wrote: how can i call a function in a protected function
e.g
void MyPSMDlg::OnButtonEncode()
{
//i want to call my own function like ChangeToBinary(char letter)
}
In the MyPsMdlg.h file, declare the "converToBinary()" funtion. and define it like
MyPsMdlg::convertToBinary()<br />
{<br />
}<br />
Then you can access it in side your
<br />
void MyPSMDlg::OnButtonEncode()<br />
{<br />
this->convertToBinary();<br />
}<br />
.But if have more functions likes these, you might consider creating a separate class and putting these functions inside, then get your MyPsMdlg class inherited from it.
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
learn object programming concepts
|
|
|
|
|
beardy janggut wrote: what is the meaning of private, public and protected...
See here. Google for other examples.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
VuNic wrote: int intVal=atoi(cs.GetBuffer());
Calling GetBuffer() is not necessary here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
oh, just checked you reply. thanks for the information.
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
Hi!
Im trying to use GetDlgItem(btnCtr)->EnableWindow(false), its not working.
It seems to throw an exception.
Anyone knows how to disable the dynamically created cbutton?
|
|
|
|
|
lorey wrote: Im trying to use GetDlgItem(btnCtr)->EnableWindow(false), its not working.
What is btnCtr ? Is it the button's ID ?
lorey wrote: It seems to throw an exception.
It will if the specified Dialog item is not found, since GetDlgItem(...) returns NULL for such cases and you are calling EnableWindow for such a NULL pointer!
Nibu thomas
Software Developer
|
|
|
|
|
It shoudl work. The problem is not with EnableWindow but probably that GetDlgItem(btnCtr) doesn't find the specific window and thus returns NULL.
To be sure, just try that:
CWnd* pWindow = GetDlgItem(btnCtr);
And check the value of pWindow with your debugger.
|
|
|
|
|
Like a Resource ID duplication of the Number.
Regards,
FarPointer
|
|
|
|
|
try
m_Button3.EnableWindow(0);
|
|
|
|
|
WhiteSky wrote: m_Button3.EnableWindow(0);
This requires to make a Control-variable (of the type of the DialogItem), but yes, this is the way to go.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
-- modified at 2:51 Friday 31st March, 2006
|
|
|
|
|
Hi All,
Iam working with a ListControl whose parent is a dialog.want to place a tree control on a particular cell on the listcontrol,which on doubleclicking should open up(ie: the width & height of this tree control exceeds the dialog boundary).
Like in ComboBox control, where the list visible, goes beyond the dialog boundary.
Tried somethings like
treeControl.SetOwner(GetDesktopWindow();
treeControl.ModifyStyle(WS_CHILD,WS_OVERLAPPED);
Everything works fine apart from 1 problem.I can see the newly created window(the treecontrol) on my taskbar.
wHAT should I do to avoid that...
Regards,
P
|
|
|
|
|
Pazzuzu wrote: treeControl.ModifyStyle(WS_CHILD,WS_OVERLAPPED);
I guess this line is causing the trouble. Why are you removing WS_CHILD style. And why WS_OVERLAPPED ?
Nibu thomas
Software Developer
|
|
|
|
|
Okay,that was a mistake.
Tried as follows.
treeControl.ModifyStyle(WS_BORDER,WS_POPUP);
but the window is still there in the taskbar.Guess some of the styles are not added to the Control,though I use a modify style.
What could be done...
|
|
|
|
|
Pazzuzu wrote: treeControl.ModifyStyle(WS_BORDER,WS_POPUP);
Why WS_POPUP ?? And why removing WS_BORDER ?? Let it remain as it is!
Set the parent to desktop!
Nibu thomas
Software Developer
|
|
|
|
|
Iam not modifying any style now.Iam keeping it as it is .
treeControl.SetParent(GetDesktopWindow());
Still window is visible.
|
|
|
|
|
Have seen that my call to
treeControl.ShowWindow(true);
pops up this window.But if I comment out this statement,the control is not popping up on double clicking
|
|
|
|
|
What about WS_EX_TOOLWINDOW ? Add this style using ModifyStyleEx .
Nibu thomas
Software Developer
|
|
|
|