IPOutlookApp::Logon
A version of this page is also available for
4/8/2010
The Logon method begins a session with the Outlook Mobile COM server, returning a handle that can be used in subsequent calls to each PIM Item's Display method. You must begin an Outlook Mobile session before you can call any of the other POOM APIs.
Syntax
HRESULT Logon(
long hWnd
);
Parameters
hWnd
[in] Handle to the parent window for the POOM session. Outlook Mobile uses this handle for each PIM item's Display call, and for the infrared transfer dialog.For Visual Basic, this parameter is optional and has a Null default value.
Return Value
This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:
- S_FALSE
The user is already logged on.
- S_OK
The method completed successfully.
Code Example
The following code example shows how to log the user on to a POOM session.
Note
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
HRESULT hr;
IPOutlookApp * polApp;
// Initialize COM for Outlook Mobile.
if (FAILED(CoInitializeEx(NULL, 0))) return FALSE;
// Get a handle to the Outlook Mobile application object.
hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER, IID_IPOutlookApp, (LPVOID*)&polApp);
// Begin an Outlook Mobile session.
hr = polApp->Logon(NULL);
Remarks
LogOn must be called from a thread that will process Windows messages.
The Outlook Mobile application object is not built for thread safety. Do not access this object across multiple threads.
The parent window for the POOM session is the window that receives Outlook Mobile notification messages. For more information, see Notification Window Messages.
Messages broadcast using SendMessage might hang on the POOM application window. To be safe, use PostMessage instead.
Requirements
Header | pimstore.h |
Library | Pimstore.lib |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Pocket PC 2000 and later, Smartphone 2002 and later |
See Also
Tasks
Reference
IPOutlookApp
IPOutlookApp::Logoff
IItem::Edit
Pocket Outlook Object Model Interfaces