当前位置: 代码迷 >> Windows Mobile >> [高分]window mobile5 中操作通讯录,该如何解决
  详细解决方案

[高分]window mobile5 中操作通讯录,该如何解决

热度:191   发布时间:2016-04-25 07:58:59.0
[高分]window mobile5 中操作通讯录
用vs2005(C++)写一个程序,在mobile5中能把数据按通讯录的格式导入数据到通讯录里。
请教各位大虾,如何实现,有哪些函数或方法


------解决方案--------------------
你的代码里面“polApp”是个空值,怎么可能继续走下去呢?你可以用下面的代码初始化
BOOL InitPoom(HWND hwnd)
{
BOOL bSuccess = FALSE;

if (SUCCEEDED(CoInitializeEx( NULL, 0)))
{
// Now, let 's get the main outlook application
if (SUCCEEDED(CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER,
IID_IPOutlookApp, reinterpret_cast <void **> (&g_polApp))))
{

// login to the Pocket Outlook object model
if(SUCCEEDED(g_polApp-> Logon(NULL)))
{
// can 't login to the app
bSuccess = TRUE;
}
}

}

return bSuccess;
}

------解决方案--------------------
D:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32

其实在你WM5.0的目录下有很多例子可以参考,poom的操作你可以参考Poommaster里的Poomdata.cpp
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
// ************************************************************
// POOMDATA.CPP
//
// Implementation of generic POOM data access functions
//

// Includes
#include "PoomMaster.h "

// Globals
IPOutlookApp * g_polApp = NULL;


// **************************************************************************
// Function Name: InitPoom
//
// Purpose: Creates and logs on to the POOM application object
//
// Arguments:
// none
//
// Return Values:
// BOOL
// returns TRUE if POOM was initialized, FALSE otherwise
//
// Description:
// This function creates the POOM application COM object and starts a POOM
// session via Logon. This must be done before any subsequent POOM calls are
// made.
BOOL InitPoom(HWND hwnd)
{

;
BOOL bSuccess = FALSE;

if (SUCCEEDED(CoInitializeEx( NULL, 0)))
{
// Now, let 's get the main outlook application
if (SUCCEEDED(CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER,
IID_IPOutlookApp, reinterpret_cast <void **> (&g_polApp))))
{

// login to the Pocket Outlook object model
if(SUCCEEDED(g_polApp-> Logon(NULL)))
{
// can 't login to the app
bSuccess = TRUE;
}
}

}

return bSuccess;
}

// **************************************************************************
// Function Name: GetPoomFolder
//
// Purpose: Gets the default folder for the specified POOM item type
//
// Arguments:
// IN int nFolder - POOM folder type to return, olFolderTasks,
// olFolderContacts, or olFolderCalendar in this app
// OUT IFolder ** ppFolder - pointer to IFolder interface returned.
// Must be released by caller of GetPoomFolder
//
// Return Values:
// BOOL
// returns TRUE if the folder interface was retrieved, FALSE otherwise
//
// Description:
// This function simply encapsulates a call on the global Outlook app interface. The
// returned pointer is simply passed through this function.
  相关解决方案