哪里有msdn中的有关isapi的例子?大虾帮忙!!!!!!!!!!52分全送了!!!!!

hpp_124 2001-08-02 01:38:38
在msdn中,它说有很多例子,并且也指出路径,但我找不到!
Location:
These projects are available in the ...\isapi\extensions\io subdirectory of the IIS samples directory.
大虾帮忙!!!!!!!!!!
...全文
104 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
bbasd88 2001-08-03
gz
回复
hpp_124 2001-08-02
up
回复
找不到不如去http://msdn.microsoft.com/找.
回复
hpp_124 2001-08-02
up
回复
hpp_124 2001-08-02
在MSDN盘CD1中的SAMPLE目录下 :
能否指清楚一点,我找遍了也找不到iis sample目录!!!!!!!
急死了!!!

回复
hpp_124 2001-08-02
在MSDN盘CD1中的SAMPLE目录下 :
能否指清楚一点,我找遍了也找不到iis sample目录!!!!!!!
急死了!!!
回复
fsb_12345 2001-08-02
在MSDN盘CD1中的SAMPLE目录下
回复
//--------------------------------------------------------------------
// Microsoft ADO
//
// (c) 1996 Microsoft Corporation. All Rights Reserved.
//
// @doc
//
// @module adoisapi.cpp | ADO ISAPI sample application
//
// @devnote None
//--------------------------------------------------------------------


#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")
#include <httpext.h>
#include <stdio.h>

VOID PatchQuery(char *szQuery, char **ppszPatchedQuery);
HRESULT FetchData(EXTENSION_CONTROL_BLOCK *pECB);
VOID OutputErrors(EXTENSION_CONTROL_BLOCK *pECB, HRESULT hrError);
VOID OutputString(EXTENSION_CONTROL_BLOCK *pECB, LPCSTR szBuffer);

const PCSTR g_pszConnection = "dsn=OLE_DB_NWind_Jet;uid=Admin;pwd=;";

BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
{
pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR, HSE_VERSION_MAJOR );

lstrcpynA( pVer->lpszExtensionDesc, "Sample ADO ISAPI Application", HSE_MAX_EXT_DLL_NAME_LEN );

return TRUE;
}

DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB )
{
DWORD dwWritten;
char szContent[] = "Content-type: text/html\r\n\r\n";

dwWritten = sizeof(szContent);
pECB->ServerSupportFunction (pECB->ConnID,
HSE_REQ_SEND_RESPONSE_HEADER,
NULL,
&dwWritten,
(LPDWORD)szContent);

if (FAILED(FetchData(pECB)))
return HSE_STATUS_ERROR;
else
return HSE_STATUS_SUCCESS;
}

char ConvertHexToDec(char cHex)
{
if ((toupper(cHex) >= 'A') && (toupper(cHex) <= 'F'))
return cHex - 'A' + 10;
else
return cHex - '0';
}

// Hack to clean up the query string. This code will work
// for most, but not all cases. For instance when the query
// string has embedded '+', this code will not work.
VOID PatchQuery(char *szQuery, char **ppszPatchedQuery)
{
char *p = szQuery + 1;

while (*p++)
{
if (*p == '+') //replace '+' by ' '
*p = ' ';

if (*p == '%') //a number begins
{
char ch;

if (*++p)
{
ch = ConvertHexToDec(*p) << 4; //convert the first digit

if (*++p)
{
ch |= ConvertHexToDec(*p); //convert the 2nd digit

if (!*(p + 1))
{
*(p-2) = ch;
*(p-1) = '\0';
break;
}
else
{
*(p-2) = ' ';
*(p-1) = ' ';
*p = ch;
}
}
}
}
}

*ppszPatchedQuery = szQuery + 1;
return;
}

VOID OutputString(EXTENSION_CONTROL_BLOCK *pECB, LPCSTR szBuffer)
{
DWORD dwBuffer = strlen(szBuffer);
pECB->WriteClient(pECB->ConnID, (PVOID) szBuffer, &dwBuffer, 0);
}

