ICeFileFilterSite::OpenDestinationFile

This method is called by a file filter to open a destination file.

At a Glance

Header file: Replfilt.h
Windows CE versions: 2.0 and later

Syntax

STDMETHODIMP ICeFileFilterSite::OpenDestinationFile(
int
nHowToOpenFile, LPCSTR pszFullpath, LPVOID *ppObj );

Parameters

nHowToOpenFile

Specifies how the source file is to be opened. It is one of the following values:

Value Description
PF_OPENFLAT Open as a flat file.
PF_OPENCOMPOUND Open as an OLE compound file. Note that Windows CE does not support compound files.

pszFullpath

Pointer to the null-terminated string that contains the name of the file to open to override the default destination file name. If this parameter is NULL, the default destination file name is used.

ppObj

Pointer to an LPVOID variable that receives an IStream pointer if nHowToOpenFile is PF_OPENFLAT, or an IStorage pointer if nHowToOpenFile is PF_OPENCOMPOUND. This object must be released using the ICeFileFilterSite::CloseDestinationFile method before returning to H/PC Explorer.

Return Values

NOERROR indicates success. An HRESULT_FROM_WIN32 error value indicates failure.

Remarks

The default destination file name and path are specified in the CFF_DESTINATIONFILE structure is passed in to the call to ICeFileFilter::NextConvertFile. The default path is temporary and is managed by Windows CE Services. For example, if the user drags a bitmap file named Tmp.bmp from the desktop computer to the mobile device, the default destination file name is Tmp.2bp.

The following code example shows how the destination file can be modified when the file filter’s ICeFileFilter::NextConvertFile method calls the ICeFileFilterSite::OpenDestinationFile method.

// Filter and copy Tmp.bmp on desktop computer to Tmp1.2bp on Windows CE-based device
CFF_DESTINATIONFILE *pdf;
IStream *pstmDst; // Open the destination file as a stream
TCHAR szBuf[80];

lstrcpy(szBuf, pdf->szPath); // Use default path …
lstrcat(szBuf, TEXT("TMP1.2bp") ); // … but Modify the file name

hres = cffs->OpenDestinationFile(PF_OPENFLAT, szBuf, (LPVOID*)&pstmDst);

In this example, note that the path to the directory containing the temporary destination was preserved. The reason is that, after the file filter conversion is complete—that is, NextConvertFile has returned ERROR_NO_MORE_ITEMS—Windows CE Services looks in szPath and copies all files, regardless of file or extension name, to the target folder, as directed by the user.

The temporary destination file path must be located on the desktop computer, but the path can be modified as desired.

Note that OpenDestinationFile can be called only once within a specified call to ICeFileFilter::NextConvertFile.

See Also

ICeFileFilterSite::CloseDestinationFile