Send Feedback

The Logon method logs on the user to a POOM Session. It must be the first method called for a POOM object.


  long hWnd


  • 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 Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

    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.

IPOutlookApp * polApp;

// Initialize COM for Pocket Outlook.
if (FAILED(CoInitializeEx(NULL, 0))) return FALSE;

// Get the application object.
hr = CoCreateInstance(CLSID_Application, 
if (FAILED(hr)) return FALSE;

// Log on to Pocket Outlook.
hr = polApp->Logon(NULL);
if (FAILED(hr))
    return FALSE;


LogOn must be called from a thread that will process Windows messages.

Messages broadcast using SendMessage might hang on the POOM application window. To be safe, use PostMessage instead.

The parent window for the POOM session is the window that recieves Outlook Mobile notification messages. For more information, see Notification Window Messages.


Pocket PC: Pocket PC 2000 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: pimstore.h
Library: pimstore.lib

See Also

How to: Establish a POOM Session | IPOutlookApp | IPOutlookApp::Logoff | Pocket Outlook Object Model API Interfaces | Pocket Outlook Object Model API Enumerations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.