Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Questions about Winsock

Status
Not open for further replies.

minifiredragon

Programmer
Jun 29, 2003
68
US
The tutorial I have here goes through how to create a socket in a dialog class. Here is what my question is. The app I am building is a SDI with database, so I have a CFormView.

To set up a socket it says I need to set up a pointer to the parent dialog window.:

SetParent(CDialog* pWnd)

since I am using a CFormView, would I use

SetParent(CFormView* pWnd)??

maybe a CView or CDocument?? I am looking but I can't really tell.
 
I totally applaud your initiative and I certainly understand the draw to developing internet (socket) applications. But man your way to green to really undertake all that right now. You need some serious time getting to understand objects and interactions and basic C/C++ fundamentals before tackling something as complex as socket communications in a UI application.

"But, that's just my opinion... I could be wrong."

-pete
 
I only want to transmit a simple string of character back and forth between 2 PC's. And the Teach yourself C++ in 21 days gives a pretty good example (it does way more then what I need). I just am not sure where to point the pointer too.

I have tried CView and CFormView, but it complains at compile time. Yes I am green, but I also learn quick. :)
 
>> but it complains at compile time.

Without seeing a lot more of your code it is not possible to tell what you need to do. Also don't post messgages about compile errors without posting the error message and the line of code it points to and any associated information to explain that line of code (like function signatures).

>> but I also learn quick. :)
[lol]

I don’t care how fast you learn, these days there are thousands of people out there inventing new stuff faster than you can learn. And by the time you started there was already more stuff than you could ever learn.

Teach yourself C++ in 21 days That is just ridiculous. You can’t teach yourself VB in 21 days let alone C++. I wouldn’t touch that book with a ten foot pole.

The thing is, even if you manage to copy some code and get it to work, if you don’t understand what is happening then you have not really learned anything. Be patient, it takes everyone time to learn C++ I’ve been a C++ student for 14 years now!

Perspective, I just interviewed a fellow last week that had 8 years experience and C++ expert on his resume. I have interview questions for C++ ranging from a 2 to 7 on a scale of 1 to 10 with 10 being an expert of course. He couldn’t answer a single 3 question, nor white board a single line of code without a compile error. I have interviewed between 40 and 100 candidates in the past 10 years and about 4 of them had anywhere near an accurate assessment of their level of knowledge of C++. The reason my questions stop at a rating of 7 is because it is a stretch to consider myself a 7 on a scale of 1 to 10 and in fact I don’t , I’m about a 5 or maybe a 6. My questions go to 7 to give people the benefit of doubt.

Ouch… damn, fell off my stump… hey where did everyone go? [lol]


-pete
 
I must say my main occupation is not programming. Sure I write HTML, Coldfusion and Java programs when needed for websites. I am usually knee deep in an accident reconstruction. Assisting my boss with trying to figure out what happened, or recreating the evidence into an animation for out client. Which has led me to writing a lightwave plug in or running around repairing a PC or software issue.

I will say when I am learning something, I don't just copy and past code. I find out how it interelates and what else it can do. And I don't just rely on that C++ in 21 days crap (yes they are crap) but it has given my direction on what to do. I have roughly 7 resource books piled up here (plus stuff from u and PerFnurt) From a programmers reference on C/C++ to Core Visual C++ and Using Visual C++. Got a few MS books in there too.

I didn't place the compile erros because I knew what they went too. I didn't attach the pointer to the correct parent (tried CView and CFormView and CDialog <-- that was a stretch).

That is the only thing I am lacking in understanding with an SDI document is what do I use for the parent.
 
To set up a socket it says I need to set up a pointer to the parent dialog window.:

SetParent(CDialog* pWnd)


So
Code:
SetParent(..)[/b] is a member of what class? and post the function signature. without that we have no way of knowing what is a valid parameter.

-pete
 
With a bit of digging and browing through MSDN's Socket usage code (a chat program) I was able to figure out that I needed to use:

(CICServerDoc* pDoc).

Now I have another issue of which I don't understand and am starting a new thread. Thanks for the help though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top