CeOpenDatabaseEx2 (CEDB) (Compact 2013)

3/26/2014

This function opens an existing database on any database volume, including mounted database volumes.

Syntax

HANDLE CeOpenDatabaseEx2( 
  PCEGUID pguid, 
  PCEOID poid,
  LPWSTR lpszName, 
  SORTORDERSPECEX* psort, 
  DWORD dwFlags,
  CENOTIFYREQUEST* pRequest
);

Parameters

  • pguid
    [in] Pointer to the CEGUID that contains the globally unique identifier of a mounted database volume, or of the object store. Use the CREATE_SYSTEMGUID macro to obtain the GUID of the object store. If this parameter points to a CEGUID created with the CREATE_INVALIDGUID macro, this parameter is ignored, and the object stores and all mounted database volumes are searched for a database whose name matches the lpszName parameter. The search is completed when the first match is located.
  • poid
    [in, out] Pointer to the object identifier of the database to be opened. To open a database by name, set the value pointed to by this parameter to zero, set lpszName to the database name, and set pceguidto the database volume.
  • lpszName
    [in] Long pointer to the null-terminated string that contains the name of the database to be opened. This is used along with pceguid to specify the database if the value pointed to by poid is set to zero. If the value pointed to by poid is set to nonzero, this parameter is ignored.
  • psort
    [in] Active sort order for the database. All subsequent calls to the CeSeekDatabaseEx (CEDB) function assume this sort order. This parameter can be set to NULL if the sort order is not important. In that case, a sort order is chosen for you.
  • dwFlags
    [in] Bitmask of action flags. The following table shows possible values.

    Value

    Description

    CEDB_AUTOINCREMENT

    Increments the current seek position with each call to the CeReadRecordPropsEx (CEDB) function.

    Zero

    Prevents the current seek position from being incremented with each call to CeReadRecordPropsEx. The seek position is changed only by calls to the CeSeekDatabaseEx (CEDB) function.

  • pRequest
    [in] Pointer to a CENOTIFYREQUEST [CEDB] structure that requests notifications be sent to an identified window. This parameter can be set to NULL if an application does not need to receive notifications.

    The sort pointer does not have to point to one of the sort structures used in the create call, but the propids have to match one of the database sorts.

Return Value

A handle to the open database indicates success. INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError. The following table shows possible values.

Value

Description

ERROR_FILE_NOT_FOUND

Indicates that no database exists with the specified name. This error code applies only if the value pointed to by poid was set to NULL when the function was called.

ERROR_INVALID_PARAMETER

Indicates that a parameter was invalid.

ERROR_NOT_ENOUGH_MEMORY

Indicates that there was not enough available memory to allocate the database handle.

Remarks

An application must use the CloseHandle function to close the handle returned by this function.

Changes to Windows Embedded Compact databases are committed after each individual call, not when opening and closing a database.

Requirements

Header

windbase.h

Library

coredll.lib

See Also

Reference

CEDB Functions
CeCreateDatabaseEx2 (CEDB)
CeReadRecordPropsEx (CEDB)
CeSeekDatabaseEx (CEDB)
CloseHandle
CREATE_INVALIDGUID
CENOTIFICATION[CEDB]