Home > Store

Essential Winlnet: Developing Applications Using the Windows Internet API with RAS, ISAPI, ASP, and COM

Register your product to gain access to bonus material or receive a coupon.

Essential Winlnet: Developing Applications Using the Windows Internet API with RAS, ISAPI, ASP, and COM

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 1999
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 528
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-37936-8
  • ISBN-13: 978-0-201-37936-5

The era of stand-alone, self-contained applications is rapidly ending. Distributed, networked applications have become critical to meeting business needs in a fast-paced, dynamic world. Until now, building networked Windows applications wasn't easy. But now Microsoft has released a powerful new Windows Internet API (WinInet) that dramatically simplifies the process of creating Internet-enabled Windows applications.

WinInet makes it possible to create Windows applications that can download Web pages, access server applications, upload and download files, and traverse Gopher document systems--allowing developers to build such sophisticated Windows Internet applications as full-fledged Web browsers, home banking applications, and stock portfolio programs.

Essential WinInet is a comprehensive guide to this powerful Windows Internet API. It starts with a tutorial on WinInet basics and a methodical description of the API's protocol-specific functions for HTTP, FTP, and Gopher, then proceeds to explore more advanced topics, examining how WinInet works with other Internet tools and client/server technologies. This book addresses such essential topics as:

  • Using WinInet with MFC and Visual Basic
  • Understanding asynchronous WinInet
  • Writing HTTP COM components
  • Establishing dial-up connections, including applying the RAS API
  • Introducing the concept of client/server Internet programming
  • Implementing a complete client/server solution using WinInet with ISAPI and ASP

Numerous sample applications throughout this book explore WinInet's capabilities and show you how to put the API to work. The samples include a full-featured asynchronous FTP client for Windows; a stock portfolio application that can connect to real-time Internet stock quote providers; and a client/server application that incorporates WinInet, ISAPI, and ASP. Much more than just a tutorial, this practical resource contains the kinds of pointers, work-arounds, and creative solutions that will save you hours of frustration and inspire you to make full use of the API.



0201379368B04062001

Downloads

Source Code

Download the Source Code for the book Essential Winlet.

Extras

Web Resources

Click below for Web Resources related to this title:
DevelopMentor

Sample Content

Table of Contents



Preface.


Organization.


Tips.


Web Site.


Acknowledgments.

I. WININET BASICS.

1. WinInet Basics.

Is This Book for You?

Prerequisites.

Book Overview by Chapter.

Internet Overview.

Developing Internet Applications.

Internet Protocols.

Clients.

Server Components.

Introducing WinInet.

Standard API.

What Can You Do with WinInet?

HTTP, FTP, and Gopher.

Dependencies.

Redistributing WinInet.

Programming with WinInet.

Windows CE.

Documentation and Samples.

Microsoft Internet Client SDK.

Samples.

Advantages of WinInet over Winsock.

Easy to Use.

Built-in Caching.

Easy Connections.

Security.

Advantages of Winsock over WinInet.

Your First WinInet Program.

2. WinInet General Functions.

API Flags.

HINTERNET Handles.

WinInet General Functions.

Handle Hierarchy.

InternetOpen.

The Next Step.

InternetConnect.

InternetSetStatusCallback.

InternetCloseHandle.

General Internet Function Summary.

Internet File Functions.

InternetReadFile.

InternetWriteFile.

InternetFindNextFile.

InternetSetFilePointer.

Reading Files without the Content-Length Header.

Locking File Resources.

Internet Option Functions.

Internet Time Functions.

Other Internet Helper Functions.

InternetConfirmZoneCrossing.

InternetErrorDlg.

InternetGetLastResponseInfo.

3. Handling URLs.

URL Basics.

InternetOpenUrl.

Using SSL with InternetOpenUrl.

Helper Functions.

InternetCanonicalizeUrl.

InternetCombineUrl.

InternetCrackUrl.

InternetCreateUrl.

InternetOpenUrl Sample Program (InetURL).

Processing OnFetch.

HTTPS Example.

FTP Example.

Gopher Example.

II. WININET PROTOCOL-SPECIFIC FUNCTIONS.

4. HTTP Functions.

The HTTP Protocol.

The HTTP Model.

The HTTP Request.

The HTTP Response.

Using Telnet to Test HTTP.

A Complete HTTP Transaction.

HTTP Protocol Summary.

WinInet HTTP Functions.

HTTP Hierarchy.

HTTP Functions Overview.

HttpOpenRequest.

HttpAddRequestHeaders.

HttpSendRequest.

HttpQueryInfo.

InternetErrorDlg.

HTTP Authentication Techniques.

Using SSL with HTTP.

Web Page Retrieval Example.

5. FTP Functions.

The FTP Protocol.

The FTP Model.

FTP Commands.

FTP Replies.

