

Source Code - SKELETON.CPPThis page last updated on September 2, 1996.In the source below, all text in yellow is code supplied by the compiler. Do not change any of this unless you know what you are doing. All text in red is code that you must add.
A plain text version of this source is available as skeleton.cpp.
// skeleton.cpp : Defines the initialization routines for the DLL. // #include "stdafx.h" #include "skeleton.h" #include "httpext.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSkeletonApp BEGIN_MESSAGE_MAP(CSkeletonApp, CWinApp) //{{AFX_MSG_MAP(CSkeletonApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSkeletonApp construction CSkeletonApp::CSkeletonApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CSkeletonApp object CSkeletonApp theApp; ///////////////////////////////////////////////////////////////////////////// // Function prototypes for user defined functions void Output(EXTENSION_CONTROL_BLOCK *pEcb, LPSTR controlString, ...); void SendHTMLHeader(EXTENSION_CONTROL_BLOCK *pEcb); ///////////////////////////////////////////////////////////////////////////// // Manditory Exported Functions ///////////////////////////////////////////////////////////////////////////// // // GetExtensionVersion() // // This is the standard implementation of this function. Don't change any // thing except the description of the DLL ("Skeleton DLL") unless you know // what you're doing. // BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) { pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR); lstrcpyn(pVer->lpszExtensionDesc, "Skeleton DLL", HSE_MAX_EXT_DLL_NAME_LEN); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // // HttpExtensionProc() // // This is the 'main()' function for the DLL. // DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pEcb) { SendHTMLHeader(pEcb); Output(pEcb, "<html>"); Output(pEcb, "<head><title>Skeleton DLL</title></head>"); Output(pEcb, "<body bgcolor=#FFFFFF>This is a test, this is only a test.</body>"); Output(pEcb, "</html>"); return HSE_STATUS_SUCCESS; } ///////////////////////////////////////////////////////////////////////////// // // Output(pEcb, controlString, ...); // // This routine returns a formatted [a la printf(), sprintf()] string to // the web client, ie: // // Output(pEcb, "This is %s number %d.<p>", "test", 1); // // outputs to the client this string: // // This is test number 1.<p> // void Output(EXTENSION_CONTROL_BLOCK *pEcb, LPSTR controlString, ...) { char buffer[1024]; va_list argPtr; DWORD size; va_start(argPtr, controlString); vsprintf(buffer, controlString, argPtr); size = strlen(buffer); pEcb->WriteClient(pEcb->ConnID, buffer, &size, NULL); } /////////////////////////////////////////////////////////////////////////////////////////////// // // SendHTMLHeader() // // This routine sends a bare-bones header back to the client, telling it to expect an HTML // document. // void SendHTMLHeader(EXTENSION_CONTROL_BLOCK *pEcb) { char header[4096]; // output header strcpy(header, "Content-type: text/html\n\n"); pEcb->ServerSupportFunction(pEcb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER, NULL, 0, (DWORD *) header); }
© Copyright 1996 by Stephen Genusa. All Rights Reserved.
© Copyright 1996 by Jeff House. All Rights Reserved.