Code Example: Determining the Version

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

The following C++ code example demonstrates how to get the IPOutlookApp object, log onto Outlook Mobile, and then determine the version of Outlook Mobile that is running.

Note   In the code example, SysFreeString is called on the IPOutlookApp object. Because SysFreeString is not defined on Microsoft Palm-size PC 1.0, this is necessary for the code to compile for that OS. If you will not be compiling this code on that OS, you can go ahead and call SysFreeString directly.

HRESULT hr;

IPOutlookApp * polApp = NULL;
BSTR      pwszVersion = NULL;
    
// Initialize COM.
CoInitializeEx(NULL, 0);

// Create an instance of the main application object (IApplication).
hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER, IID_IPOutlookApp, (LPVOID*)&polApp);
    
// Log on to Outlook Mobile.
hr = polApp->Logon(NULL);

// Get the version, and display it in a message box.
polApp->get_Version(&pwszVersion);

MessageBox(NULL, pwszVersion, TEXT("POOM Version"), MB_SETFOREGROUND | MB_OK);

polApp->SysFreeString(pwszVersion);

// Log off and release the Application object.
polApp->Logoff();
polApp->Release();

return TRUE;

The following Visual Basic code example shows you how to determine the version of Outlook Mobile.

Dim polApp as PocketOutlook.Application

Set polApp = CreateObject("PocketOutlook.Application")

polApp.Logon()

MsgBox polApp.Version()

Community Additions

Show: