🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

HTML querer

Started by
2 comments, last by CJ 24 years, 7 months ago
The help in VC does have CInternetSession and CInternetFile, at least on my computer.
Make sure you're typing the word into the "Index" tab of the help screen.

I see 6 subtopics for each of those topics, that should be enough to at least get you started.

-fel

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Advertisement
I don't have it *pouts*

can you.......PLEEEEEEASSSSSE copy and paste some?

It's weird, this is the first time my Help CAN'T find something.....

------------------
Dance with me......

Hi,

I'm currently being bored and wrote a small html code querer, but the problem is that I can't get the whole html file.

If I use the following code:

code:
void CMystNetDlg::GotoURL(CString URL){	CInternetSession session;	m_Code += "Quering " + URL + "\r\n";	UpdateData(FALSE);	CInternetFile  *file = NULL;	try	{		file = (CInternetFile*)session.OpenURL(URL);	}	catch(CInternetException* pEx)	{		file = NULL;		pEx->Delete;	}	if(file)	{		m_Code += "Connection established.\r\n";		CString line;		file->SetReadBufferSize(4096);		for(int i = 0; i < 20 && file->ReadString(line); i++)		{			m_Code += line + "\r\n";		}		file->Close();		delete file;	}	else	{		m_Code += "No server has been found \r\n";	}	m_Code += ".............\r\n";	UpdateData(FALSE);}

Then I can only get the maximum of 4096, and not the whole file. I tried commenting it out, but that didn't work, it showed more, but not the whole file. Then, I tried hitting F1, found the key and pressed it. But the HELP of VC++ doesn't have any information about CInternetSession, CInternetFile etc etc.

Can anybody of you give me some more information about these things, or show me an internet site about this? I would be most grateful

------------------
Dance with me......

Alright, apologies in advance to anyone unfortunate enough to unwittingly stumble upon this...

Information following copied directly from MSVC 6.0 help files
CInternetFile Overview:

The MFC class CInternetFile provides a base class for the CHttpFile and CGopherFile file classes. CInternetFile and its derived classes allow access to files on remote systems that use Internet protocols. You never create a CInternetFile object directly. Instead, create an object of one of its derived classes by calling CGopherConnection::OpenFile or CHttpConnection::OpenRequest. You also can create a CInternetFile object by calling CFtpConnection::OpenFile.The CInternetFile member functions Open, LockRange, UnlockRange, and Duplicate are not implemented for CInternetFile. If you call these functions on a CInternetFile object, you will get a CNotSupportedException.To learn more about how CInternetFile works with the other MFC Internet classes, see the articleInternet Programming with WinInet in Visual C++ Programmer’s Guide.#include 

CInternetFile class members:

ConstructionCInternetFile Constructs a CInternetFile object. OperationsSetWriteBufferSize Sets the size of the buffer where data will be written. SetReadBufferSize Sets the size of the buffer where data will be read. OverridablesSeek Repositions the pointer in an open file. Read Reads the number of specified bytes. Write Writes the number of specified bytes. Abort Closes the file, ignoring all warnings and errors. Flush Flushes the contents of the write buffer and makes sure the data in memory is written to the target machine. Close Closes a CInternetFile and frees its resources. ReadString Reads a stream of characters. WriteString Writes a null-terminated string to a file. Data Membersm_hFile A handle to a file. Operatorsoperator HINTERNET A casting operator for an Internet handle. 

CInternetSession Overview:

Use class CInternetSession to create and initialize a single or several simultaneous Internet sessions and, if necessary, to describe your connection to a proxy server. If your Internet connection must be maintained for the duration of an application, you can create a CInternetSession member of the class CWinApp.Once you have established an Internet session, you can call OpenURL. CInternetSession then parses the URL for you by calling the global function AfxParseURL. Regardless of its protocol type, CInternetSession interprets the URL and manages it for you. It can handle requests for local files identified with the URL resource "file://". OpenURL will return a pointer to a CStdioFile object if the name you pass it is a local file. If you open a URL on an Internet server using OpenURL, you can read information from the site. If you want to perform service-specific (for example, HTTP, FTP, or gopher) actions on files located on a server, you must establish the appropriate connection with that server. To open a particular kind of connection directly to a particular service, use one of the following member functions: GetGopherConnection to open a connection to a gopher service.GetHttpConnection to open a connection to an HTTP service.GetFtpConnection to open a connection to an FTP service. QueryOption and SetOption allow you to set the query options of your session, such as time-out values, number of retries, and so on. CInternetSession member functions SetCookie, GetCookie, and GetCookieLength provide the means to manage a Win32 cookie database, through which servers and scripts maintain state information about the client workstation.During an Internet session, a transaction such as a search or data download can take appreciable time. The user might want to continue working, or might want to have status information about the progress of the transaction. To handle this problem, CInternetSession provides for searches and data transfer to occur asychronously, allowing the user to perform other tasks while waiting for the transfer to complete. If you want to provide the user with status information, or if you want to handle any operations asynchronously, three conditions must be set: In the constructor, dwFlags must include INTERNET_FLAG_ASYNC.In the constructor, dwContext must be set to a nonzero value.You must establish a call back function by calling EnableStatusCallback Use the overridable member function OnStatusCallback to get status information on asynchronous retrieval. To use this overridable member function, you must derive your own class from CInternetSession.For more information about asynchronous operations, see the articleInternet First Steps: WinInet in Visual C++ Programmer’s Guide. For general information about using the MFC WinInet classes, see the articleInternet Programming with WinInet in Visual C++ Programmer’s Guide.Note   CInternetSession will throw an AfxThrowNotSupportedException for unsupported service types. Only the following service types are currently supported: FTP, HTTP, gopher, and file.#include 

CInternetSession Class Members:

ConstructionCInternetSession Constructs a CInternetSession object. AttributesQueryOption Provides possible asserts for error checking. SetOption Sets options for the Internet session. OpenURL Parses and opens a URL. GetFtpConnection Opens an FTP session with a server. Logs on the user. GetHttpConnection Opens an HTTP server for an application that is trying to open a connection. GetGopherConnection Opens a gopher server for an application that is trying to open a connection. EnableStatusCallback Establishes a status callback routine. EnableStatusCallback is required for asynchronous operations. ServiceTypeFromHandle Gets the type of service from the Internet handle. OperationsGetContext Gets the context value for an Internet or application session. Close Closes the Internet connection when the Internet session is terminated. SetCookie Sets a cookie for the specified URL.  GetCookie Returns cookies for the specified URL and all its parent URLs.  GetCookieLength Retrieves the variable specifying the length of the cookie stored in the buffer. Overridables  OnStatusCallback Updates the status of an operation when status callback is enabled. Operators   operator HINTERNET A handle to the current Internet session. 

luck.
-fel

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~

This topic is closed to new replies.

Advertisement