Minimum Implementation.

A Typical FTP Scenario.

Using Telnet to Test FTP.

FTP Protocol Summary.

WinInet FTP Functions.

FTP Hierarchy.

FTP Functions Overview.

Sample FTP Client.

FTP Function Descriptions.

6. Gopher Functions.

The Gopher Protocol.

The Gopher Model.

Gopher Response Items.

Gopher Selector String.

Using Telnet to Test Gopher.

Gopher Protocol Summary.

Gopher+.

WinInet Gopher Functions.

Gopher Hierarchy.

Gopher Functions Overview.

Sample Gopher Application.

Function Descriptions.

III. MFC AND VISUAL BASIC.

7. WinInet MFC Internet Classes.

Benefits.

WinInet MFC Classes.

Getting Started with MFC WinInet Support.

CInternetSession.

CInternetFile.

CInternetConnection.

HTTP Classes.

FTP Classes.

Gopher Classes.

CInternetException.

Global MFC Internet Functions.

8. WinInet in Visual Basic.

VB 5.0.

Microsoft Internet Transfer Control.

Properties.

Methods.

Events.

Sample Application Using OpenURL.

Using WinInet Directly.

Declarations.

Revamped Sample Application Using InternetOpenUrl.

IV. ADVANCED WININET.

9. Asynchronous WinInet.

Synchronous versus Asynchronous.

Pros and Cons.

WinInet's Built-in Asynchronous Support.

MyFTP: Asynchronous FTP Sample Application.

Establishing the Asynchronous Internet Session.

InternetStatusCallback.

INTERNET_STATUS_CALLBACK.

OnConnect.

OnDisconnect.

OnGet.

OnPut.

MyStatusCallback Implementation.

FillRemoteList.

The Rest of the Details.

10. Reusable WinInet COM Components.

Stock Watcher Sample Application.

The QuoteProvider Component.

The CProviderYahoo Component.

Adding Interface Methods.

Didn't We Mean IQuoteProvider?

Connection Points.

IQuoteProviderEvent.

Creating Additional IQuoteProvider Components.

The QuoteProvider Component Category.

The HTTP Component.

IHttpRequest Interface.

WinInet and Threads--A Quick Thread Tutorial.

HttpWorkerThread.

The Stock Watcher Application.

CQuoteProviderDlg.

CQuoteProviderEventSink.

Refresh All.

11. Establishing a Dial-up Connection.

Prerequisites.

WinInet Dial-up Functions.

InternetAutodial and InternetAutodialHangup.

InternetDial and InternetHangUp.

InternetGoOnline.

InternetGetConnectedState.

InternetSetDialState.

To Use or Not to Use . . . That Is the Question!.

Remote Access Service.

Using the RAS Common Dialogs.

Begin and End a RAS Connection with RasDial and RasHangUp.

Working with Phonebook Entries.

Windows NT 4.0 RAS AutoDial.

RAS Connection Information.

V. INTERNET CLIENT/SERVER APPLICATIONS.

12. Internet Client/Server Applications with WinInet, ISAPI, and ASP.

Internet Client/Server Development Decisions.

Client Decisions.

Server Decisions.

BugTracker: A Client/Server Bug-Tracking System.

BugTracker Overview.

Sample ISAPI Extension DLL.

Active Server Pages.

Generating an HTML View.

Sample WinInet Client.

Appendix A. TCP/IP Tutorial.

TCP/IP Protocol Layering.

TCP.

IP.

The Physical Layer.

Appendix B. API Flags.

Appendix C. Internet Option Flags.

Appendix D. Error Messages.

Appendix E. Recommended Reading.

WinInet.

Internet Protocols.

COM and ATL.

Multithreading.

ISAPI and ASP.

Index. 0201379368T04062001

Preface

A few years ago I found out that I would be responsible for making our Windows product capable of connecting to a client's backend system and downloading data via the Hypertext Transfer Protocol (HTTP). As is common these days, I had a very short time frame. At the time, all I knew about HTTP was that somehow it made the Internet work. After becoming familiar with the protocol, I started researching the development tools available for the task at hand.

Because our application required advanced features like the secure sockets layer (SSL), proxies, dial-up connections, and caching, right away I knew that Winsock was out of the question. Although Winsock is what most developers use in projects like this, it requires the developer to implement all of the desired protocol functionality. The time frame dictated that this was not viable.

I continued my search for the latest and greatest HTTP component. I wanted something that not only took care of the advanced protocol features, but would also allow me to work with the protocol through a high-level interface. Although I found a few ActiveX controls that claimed to do this, I found all of them lacking in major functional areas.

Just when I thought all hope was lost, I discovered Microsoft's new Windows Internet API, also known as WinInet. After immersing myself in WinInet, I was pleased to find that it provided just the layer of abstraction that I needed. I learned that WinInet elegantly simplifies all of the advanced HTTP features mentioned earlier. In short, it was the perfect development tool for the project.

As it turned out, choosing WinInet allowed us to complete the project successfully on schedule with all of the required HTTP functionality incorporated. Although I make it sound like a bed of roses, there were plenty of obstacles along the way. The biggest obstacle was the lack of WinInet documentation. Because WinInet is such a new and unheard of technology, not much WinInet documentation exists.

As a result of this lack of documentation, I struggled through the WinInet learning curve and other problematic issues that cost me many late nights. After completing the project, I decided that I could help other developers avoid the same problems that I encountered. Hence, I set out to write a few articles for Microsoft Interactive Developer and Microsoft Systems Journal on the topic. Publishing the articles was like giving a few drops of water to a parched soul. The e-mail started pouring in with follow-up questions on various WinInet topics.

Even today, the WinInet documentation only includes the online documentation, a few technical articles, and a single chapter in a couple of Visual C++/Microsoft Foundation Classes (MFC) books. After experiencing the demand and witnessing the shortage, I realized the need for a single, authoritative source for WinInet information--Essential WinInet.

At the time of this writing, Essential WinInet is the only book on the market dedicated entirely to the Windows Internet API. Other books may cover WinInet briefly, but none of them helped me in my time of need. The purpose of this book is to help both the WinInet beginner as well as the WinInet warrior who is already battling on the front line. This book is more than an API tutorial because it's based on real-world experience. Throughout the book you'll find valuable information and basic tips that I wish someone would have told me when I first started. Hopefully, this book will not only save you time and money, but will also reduce grief and headaches.

Organization

This book is divided into five parts: WinInet Basics, WinInet Protocol-Specific Functions, MFC and Visual Basic, Advanced WinInet, and Internet Client/Server Applications. If you're a WinInet beginner, you'll benefit tremendously from Parts I and II. By the time you finish the first two parts, you'll have a complete understanding of WinInet and will be able to write WinInet programs using any of the WinInet-supported protocols.

If you're an MFC or Visual Basic programmer, you'll want to pay special attention to Part III. The two chapters that make up Part III focus on using WinInet with each of these popular development tools. The chapter on MFC not only shows you how to use the WinInet MFC classes, but also provides valuable insight into how the classes interact with the API behind the scenes.

Part IV covers advanced WinInet topics, including asynchronous WinInet, writing HTTP Component Object Model (COM) components, and establishing dial-up connections (also covering the Remote Access Service API). Each chapter in this section offers a practical sample application worth more than a thousand pages of explanation. For example, Chapter 9 walks through the process of creating a full-featured, asynchronous File Transfer Protocol client for Windows. Also, Chapter 10 demonstrates how to develop my all-time favorite sample program, Stock Watcher. Stock Watcher is a personal stock portfolio application that is capable of connecting to various stock quote providers on the Internet (Yahoo!, Quote.com, and Datek) and downloading real-time stock quotes.

The final part of this book, Part V, introduces the concept of Internet client/server programming. It briefly covers the most widely used server-side technologies including Common Gateway Interface (CGI), Internet Server API (ISAPI), and Active Server Pages (ASP); then it walks you through a sample program that demonstrates how to implement a complete client/server solution using these technologies.

Appendix A contains a Transmission Control Protocol/Internet Protocol (TCP/IP) tutorial for those of you craving to know more about how the Internet works under the hood. This section covers both the TCP and IP protocols, and offers some informative diagrams to help you see through the fog. Appendixes B, C, and D contain descriptions of the most common WinInet API flags, option flags, and error messages. Finally, Appendix E contains a list of recommended supplemental reading on most of the technologies mentioned throughout the book including WinInet, Internet protocols, COM, Active Template Library (ATL), multithreading, Internet Server API (ISAPI), and Active Server Pages (ASP). If this book leaves you wanting more in one of those areas, be sure to check out my recommendations.

Tips

The tips included throughout this book are very helpful. Some are related to a problem that I encountered that cost me extra time to figure out. Other tips contain pieces of information not found anywhere in the online documentation. You can be sure that all tips found in this book are definitely tip worthy and should not be overlooked. Tips appear in a shaded box and are called out with an icon.

Web Site

If you're still wondering where the accompanying CD is, you can stop looking-- there isn't one. Because this book is about Windows Internet development, I thought it would be more than appropriate to replace the standard accompanying CD with the Essential WinInet Web site. All sample programs found throughout the book can be downloaded from the Essential WinInet Web site. As bugs surface (as I'm sure they will), I'll post regular updates to the sample code. The Essential WinInet Web site may also serve as the central location for WinInet information. It not only contains links to other WinInet sites on the Web, but also contains an up-to-date list of recommended reading.



0201379368P04062001

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020