   Connect to web from my code [Resolved]
  YoVC++ 2008 Win API not MFC...I want to do a menu choice in my app that connects the user to my web site.Just wondered about what sort of C++ code I need to do that? Will I need to open a socket or something (I'm just guessing, I really have no idea but I vaguely remember having to do that when I modified Eggbot code years ago)?Can't find any sample code on the net other than IRC stuff and I'm not sure how much of that socket stuff is IRC related and how much of it I need just to check for an internet connection and then send a user to my web site.m0ng00se[Edited by - m0ng00se on March 18, 2008 3:30:07 PM]
  It depends on what you mean by connect to your website. If you just want to open your website in a new window using the user's default browser you can use ShellExecute().   ;  Yup. Open a socket to the web server's IP on port 80, then send an HTTP request, like:GET /path/to/file/filename.ext HTTP/1.0Host: ServerName.comConnection: CloseWhere each line ends with "\r\n", and the there's a blank line at the end of the request. If all goes well, you'll get the file you requested, after the HTTP response header (Which ends with a blank line).   ;  Thanx.I just want a menu choice in the HELP menu of my game like most apps have these days so a user can go and download bugfix patches, updates, tutorials etc. Nothing fancy at all. I can do the menu stuff in my sleep but just a bit vague about the internet/web side of things. Thanx for the help, I'll try it out today.Do I need any cleanup code afterwards to close the socket or anything or does Windows take care of all that for me? Like if they shut the web page I won't be left with an open socket or anything? Sorry if my question seems a bit dumb but I'm not used to writing any code that connects to the net.m0ng00se   ;  It sounds like using ShellExecute is for you.I am not sure if ShellExecute creates a new process, and how/when this process is closed. I suspect it works the same way the old exec* functions did and "becomes" the process it opened. If that is the case you don't have to worry about a thing. Just use it and let it fly;  Thanx that works great.I also found the function WinInet() and all it's associated HTTP functionality but ShellExecute should do the trick just fine for what I want.Thanx guys, your help was much appreciated.m0ng00sehttp://www/freewebs.com/m0ng00se/   