IPegasusFileFilterSite::OpenDestinationFile

The IPegasusFileFilterSite::OpenDestinationFile method is used by a file filter to open a destination file.

Syntax

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

At a Glance

Header file: Replfilt.h
Platforms: H/PC
Windows CE versions: 1.0 and later

Parameters

nHowToOpenFile
Specifies how the source file is to be opened. This can be one of the following values:
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
Name of the file to open to override the default destination file name. If this parameter is NULL, the default destination file name will be used.
ppObj
Address of an LPVOID variable that will receive an IStream pointer if nHowToOpenFile is PF_OPENFLAT, or an IStorage pointer if nHowToOpenFile is PF_OPENCOMPOUND. This object must be released using the IPegasusFileFilterSite::CloseDestinationFile method before returning to H/PC Explorer.

Return Values

NOERROR
OpenDestinationFile was successful.

If OpenDestinationFile fails, the return value is an HRESULT_FROM_WIN32 error value.

Remarks

The default destination file name and path are specified in the PFF_DESTINATIONFILE structure that is passed in to the call to IPegasusFileFilter::NextConvertFile. The default path is a temporary path managed by H/PC Explorer. For example, if the user drags a bitmap file named Tmp.bmp from the desktop PC to the H/PC, the default destination file name is Tmp.2bp.

When the file filter's IPegasusFileFilter::NextConvertFile method calls the IPegasusFileFilterSite::OpenDestinationFile method, the destination file can be modified, as shown in the following code fragment:

// Filter and copy Tmp.bmp on desktop to Tmp1.2bp on Windows CE device
PFF_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 = pffs->OpenDestinationFile(PF_OPENFLAT, szBuf, (LPVOID*)&pstmDst);

In this example, note that the path to the directory that contains 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), H/PC Explorer 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 PC, but the path can be modified as desired.

Note that OpenDestinationFile can be called only once within a given call to IPegasusFileFilter::NextConvertFile.

See Also

IPegasusFileFilterSite::CloseDestinationFile