VOID OutputErrors(EXTENSION_CONTROL_BLOCK *pECB, _com_error &e)
{
char szBuffer[512];

// output hresult
OutputString(pECB, "<P><H1>Error Fetching Data</H1>");

sprintf(szBuffer, "<p>Code = %08lx", e.Error());
OutputString(pECB, szBuffer);

sprintf(szBuffer, "<p>Code meaning = %s", e.ErrorMessage());
OutputString(pECB, szBuffer);

_bstr_t bstrSource(e.Source());
sprintf(szBuffer, "<p>Source = %s", (LPCSTR) bstrSource);
OutputString(pECB, szBuffer);

_bstr_t bstrDescription(e.Description());
sprintf(szBuffer, "<p>Description = %s", (LPCSTR) bstrDescription);
OutputString(pECB, szBuffer);

return;
}

HRESULT FetchData(EXTENSION_CONTROL_BLOCK *pECB)
{
HRESULT hr = NOERROR;
bool fComInitialized = false;
_RecordsetPtr pRs = NULL;
FieldPtr *rgflds = NULL;
long lNumFields, lFld;
char *pszPatchedQuery;
_variant_t vValue;

OutputString(pECB, "<HEAD><TITLE>Query Results"
"</TITLE></HEAD>\r\n<BODY>\r\n");

PatchQuery(pECB->lpszQueryString, &pszPatchedQuery);

OutputString(pECB, "<P><H1>Query String</H1>");
OutputString(pECB, pszPatchedQuery);

try
{
if (FAILED(hr = ::CoInitialize(NULL)))
_com_issue_error(hr);

fComInitialized = true;

// Open the recordset
pRs.CreateInstance("ADODB.Recordset.1.5");
pRs->Open(pszPatchedQuery, g_pszConnection, adOpenForwardOnly, adLockReadOnly, adCmdUnknown);

lNumFields = pRs->Fields->Count;

rgflds = new FieldPtr[lNumFields];
if (!rgflds)
_com_issue_error(E_OUTOFMEMORY);
memset(rgflds, 0, lNumFields * sizeof(FieldPtr));

for (lFld = 0; lFld < lNumFields; lFld++)
rgflds[lFld] = pRs->Fields->GetItem(lFld);

OutputString(pECB, "<P><H1>Query Results</H1>");
OutputString(pECB, "<P><TABLE BORDER=1 CELLSPACING=4>");

//
// print column names
//
OutputString(pECB, "<TR>");

for (lFld = 0; lFld < lNumFields; lFld++)
{
OutputString(pECB, "<TH>");
OutputString(pECB, (PCSTR)(_bstr_t)rgflds[lFld]->Name);
}

//
// print data
//
while (VARIANT_FALSE == pRs->EndOfFile)
{
OutputString(pECB, "<TR>");

for (lFld = 0; lFld < lNumFields; lFld++)
{
OutputString(pECB, "<TD>");

vValue = rgflds[lFld]->Value;
if (VT_NULL == vValue.vt)
OutputString(pECB, "(Null)");
else
OutputString(pECB, (PCSTR)(_bstr_t)vValue);
}

OutputString(pECB, "</TR>");

pRs->MoveNext();
}

OutputString(pECB, "</TABLE>");
OutputString(pECB, "</BODY>\r\n");
}
catch (_com_error &e)
{
OutputErrors(pECB, e);
hr = e.Error();
}

if (rgflds)
delete[] rgflds;

pRs = NULL;

if (fComInitialized)
::CoUninitialize();

OutputString(pECB, "</BODY>\r\n");

return hr;
}
回复
newsoftman 2001-08-02
在msdnz中查找
回复
相关推荐
发帖
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
帖子事件
创建了帖子
2001-08-02 01:38
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……