The Initialize method customizes the Select Item (Open) Java™Server Pages (JSP) page in preparation for use by the Open operation, by allowing the client application to filter the list of openable items that are presented to the user (based on MIME type), and to specify the page title.
void spIOpenCmd->Initialize(_bstr_t bstrPageTitle, VARIANT vMimeTypes);
VT_EMPTY
should be specified.... // Instantiate the custom Open command component IOpenCmdPtr spIOpenCmd;
hResult = spIOpenCmd.CreateInstance(__uuidof(OpenCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the Open command component.\n"; _ASSERTE(0);
} // Create the list of allowable MIME types const DWORD cNumElements = 4; long lCount = 0; COleSafeArray saMIMETypes(VT_BSTR, cNumElements); {
long lIndex = 0;
_bstr_t bstrWordMimeType(_T("application/msword"));
saMIMETypes.PutElement(&lCount, bstrWordMimeType.copy()); lIndex++;
_bstr_t bstrExcelMimeType(_T("application/vnd.ms-excel"));
saMIMETypes.PutElement(&lCount, bstrExcelMimeType.copy()); lIndex++;
_bstr_t bstrPPTMimeType(_T("application/vnd.ms-powerpoint"));
saMIMETypes.PutElement(&lCount, bstrPPTMimeType.copy()); lIndex++;
_bstr_t bstrTextMimeType(_T("text/plain"));
saMIMETypes.PutElement(&lCount, bstrTextMimeType.copy());
} _variant_t vMIMETypes((LPCVARIANT) saMIMETypes); // Initialize the custom Open command component with the // page title and supported MIME types. _bstr_t bstrPageTitle = (_T("Customized Open Operation")); std::cout << "Initializing the Open command component..." << std::endl; spIOpenCmd->Initialize(bstrPageTitle, vMIMETypes); // Execute the Open command and capture the response component std::cout << "Executing the Open command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spIOpenCmd);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);...