|
Glad to hear it's working.
As far as literature is concerned for mapping modes, viewports, etc...
I would have to say Ivor Horton does a superb job of taking anyone from A to Z. He goes through the process of building a drawing program in the second half of the book. The first half of the book is dedicated to C++ so the book is probably one of the best values out there.
For Visual C++ 6.0 (or 2003) get
Ivor Horton
Beginning Visual C++ 6
For Visual C++ 2005 get
Ivor Horton
Beginning Visual C++ 2005
(I flipped through this at the bookstore and it's basically the same as the previous book with some updates for 2005.)
|
|
|
|
|
Hi,
I am trying to make MSN client using VC++.NET. I am using socket for this. But I get “WSAETIMEDOUT (10060) Connection timed out ” error when I am connecting to messenger.hotmail.com server at port number 1863. Can I know what is wrong with this code? Thanks in advance. Priyank
WORD version;
WSADATA wsaData;
int rVal=0;
version = MAKEWORD(1,1);
WSAStartup(version,(LPWSADATA)&wsaData);
LPHOSTENT hostEntry;
//store information about the server
hostEntry = gethostbyname("messenger.hotmail.com");
if(!hostEntry)
{
::MessageBox(NULL,"Failed gethostbyname()","Test",MB_OK);
return false;
}
//create the socket
SOCKET theSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(theSocket == SOCKET_ERROR)
{
::MessageBox(NULL,"Failed socket()","Test",MB_OK);
return false;
}
//Fill in the sockaddr_in struct
SOCKADDR_IN serverInfo;
serverInfo.sin_family = AF_INET;
serverInfo.sin_port = 1863;
serverInfo.sin_addr = *((LPIN_ADDR)*hostEntry->h_addr_list);
rVal=connect(theSocket,(LPSOCKADDR)&serverInfo,sizeof(serverInfo));
if(rVal==SOCKET_ERROR)
{
int errCode = ::WSAGetLastError();
::MessageBox(NULL,"Failed connect()","Test",MB_OK);
return false;
}
closesocket(theSocket);
WSACleanup();
MessageBox(NULL, "Connection was made", "SOCKET", MB_OK);
-- modified at 11:52 Tuesday 31st October, 2006
|
|
|
|
|
priyank_ldce wrote: serverInfo.sin_port = 1863;
try
serverInfo.sin_port = ::htons(1863);
|
|
|
|
|
Thanks it works
|
|
|
|
|
Well, i finnaly got the app to read from a file, anyways, it only reads up to a space, then it stops (unless you read from the file again, in a loop or something - of course each time its like a new line)
Anyways, im sure y'all already know that, and you may have guessed the question, how do a read a whole line upto an newline constant of some kind, rather that a space?
|
|
|
|
|
The Undefeated wrote: ...how do a read a whole line upto an newline constant of some kind, rather that a space?
Use the getline() method.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
That'd do it, thanks. Didn't i tell you it was an easy question.
|
|
|
|
|
use std::ifstream::getline()
|
|
|
|
|
Thanks for you help at first!
I'm a chinese student and my english isn't very well! A I really want your can give me some help on my english and computer courses(I'm very interesting in Visual C++)!
I'm a tenderfoot about C++ language!
I'm confusing by the question as follows:
there is parts of my code:
int a=10;
int* ap=&a;
char c='b';
char* cp=&c;
when I want to get the vaule of the Pointers point to;
cout<
|
|
|
|
|
Yeah, i got garbage as well, except i had a whole array of chars (an entire 7) to get round the problem, i had to write out each character at a time, a bit much effort really
|
|
|
|
|
you get garbage values after the character 'b' because the operator << is overloaded for a code char* parameter, to be a C-style string.
such a string is supposed to be NUL terminated (with '\0' ), so it read from the beginning (the 'b' character) until it finds a '\0' character in the memory after the 'b' , even if it is not yours.
if you want to see the address of the pointer, do this :
cout << (const void*)cp;
-- modified at 12:01 Tuesday 31st October, 2006
|
|
|
|
|
wanlim0817 wrote: ...Is there some differences between the int* type and cahr* type?
Of course. One points to an int and the other points to a char .
wanlim0817 wrote: And why there are some garbage gets when I use "cout<<cp"!< blockquote="">
Did you look to see what << operator was being called?
cout << (const void *) cp;
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
David, just a personal wondering, but here, is there a reason to use (const void*) more than the non-const (void*) cast ?
i don't see anything serious, so maybe you could light me up...
|
|
|
|
|
toxcct wrote: ...is there a reason to use (const void*)...
It matches the method's signature.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
obviously
I didn't think that far. thanks
|
|
|
|
|
I always receive following error when compile the win32 vs project written in C. But I checked the makefile and couldn't find any variable at the left of the equal sign is not defined.
Any suggestions???
------ Rebuild All started: Project: f1, Configuration: Debug Win32 ------
Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1063: missing macro name before '='
Stop.
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
|
|
|
|
|
Can you whittle the makefile down to just the lines necessary to reproduce the problem? Is the macro name being complained about itself a macro that expands to nothing?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
I am using a CFile class to work with a file and I would like it to retain its original date and time setting. I obviously forgot what to use to get and set the date and time of a file. Pease help (I seem to remember that I should not use the CFile class itself but maybe do something with CFileFind; however this gets a file date and time, but does not set it)
Thanks in advance,
William
|
|
|
|
|
Why are you not using CFile::SetStatus() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks,
That was indeed the one I forgot about.
Regards,
William
|
|
|
|
|
Hi All,
I just in between of a project.. i need to add some menuitem in the default cut,copy,paste menu.. but problem is that i am not able to get Handle to the Menu so that.. i can add my new sub item...
Could someone give me some pointer to solve this problem.. in brief i want to extend the default Right Click Cut,Copy,Paste menu which come when you right click on any EDIT Box in unmanaged VC++
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
I know your problem and I think I saw an example that insert items to right click on editbox but i dont know its on www.codeproject.com or www.codeguru.com I search for it if I found I reply to you
|
|
|
|
|
WhiteSky wrote: but i dont know its on www.codeproject.com or www.codeguru.com I search for it if I found I reply to you
my search is't fruitfull today, might be yours
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
|
WhiteSky wrote: How to modify a CEdit context menu[^]By Mr PJ Arends.
thanks hamid!.. that i am looking for.. thanks a ton!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|