CeOpenDatabaseEx2

Windows CE .NET

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

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 CREATE_SYSTEMGUID to obtain the GUID of the object store. If pguid points to a CEGUID created with the CREATE_INVALIDGUID macro, then poid is ignored and the object store and all mounted database volumes are searched for a database whose name matches lpszName. 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 poid to 0, set lpszName to the database name, and set pceguid to 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 zero. If the value pointed to by poid is nonzero, lpszName is ignored.
psort
[in] Active sort order for the database. All subsequent calls to CeSeekDatabaseEx assume this sort order. This parameter can be NULL if the sort order is not important. In that case, a sort order will be chosen for you.
dwFlags
[in] Bitmask of action flags. The following table shows the possible values for this parameter.
Value Description
CEDB_AUTOINCREMENT Causes the current seek position to be automatically incremented with each call to CeReadRecordPropsEx.
0 Prevents the current seek position from being incremented with each call to CeReadRecordPropsEx. The seek position will only be changed by calls to CeSeekDatabaseEx.
pRequest
[in] Pointer to a CENOTIFYREQUEST structure that requests notifications be sent to an identified window. This parameter can be NULL if an application does not need to receive notifications.

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

Return Values

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

Value Description
ERROR_INVALID_PARAMETER Indicates that a parameter was invalid.
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_NOT_ENOUGH_MEMORY Indicates that no memory was available to allocate the database handle.

Remarks

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

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

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Windbase.h.
Link Library: Coredll.lib.

See Also

CeCreateDatabaseEx2 | CeReadRecordPropsEx | CeSeekDatabaseEx | CloseHandle | CREATE_INVALIDGUID | CENOTIFICATION


 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.

Show: