|
Binary and decimal are rendering details. The actual values are the same. PErhaps you need to explain what you want to do ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
the program asks the user to input a positive integer and converts it to binary and output the result.
Or the program asks the user to input a binary number and conerts it to decimal and output the result.
this is an example i donno if its right:
#include <iostream.h>
int main()
{
int i;
long int binary;
int decimal = 0;
cout << "Please enter a 8-bit binary number" << endl;
cin>> binary;
for(i = 0; i < 8; i++)
{
if(binary % 10)
{
decimal += 1 << i;
}
binary /= 10;
}
cout << "Your number in decimal is: " << decimal <
|
|
|
|
|
Oh, I see. If you run windows calculator, you can set it in scientific mode, and then it will swap between decimal and binary so you can check your results. Yes, at first glance, this looks right.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
and whats the code from decimal to binary?
jadov
|
|
|
|
|
Well, try reversing the process you have now.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
some body would show me how to split windows( Views ) in a MDI application?
I used to via add a new CMultiDocTemplate object int the InitInstance function. Then ,when the application runs,a small dialog would appear first,which force me to select a view(i thinks it means so).
But i want to show a different splited window by responding to a menu instead of the selecting at first of the program.
Someone would help me,Thanks.
|
|
|
|
|
Dear folks,
We have a perfectly good FP error handler on VC7.1, VC8 and so on. However, none of the stack is visible if we set a breakpoint inside the FP handler. So basically we have no idea where the offending code is that is causing the FP error to fire. Any ideas on how to get a usable stack inside (or outside) the debugger?
An example of the stack:
> MyProgram.exe!IeeeFPHandler(_FPIEEE_RECORD * pieee=0x0012ec10)
Line 168 C++
msvcr71.dll!7c3744fa()
ntdll.dll!7c90e21f()
kernel32.dll!7c80b9bd()
kernel32.dll!7c80b9e6()
msvcr71.dll!7c34d518()
MyProgram.exe!FPEGuardedExecution(int (void *)* func=0x0012fe20,
void * d=0x0012edd4) Line 214 + 0x1d C++
ntdll.dll!7c9037bf()
ntdll.dll!7c90378b()
ntdll.dll!7c937860()
ntdll.dll!7c91b686()
and our handler
#ifdef _WIN32
#include <excpt.h>
#include <float.h>
#include <fpieee.h>
static int fpWarningCount = 0;
static int
IeeeFPHandler( _FPIEEE_RECORD *pieee )
{
string s = "Unhandled floating point error";
if (pieee->Cause.InvalidOperation) {
s = "Invalid floating point operation";
}
if (pieee->Cause.ZeroDivide) {
s = "Floating point zero divide";
}
if (pieee->Cause.Overflow) {
s = "Floating point overflow";
}
if (pieee->Cause.Inexact) {
s = "Floating point Inexact";
}
if (fpWarningCount == 8)
s += "\nSuppressing further floating point errors";
if (fpWarningCount <= 8)
MessageDlg::critical(I18n(s));
fpWarningCount++;
return EXCEPTION_CONTINUE_EXECUTION;
}
|
|
|
|
|
Hello,
I have a application where I need to write a lot of labels and data to a window. The labels and data are located on the window using X, Y coordiates.
It would be easier not to use controls I think, since labels and data need to be placed dynamically on the dialog window, and there is a lot of data. I think it would be easier to write to the window much like a dos window.
Question:
At this point I have created a simple dialog window, but wish to write to it as indicated above using X, Y coordiates. How do I do this?
Jerry
|
|
|
|
|
jerry1211a wrote: How do I do this?
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
jerry1211a wrote: I think it would be easier to write to the window much like a dos window
I don't know if that's a good idea (perhaps you can use a list view...), anyway, you have to override the OnPaint handler, calling the TextOut method of the supplied device context.
hope that helps...
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.
|
|
|
|
|
I want to print as a text a White happy face. On MSWord if you press Alt+ numerical 1 you will get White happy face. Please note that it is non-printable character, but as MsWord and other editors are doing, I do not know the trick. It looks to me it must have some WCHAR code to print it. Any idea?
Agha Khan
|
|
|
|
|
It's the WingDings font, I believe.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
We know that but MSWord does not use WingDings font when drawing ☺ White happy face, but there must be a way without changing any font what so ever, but I don’t know. So I do want to change my font.
Agha Khan
|
|
|
|
|
Has anyone successfully used an updated Platform SDK with VS 2003?
I have followed the instructions in the SDK and set all the paths in VS correctly.
All my projects compile with no warnings or errors.
When linking though, i get unresolved externals CWnd::SendMessage, CDC::DrawText,
and CDC::GetTextMetrics.
The problem is with MFC inlining I believe. MFC 7.10 was built with older Windows include
files. Something to do with Unicode/non-unicode (i.e. SendMessageW/SendMessageA) perhaps.
This was a known issue in the past and I'm wondering if there's a simple workaround.
I could change all the calls to direct API calls but that's kind of ridiculous
It would just be nice to use the PSDK for Windows Server 2003 R2 headers/libs on my "old" VS2003
with MFC 7.10 until I'm in a position to migrate the code to VS2005.
Thanks!
Mark
|
|
|
|
|
Hi,
if the the text line is longer than the CEdit control, how to do this:
when pointing mouse over the control, the whole line is shown in a tip like rectangle (like when pointing to an item in a listControl, the whole item text is displayed in a rectangle) ?
Thanks!
|
|
|
|
|
I believe there's an event when the text has been changed ( it's probably changed by the time WM_KEYUP fires ), so just keep setting the tooltip to the current text.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks!
and, how to set the tooltip to the CEdit text?
hope there's a sample code showing it.
|
|
|
|
|
Does anyone know of any MFC API functions that allows a client to figure out the width of the dropdown arrow in dropdown buttons? Ultimately, I want to know how big MFC is going to make a button, given the text, font, bitmap, and whether or not it's a dropdown button. We can get the width of all of those, but we don't know how wide the dropdown arrow will be. Alternatively, if there's an API function that will predict for us how wide MFC will make that button, that would be even better. That is, I want to know how big the button will be before we actually create it.
|
|
|
|
|
I don't know of any system metric for the dropdown arrow size, especially before the button is
created..
Does the TB_GETITEMRECT message return the size including the arrow?
If so you could subtract the result of TB_GETBUTTONSIZE to get the arrow width...maybe
|
|
|
|
|
I've been searching for hours on a tutorial that would start me off building a Web Crawler in C++, but haven't found anything.
Anyone know of a suitable link?
Thanks.
http://www.atraeyu.org/
|
|
|
|
|
google with "Building a Web Crawler in C++" returns a number of pages that look promising.
|
|
|
|
|
Googling "Web Crawler" in 50 different ways was the second thing I tried (the first was searching through the code project articles). I searched through all the results - there were several written in Java, but I'm not familiar with Java.
http://www.atraeyu.org/
|
|
|
|
|
|
Hi,
I have a class X that instanciates many other classes that have no major relationship with it (no derivation...). However I need these classes to be able to see some members of the X instance that created them. It is not possible to use static members because they need to be specific to one instance of X.
Do you see any possibility smarter than passing a reference on class X to every instanciated class ?
Thanks.
|
|
|
|
|
Why not just create a function with which you can pass the member into.
|
|
|
|