IOpenCmd::Initialize

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);
Parameters
bstrPageTitle - [in] Required _bstr_t, which specifies the label to display in the title bar of the Select Item (Open) JSP page when the Open command is invoked. By using this parameter, client applications can customize the title that appears at the top of the JSP page to correspond with their application requirements.
vMimeTypes - [in] Required pointer to a VARIANT, which specifies a SAFEARRAY of the possible MIME types for which to generate the list of openable items. When all MIME types are allowed, a value of VT_EMPTY should be specified.
Results
This method always returns an HRESULT value of S_OK if successful.
Sample
The following is a fragment from the complete example for the Open command.
   ...
   // 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);
...