Protocol |
Description |
gopher: |
A client/server application that allows the user to browse large amounts of information. It presents the information to the user in a menu format. RFC 1436, The Internet Gopher Protocol, can be found at http://www.isi.edu/in-notes/rfc1436.txt. |
ftp: |
The protocol used for copying files to and from remote computer systems on a network using TCP/IP. This protocol also allows users to use FTP commands to work with files, such as listing files and directories on the remote system. RFC 959, File Transfer Protocol (FTP), can be found at http://www.isi.edu/in-notes/rfc959.txt. |
http: |
HTTP is a stateless and transaction-oriented client/server protocol used to access data on the Web. It relies on TCP/IP for low-level connections. RFC 1945, Hypertext Transfer Protocol - HTTP/1.0, can be found at http://www.isi.edu/in-notes/rfc1945.txt. RFC 2068, Hypertext Transfer Protocol - HTTP/1.1, can be found at http://www.isi.edu/in-notes/rfc2068.txt. |
about: |
Intended to let you output text directly on the page with the aim of providing information about what happened. |
file: |
Allows you to access and browse the local file system as if it were a network resource. |
nntp: |
The name stands for Network News Transfer Protocol and is an application protocol used in TCP/IP networks. Enables clients to read and post information to USENET newsgroups. |
mailto: |
Used to write and drop an email message through a related program. |
Figure 2 Resource IDs
Resource |
ID |
Cursor |
1 |
Bitmap |
2 |
Icon |
3 |
String |
6 |
Animated Cursor |
21 |
Animated Icon |
22 |
HTML |
23 |
Figure 3 The Resource File
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// HTML
//
CEDGE.HTM HTML DISCARDABLE "cedge.htm"
MIND.HTM HTML DISCARDABLE "mind.htm"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// GIF
//
MIND.GIF GIF DISCARDABLE "mind.gif"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
CEDGE.BMP BITMAP DISCARDABLE "cedge.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
Figure 4 Embedded HTML
<html>
<head>
<title>MIND</title>
</head>
<body>
<img src="res://resprot.dll/gif/mind.gif"></img>
<hr>
Find Microsoft Interactive Developer at www.microsoft.com/mind.
<br>
<a href="res://resprot.dll/cedge.htm">Cutting Edge</a>
</body>
</html>
<html>
<head>
<title>Cutting Edge Page</title>
</head>
<body>
<img src="res://resprot.dll/gif/mind.gif"></img>
<img src="res://resprot.dll/2/cedge.bmp"></img>
<hr>
Cutting Edge brings you month after month the
information you need to put everything you've got to work!
</body>
</html>
Figure 5 Using the res: Protocol
Private Sub cmdBack_Click()
wb.GoBack
End Sub
Private Sub cmdFwd_Click()
wb.GoForward
End Sub
Private Sub cmdGo_Click()
wb.Navigate2 txtAddress.Text
End Sub
Private Sub Form_Load()
Dim sResName, sExeName As String
sExeName = App.Path + "\" + App.EXEName + ".exe"
sResName = "res://" + sExeName + "/mind.htm"
txtAddress.Text = sResName
cmdGo_Click
End Sub
Figure 8 ATL Code for a URL Search Hook
// IURLSearchHookImpl.h
//
//////////////////////////////////////////////////////////////////////
#include <AtlCom.h>
#include <ShlObj.h>
class ATL_NO_VTABLE IURLSearchHookImpl: public IURLSearchHook
{
public:
// IUnknown
//
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) = 0;
_ATL_DEBUG_ADDREF_RELEASE_IMPL( IURLSearchHookImpl )
// IURLSearchHook
//
STDMETHOD(Translate)(LPWSTR lpwszSearchURL, DWORD cchBufferSize)
{
return E_FAIL;
}
};
// MailTo.h : Declaration of the CMailTo
#ifndef __MAILTO_H_
#define __MAILTO_H_
#include "resource.h"
#include "IURLSearchHookImpl.h"
/////////////////////////////////////////////////////////////////////////////
// CMailTo
class ATL_NO_VTABLE CMailTo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMailTo, &CLSID_MailTo>,
public IURLSearchHookImpl,
public IDispatchImpl<IMailTo, &IID_IMailTo, &LIBID_MAILHOOKLib>
{
public:
CMailTo() {}
DECLARE_REGISTRY_RESOURCEID(IDR_MAILTO)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CMailTo)
COM_INTERFACE_ENTRY(IMailTo)
COM_INTERFACE_ENTRY(IURLSearchHook)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IURLSearchHook
public:
STDMETHOD(Translate)(LPWSTR, DWORD);
};
#endif //__MAILTO_H_
// MailTo.cpp : Implementation of CMailTo
#include "stdafx.h"
#include "MailHook.h"
#include "MailTo.h"
/////////////////////////////////////////////////////////////////////////////
// CMailTo
HRESULT CMailTo::Translate(LPWSTR lpwszSearchURL, DWORD cchBufferSize)
{
if( NULL != wcschr(lpwszSearchURL, '@') )
{
const LPWSTR L_MAILTO = L"mailto:";
LPWSTR wszURL = new WCHAR[cchBufferSize];
wcscpy(wszURL, L_MAILTO);
wcsncat(wszURL, lpwszSearchURL, cchBufferSize);
ZeroMemory(lpwszSearchURL, wcslen(wszURL));
wcsncpy( lpwszSearchURL, wszURL, cchBufferSize);
delete [] wszURL;
return S_OK;
}
return E_FAIL;
}
Figure 11 IInternetProtocol
Function |
Description |
LockRequest |
Locks the request |
UnlockRequest |
Frees any resources associated with a lock |
Read |
Reads data retrieved by the pluggable protocol handler |
Seek |
Moves the current seek offset |
Abort |
Aborts an operation in progress |
Continue |
Allows the pluggable protocol handler to continue processing data |
Resume |
Not currently implemented |
Start |
Starts the class associated with the
asynchronous pluggable protocol |
Suspend |
Not currently implemented |
Terminate |
Releases the resources used by the
pluggable protocol handler |
Figure 12 IInternetProtocolSink
Function |
Description |
ReportData |
The amount of data that is available |
ReportProgress |
Progress made in a state operation |
ReportResult |
The result of an operation |
Switch |
Passes data from an asynchronous pluggable protocol module |