The following example shows how to write HTML output to a Web page from inside a server component by using the Write method exposed by the IResponse interface.
STDMETHODIMP CHowtos1::OnStartPage (IUnknown* pUnk) { HRESULT hr; IScriptingContext *piContext; //Get IScriptingContext Interface hr = pUnk->QueryInterface(IID_IScriptingContext, (void**)&piContext); // Get Response Object Pointer IResponse* piResponse = NULL; hr = piContext->get_Response(&piResponse); //Build a String for Output VARIANT vtMessage; VariantInit(&vtMessage); V_VT(&vtMessage) = VT_BSTR; V_BSTR(&vtMessage) = SysAllocString(OLESTR("<CENTER><H1>Inside component!</H1></CENTER>")); //Write the String to the HTML Page piResponse->Write(vtMessage); //Release interfaces piResponse->Release(); piContext->Release(); }