Partager via


ICcConnection::ReceiveFile (Windows CE 5.0)

Send Feedback

This method copies a file from the device to the desktop.

HRESULT ReceiveFile(  LPCOLESTR in_szDeviceFile, LPCOLESTRin_szDesktopFile,FileActionDWORD dwCreationDispositionin_FileAction);

Parameters

  • in_szDeviceFile
    [in] The name of the file on the device.

    This parameter can also designate a CSIDL special directory. For more information, see Remarks.

  • in_szDesktopFile
    [in] The name of the file on the desktop.

    This parameter can also designate a CSIDL special directory. For more information, see Remarks.

  • dwCreationDispositionin_FileAction
    [in] Flag indicating the file creation copy action to take.

    The following table shows possible values for this flag.

    Flag value Description
    CREATE_ALWAYS Creates a file. If the file exists, the function:
    • Overwrites the file.
    • Clears the existing attributes.
    • Combines the specified file attributes and flags with FILE_ATTRIBUTE_ARCHIVE.
    • Does not set the security descriptor specified by the SECURITY_ATTRIBUTES structure.
    CREATE_NEW Creates a file.

    The function fails if the specified file exists.

    OPEN_ALWAYS Opens the file, if it exists.

    If the file does not exist, the function creates the file as if dwCreationDisposition were CREATE_NEW.

    OPEN_EXISTING Opens the file.

    The function fails if the file does not exist.

    For a discussion of why you should use OPEN_EXISTING for devices, see Remarks.

    TRUNCATE_EXISTING Opens the file and truncates it so that its size is zero bytes.

    The calling process must open the file with the GENERIC_WRITE access right.

    The function fails if the file does not exist.

Return Values

If the method fails, it returns an HRESULT error code.

If the method succeeds, it returns one of the following:

Value Description
S_OK Indicates the method call was successful.
E_INVALIDARG Indicates invalid arguments.
E_FAIL Indicates any other failure.

Remarks

This method calls CreateFile with the value of the dwCreationDisposition flag.

The caller can specify a CSIDL file path for in_szDesktopFile and in_szDeviceFile by**using a special string substitution format.

CSIDL values provide a unique system-independent way to identify these special folders. The values supersede the use of environment variables for this purpose.

The format of the substitution string is %CSIDL_<tag>%\mydirectory\myfile.ext, where CSIDL_<tag>``must be one of the following strings.

CSIDL_<tag> string Description
CSIDL_APPDATA File system directory that serves as a common repository for application-specific data.
CSIDL_COMMON_APPDATA File system directory containing application data for all users.

A typical path is C:\Documents and Settings\All Users\Application Data.

CSIDL_DESKTOPDIRECTORY Prior to Windows CE .NET 4.2, not supported.

In Windows CE .NET 4.2 and later, the file system path to the desktop directory.

CSIDL_FAVORITES File system directory that serves as a common repository for the user's favorite items.
CSIDL_FONTS Virtual folder containing fonts.
CSIDL_PERSONAL File system directory that serves as a common repository for documents.
CSIDL_PROFILE Folder that contains the profile of the user.
CSIDL_PROGRAM_FILES Program files folder.
CSIDL_PROGRAMS File system directory that contains the user's program groups, which are also file system directories.
CSIDL_STARTMENU File system directory that contains Start menu items.
CSIDL_STARTUP File system directory that corresponds to the user's Startup program group.

The system starts these programs when a device is turned on.

CSIDL_WINDOWS Windows folder.

Each of the CSIDL tags expands to the information provided by SHGetSpecialFolderPath.

That is, the following string

%CSIDL_WINDOWS%\myfile.txt 

expands to \WINDOWS\myfile.txt,

if SHGetSpecialFolderPath returns

\Windows

when passed CSIDL_WINDOWS.

The CSIDL_<tag> string must appear as the first element in the argument.

Requirements

OS Version: Windows 2000, Windows XP Home, Windows XP Pro, Windows Server 2003, and Windows Server 2003 Service Pack 1.
Header: CcConnection.h.
Link Library: none.

See Also

Core Connectivity Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.