|
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.
|
|
|
|
|
Btw, how do you recover password from Win95 pwl file?
|
|
|
|
|
----------------- TestDll.h -----------------
#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
EXPORT BOOL Test1(BOOL b1);
----------------- TestDll.c -----------------
#include "SocketDll.h"
int WINAPI DllMain (HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
return TRUE;
}
EXPORT BOOL Test1(BOOL b1)
{
return b1;
}
======================================================
When my application calls the Test1() function, error occurred.
It reports :
-----------------------------------------------------------------
file: i386\chkesp.c line:42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
-----------------------------------------------------------------
But if the Test1() function has no argument, it works.
I don't know how to correct it.
|
|
|
|
|
> When my application calls the Test1() function, error occurred.
> It reports :
> -----------------------------------------------------------------
> file: i386\chkesp.c line:42
> The value of ESP was not properly saved across a function call.
> This is usually a result of calling a function declared with
> one calling convention with a function pointer declared with
> a different calling convention.
Hm...maybe you compiled your EXE with a different calling convention than your DLL?
In VC6, check the following:
Project -> Settings (or Alt+F7) -> C/C++ Tab -> Category: Code Generation -> Calling Convention
You can also modify the calling convention of each function individually; i.e., try out all the combinations:
EXPORT BOOL __stdcall Test1(BOOL b1) { return b1; }
EXPORT BOOL __cdecl Test1(BOOL b1) { return b1; }
EXPORT BOOL __fastcall Test1(BOOL b1) { return b1; } > When my application calls the Test1...()
Anyway, is your EXE a VB application? Then you'll have to declare the exported function with __stdcall. It's the only calling convention known by VB.
Regards,
RK
|
|
|
|
|
Hi !
In my app, I'm linking at runtime to a dll to call a specific function. It works fine, but instead of calling a function, I'd like to instanciate an object of a class.
I guess I should define in my application a pure virtual base class and in the dll, implement a derived class and instantiate at runtime this class. That's what I guess I should do, but am not able to make it work.
Is it possible to do what I want to do ? How ?
Thank you for your help !
Jerome
|
|
|
|
|
hi...
i am trying to make a graphic editor..kind of like we have in visual studio that allows us to edit icons ans stuff for our VC++ apps...
i have two views and in the editor view there are grids where the user can draw....
now the problem is after drawing the grid the whole things became very very laggy..
then i inserted the class CMemeDC..
now the probem is that even though the flashing is gone...while scrolling,the whole grid is distorted..and goes out of shape....
can someone pls help me???
i dunno hwat to do...
tks in advance..
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
Hi All,
I am seeking some help in sorting a two dimensional array in ascending order. It is a 5x5 array , I tried using a bubble sort but that didn't work. I made a selection sort work but it didn't work on the numbers in differnt rows. (IE where you end wanting to compare column 5 on row 2, with column 1 on row 3.)
Below is a link to a CPP file I've been working on. If anyone has any suggestions it would be great!
http://www.djrhenium.com/arrayprojectinp.cpp
-jay
|
|
|
|
|
What does your array declaration look like? What does it contain?
char letters[5][5] = {{'h', 'o', 'r', 's', 'e'},
{'a', 'p', 'p', 'l', 'e'},
{'g', 'l', 'a', 's', 's'},
{'l', 'a', 'r', 'g', 'e'},
{'g', 'r', 'o', 'u', 'p'}};
Or maybe you have something like:
int numbers[5][5] = {{ 6, 14, 9, 1, 55},
{ 2, 4, 6, 8, 10},
{ 5, 5, 5, 12, 12},
{ 9, 7, 5, 3, 11},
{14, 28, 7, 3, 16}};
In what order would you expect to sort these?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Dave, thanks for the reply.
I actually have a random number generator , generating random numbers between 1-60 into the array. I am trying to sort them in ascending order.
for example:
1 , 2, 3, 4, 5
6 7 8 9 10
etc. the input from the generator is random so i need to start from the bottom and work my way up, or vice versa.
|
|
|
|
|
Can you adapt this as necessary:
void SortEm( int *pNumbers, int nLeft, int nRight )
{
for (int x = nLeft; x < nRight; x++)
{
for (int y = nRight; y > x; y--)
{
if (pNumbers[y] < pNumbers[y - 1])
{
int nTemp = pNumbers[y];
pNumbers[y] = pNumbers[y - 1];
pNumbers[y - 1] = nTemp;
}
}
}
}
int numbers[25];
for (int x = 0; x < 25; x++)
numbers[x] = (rand() % 60) + 1;
SortEm(numbers, 0, 24);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|