|
I saw sample code using sockets and, in the client application, before calling connect there was a bind call, apparently doing nothing.
Was it really necessary?
rechi
|
|
|
|
|
It depends. The client might have wanted to bind to a specific port for some reason. If the sockaddr structure was given a number other than 0 then the client wanted to use a specific port on its end.
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
TCP:
Server - needs a bind before listen
Client - no bind needed
UDP:
Server and Client - if You use bind You will be able to use send and recv, but You might also use sendto and recvfrom. In that case bind is not needed.
Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.
|
|
|
|
|
AAAaahhh. My mistake, sorry.
As for TCP it's all true, but as for UDP:
Client - bind is not needed and You can use connect function with send/recv or sendto/recvfrom without connect
Server - bind is needed to specify the address and port
Uh, it's been a long time since i've used sockets. Sorry again, and sorry in advance if I made any more mistakes
Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.
|
|
|
|
|
Thanx both of you for your efforts!
rechi
|
|
|
|
|
Hi,
I have a need to move a file from one folder to another. It is a .bmp file. How do I do this from within my application.
Thanks
Regards
Ruca
|
|
|
|
|
Use MoveFile
BOOL MoveFile(
LPCTSTR lpExistingFileName, // file name
LPCTSTR lpNewFileName // new file name
);
|
|
|
|
|
I am new to VC++. Can you tell me how to go about learning VC++.
Best Regards
Venkatraman Kalyanam
Chennai - India
You are not an idiot till you open your lips (Anonymous)
|
|
|
|
|
Well, I'm sure you know this but I would suggest buying a beginners book and going through that. They normally explain the Development Environment as well as teach you some c++ and even object oriented programming.
I started with this book: "Microsoft Visual C++ 5: No Experience Required"
- by Steven Holzner.
This is a basic book with examples. Serves to show you how things are done in Visual C++ and what can be done. Not the best book, but simple enough.
I don't know what to suggest for .Net as I have not bought any books myself. And am still working on Visual C++ 6.0.
Of course if you haven't done any coding then you will have to buy a book on programming in general.
Best of luck
Ruca
|
|
|
|
|
The thing is i know how to write a Win32 dll or a ATL component. But i want to know more about MFC and other inner concepts of VC++
Best Regards
Venkatraman Kalyanam
Chennai - India
You are not an idiot till you open your lips (Anonymous)
|
|
|
|
|
www.codeproject.com
www.codeguru.com
www.maxcode.com
http://www.funducode.com/
helps u alot to learn vC++
windows programming by petzrold
MFC programming by Jeff prousise
MFC programming by Krughlinski
these are the books from Microsoft press
and they are good
as u are beginner
take VC++ programming by yp kanethkar(Indian author)
|
|
|
|
|
How to convert from unsigned short[30] to const char *
WCHAR to const char *
|
|
|
|
|
LPCWSTR sUnsignedShort = L"One string";
LPCSTR sAnsiChar = NULL;
USES_CONVERSION;
sAnsiChar = OLE2CA (sUnsignedShort);
|
|
|
|
|
// there are some code maybe useful for you
//WCHAR *,LPOLESTR and LPWSTR are same thing in win32(without UNICODE defined)
//TCHAR to WCHAR
TCHAR szModule[_MAX_PATH];
GetModuleFileName(NULL, szModule, _MAX_PATH);
USES_CONVERSION;
LPOLESTR pszModule = T2OLE(szModule);
//WCHAR to TCHAR
USES_CONVERSION;
LPOLESTR lpOleStr;
StringFromCLSID(clsid, &lpOleStr);
LPTSTR lpsz = OLE2T(lpOleStr);
CoTaskMemFree(lpOleStr);
|
|
|
|
|
I drived a class from CObject;all like this;
class CPerson :public CObject
{
public:
CPerson();
CPerson(CPerson &person);
CPerson & operator =(CPerson person);
CString m_strName;
};
CPerson::CPerson()
{
m_strNmae=_T("");
}
CPerson::CPerson(CPerson &person)
{
m_strName=person.m_strName;
}
CPerson &CPerson::operator =(CPerson &person)
{
m_strName=person.m_strName;
return *this;
}
but erro happed in compling ;the message is:
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(255) : error C2558: class 'CPerson' : no copy constructor available
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(1566) : while compiling class-template member function 'class CPerson __thiscall CArray<class CPerson,class CPerson &>::GetAt(int) const'
Error executing cl.exe.
who can tel me where is the erros!
I am Made!
|
|
|
|
|
A copy constructor is defined to get a const reference, so you have to modify the param list of your copy constructor and your operator =. It should look like (const CPerson& person) .
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Not sure if this is the only error, but you've written m_strNmae instead of m_strName in your constructor
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
<b></b>I drived a class from CObject;all like this;
class CPerson :public CObject
{
public:
CPerson();
CPerson(CPerson &person);
CPerson & operator =(CPerson person);
CString m_strName;
};
CPerson::CPerson()
{
m_strNmae=_T("");
}
CPerson::CPerson(CPerson &person)
{
m_strName=person.m_strName;
}
CPerson &CPerson::operator =(CPerson &person)
{
m_strName=person.m_strName;
return *this;
}
but erro happed in compling ;the message is:
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(255) : error C2558: class 'CPerson' : no copy constructor available
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(1566) : while compiling class-template member function 'class CPerson __thiscall CArray<class CPerson,class CPerson &>::GetAt(int) const'
Error executing cl.exe.
who can tel me where is the erros!
I am Made!
|
|
|
|
|
Your operator= is defined in .h file incorrectly.
CPerson& CPerson::operator=(CPerson person) ;
It should really be:
CPerson& CPerson::operator=(const CPerson& person) ;
Also if you define an operator= you should also define a copy constructor
CPerson(const CPerson& other) ;
CPerson::CPerson(const CPerson& other)
{
// copy across member variables
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
I'm writing my first app in VC++6, what I want to do is have one parent window which contains a number of child windows with grids in them to display data. Each grid must be independant (i.e. they are not just different views of the same data, but contain totally independent sets of data.) The entire project must then be saved, i.e. all the data in all the grids stored in a single file.
This suggested to me that I should not be creating multiple views, so I am currently creating a new dialog whenever the user clicks a button on the toolbar, and keeping track of them all using a CTypedPtrList in the document. I created the app using AppWizard, as an SDI app with CFormView as the view class.
Is this the correct / best way to accomplish what I want? Or should I be doing something else? If this is not the best way, an explanation of the advantages/disadvantages would be very much appreciated.
Cheers,
Jonathan.
|
|
|
|
|
Hi,
I'm sorry that this is not a VC++ problem. But i really want to hear some experience from you in this this message board.
I have a new Pioneer CDRW/DVDRW driver (newly published DVR-A04-J). And I have installed some related softwares (Drag and Drop CD, DVDit! SE, MyDVD). Now when i uninstall all of above softwares, the problem occured: The driver cannot be displayed by the exploer. I have try
many methods for deal with this, but i am failured. I used Windows 2000 professional. Is there a method for finding my cd-rom? or i must be re-install the windows 2000?
Thanks in advance!
chen
|
|
|
|
|
Everytime I open Visual C++ dev studio I get a message box with this remark. Two questions:
1.: What the hell is he talking about.
2.: How to get rid of this annoying thing?
thx in advance...
|
|
|
|
|
ViolaCase wrote:
1.: What the hell is he talking about.
He is talking about windows of the ressource editor (dialogs, bitmaps, icons and so on). Because processing the ressource script is somewhat time consuming, he does not reopen this windows at project open time.
ViolaCase wrote:
2.: How to get rid of this annoying thing?
Just ignore it, it's really nothing you need to care about. Or close all ressource windows before exiting VisualStuido
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
thx for your reply, Daniel
One thing: I really HATE popup windows with stuff I want nothing to do with. Believe me, I am not a dumb.
But... pls..
You sayd: 'Or close all ressource windows before exiting Visual Studio'
Problem: Whatever 'window' I close before exiting VS, this annoying popup msgbox greets me again the next time.
I want to get RID of it...
Hope you will read this, because a lot of posting is going on now here on CP.
|
|
|
|
|
Hm... I always believed it has to do with resource windows.
Just checked it again. It seems to have something to do with the WizardBar. MS calls it a bug. Maybe it helps if you just remove the WizardBar. This knowlegde base article explains the details.
ViolaCase wrote:
Hope you will read this, because a lot of posting is going on now here on CP.
Hey, come on - lots of traffic means wie have a cool forum
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|