|
Thanks guys, got it to work thanks to your tips !
|
|
|
|
|
I have a application developed in MDI.
The strange thing is that it will cause my system utilizing 100% of the CPU usage.
I have checked the OnIdle(), OnTimer and OnUpdateCommandUI but it is not the cause of the problem
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
You will need to trim the code down to the minimum required to reproduce the problem. Or, you can create a new MDI application and add code to it until the problem appears.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Please help me. i am a MFC beginner , and i don't know how to combine two numbers in a dialog box. for example: when a and b are entered into Box1 and Box2, In Box3 will show "ab", NOT "a+b" . Please........HELP.
|
|
|
|
|
using CString + operator
Eg.
CString str = atoi(YourInteger);
str += "2";
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
using CString + operator
Eg.
CString str = atoi(YourInteger);
str += "2";
Could u explain more on these?
I am not able to follow it.
|
|
|
|
|
hey, guy, try this...
...
char szA[100], szB[100], szC[200];
int c;
printf(szA,"%d",a); //here, a is a int number entered on edit box 1.
printf(szB,"%d",b); //here, b is a int number entered on edit box 2.
strcpy(szC,szA);
strcat(szC,szB);
c = atoi(szC); //here, c is the int number you want, just place it into edit box 3
...
hope this helps!
|
|
|
|
|
char szA[100], szB[100], szC[200];
int c;
printf(szA,"%d",a); //here, a is a int number entered on edit box 1.
printf(szB,"%d",b); //here, b is a int number entered on edit box 2.
strcpy(szC,szA);
strcat(szC,szB);
c = atoi(szC); //here, c is the int number you want, just place it into edit box 3
This doesn't work for me.
What is char szA[100], szB[100], szC[200];?
Should I use Cstring for BOX3?
|
|
|
|
|
How "it doesn't work for you"? what error occurred?
szA,szB,szC just are temporary char string variables.
|
|
|
|
|
No error occurred, but nothing appear in box3
|
|
|
|
|
oh, god...
just attach a CString class variable with your edit box 3, and then make it equal to "szC", and then call UpdateData(FALSE) to make it show in edit box 3...
|
|
|
|
|
and, you can also...
attach a int variable with your edit box 3, and then make it equal to c, and then call UpdateData(FALSE) to make it show in edit box 3...
|
|
|
|
|
Anonymous wrote:
What is char szA[100], szB[100], szC[200];?
I think you need to find yourself a good beginner's C++ book
if you need to ask that question. Never mind string concatenation, read up about variable declaration first.
Let us walk before we run.
I Dream of Absolute Zero
|
|
|
|
|
Grab some tutorials on CDialog in codeproject.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
CString cstrMyNumbers(_T(""));
cstrMyNumbers.Format(TEXT("%d%d"), a, b);
Simple as that
Regards,
Michael Mogensen, mm it-consult dk.
><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>
|
|
|
|
|
Hi… there,
I wonder how you guys deal with the case of more than one available IP address (multi-IP) on the local host on the TCP/IP programming mode.
I'm talking about the "multi-IP" here, it's usually the system which installed with more than one network adapter (physical or virtual), i.e., more than one available IP address…
In the case, when you call the socket API "bind" to bind your socket with the local host, you must choose the proper IP address from the multiple IP addresses, otherwise, your socket possibly cannot work.
So, my problem is: how do you know which IP address is available on that LAN? The current solution I'm using is: Present a dialog with a list control, and all the available local IP addresses listed on the list control, then ask the user select the proper one that my program would use...
Does anyone here can tell another better solution to this problem? i.e., how does my program automatically detect all the IP addresses, then automatically pick up the proper one, instead of asking the user for this?
Thanks!
|
|
|
|
|
What do you mean by the 'proper one'. Usually it is sufficient to use ADDR_ANY. This allows you to listen on all local address.
From MSDN docs for bind() :
If an application does not care what local address is assigned, specify the manifest constant value ADDR_ANY for the sa_data member of the name parameter. This allows the underlying service provider to use any appropriate network address, potentially simplifying application programming in the presence of multihomed hosts (that is, hosts that have more than one network interface and address).
...cmk
Rosencrantz: I don't believe in it anyway.
Guildenstern: What
Rosencrantz: England
Guildenstern: Just a conspiracy of cartographers then.
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote:
...This allows you to listen on all local address...
Well, if you just "listen" and not "send" data,or the local host has ONLY one IP address, it would be fine. But by this way, if the local host has more than one IP address and you want to send data to the other host, it may not work sometimes, why? because "the underlying service provider" sometimes would automatically bind an "exist-but-not-connect" IP (though a host have several IP addresses, maybe only one or some connectable and others don't), and, of course, you cannot send data outside successfully via it... and this is approved in my current application
What I mean "proper one" is: you cannot alway hope that the ADDR_ANY would do the right thing for you, you must find out the working and connectable IP address, and then bind your socket to it.
Thank you!
|
|
|
|
|
Ok, so the only case you are looking at is creating a socket to use as a client that you can use send() on.
Although i haven't tried it, you may want to try creating the socket, don't bind it, and then use sento() as the first send, as this performs an implicit bind on the socket. After that you should be able to use send(). I would assume that the implicit bind() would bind to an address that allows a connection to the specified node/port i.e. is 'live'.
...cmk
Rosencrantz: I don't believe in it anyway.
Guildenstern: What
Rosencrantz: England
Guildenstern: Just a conspiracy of cartographers then.
Save the whales - collect the whole set
|
|
|
|
|
I haven't tried this myself: you can probably use the gethostbyname function to return a HOSTENT structure, the returned structure contains a list of null terminated ip addresses.
Good luck.
My articles and software tools
|
|
|
|
|
Hello!
I created a class (using the 'New Class' command). I want now to move the files (.h and .cpp) from this class in a library (so this class can be used in several programs). So I need to remove the #include "stdafx.h" and the #include "MyProg.h" files.
The problem now is that when I compile, I get some errors ('BOOL' : missing storage-class or type specifiers and things like that).
So I tried to include some header files, but nothing works (when I include afx.h, I get some other errors, the same for winbase.h, .....).
So, what the hell must I do or include to have it work ?????
Thanks for response
|
|
|
|
|
> So, what the hell must I do or include to have it work ?????
Well, first you'll need to turn off precompiled headers for you .cpp file.
1. Project -> Settings (or Alt+F7) -> C/C++ Tab -> Category: Precompiled Headers
2. On the left pane select your .cpp file.
3. Select "Not using precompiled headers" on the right pane.
Of course, you'll still need to include the appropriate headers...
Regards,
RK
|
|
|
|
|
It was already done !
But I don't know wich header to include... If I include "afxwin.h" for example (like in the stdafx.h file), I have a lot of errors (from within this file).... So I don't know what to do
Thanks for your response
|
|
|
|
|
Is your class autonomous, or does it rely on other classes/types/objects/etc? If the former, you will need to #include each file that stdafx.h would have otherwise included for you (e.g., windows.h).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
hello everybody,
how to recovery password(include mail accounts information) form Outlook XP pst file.
|
|
|
|
|