#include <mtx.h> #import "c:\Winnt\system32\mts\mtxas.dll" #import "c:\Winnt\system32\inetsrv\asp.dll" |
MTxAS::ObjectContextPtr pObjectContext; HRESULT hr = GetObjectContext((IObjectContext**) &pObjectContext); |
//Session Object CComVariant v; CComBSTR bstr(L"Session"); CComQIPtr<IGetContextProperties, &__uuidof (IGetContextProperties)> pProps(pObjectContext); hr = pProps->GetProperty(bstr, &v); CComPtr<IDispatch> pDisp; pDisp = V_DISPATCH(&v); CComQIPtr<ASPTypeLibrary::ISessionObject, &__uuidof (ASPTypeLibrary::ISessionObject)> pSession(pDisp); |
//Response Object CComVariant v; CComBSTR bstr(L"Response"); CComQIPtr<IGetContextProperties, &__uuidof (IGetContextProperties)> pProps(pObjectContext); hr = pProps->GetProperty(bstr, &v); CComPtr<IDispatch> pDisp; pDisp = V_DISPATCH(&v); CComQIPtr<ASPTypeLibrary::IResponse, &__uuidof (ASPTypeLibrary::IResponse)> pResponse(pDisp); |
//Retrieve a value from the Session Object. CComBSTR bstrVarName(L"TestSessionVar"); VARIANT* pValue; pSession->get_Value(bstrVarName, pValue); //Write that value out to the browser. pResponse->Write(pValue); |