Implementation of POOM Using Embedded Visual C++ 3.0

Environment: EVC++3.0, WinCE, PocketPC SH3 or so

The contactMgt is the application which implements POOM and it has been successfully tested on SH3 processor and hope it will work fine on the rest of too. but before try to build it you need to register the DLL's on your Pocket PC, I choose regsvrce.exe(find out in Windows CE Tools folder ) for that. And you know which DLL you have to register (I don't want to repeat things again and again )

Once register DLL now its very easy

The parameter that is passed is the identifier for the folder that is to be retrieved.

Folder TypeValue
Calendar9
Contacts10
Tasks13
Cities101
Infrared102

If facing any problem in LINKING use Project->Settings->Link and add /force


//
// Include headers
// in stdafx.h
#include "initguid.h>"
#include "pimstore.h"
// Initialize 

CoInitializeEx(NULL, 0);

hr = CLSIDFromProgID(POA_OBJECT, &clsid);
if (FAILED(hr))
{
 AfxMessageBox(_T("Fail to load CLSID"));
}  
else
{
 hr = CoCreateInstance(clsid, 
                       NULL, 
                       CLSCTX_INPROC_SERVER, 
                       IID_IPOutlookApp, 
                       (LPVOID *) &(polApp));
 if (FAILED(hr))
 {
  err = GetLastError();
  sprintf(str,"Fail to load CoCreateInstance %d",err);
  AfxMessageBox((CString)str);
 } 
}


// ///////////in header file
IPOutlookApp    *polApp; // outlook app
IFolder *pFolder;
IPOutlookItemCollection *pContacts;

IPOlItems *pItem;
IContact *pContact;

HRESULT hr;
CLSID clsid;


///////////////And Implementation is here
BSTR pwszVersion = NULL;


CString firstname,lastname,fullname;
CListBox* List1=(CListBox *)GetDlgItem(IDC_LIST1);
List1->ResetContent();
int olFolderContacts = 10;


hr = polApp->Logon(NULL);
if (FAILED(hr))
{
 AfxMessageBox(_T("Fail to login"));
}
else
{
 polApp->get_Version(&pwszVersion);
 polApp->GetDefaultFolder(olFolderContacts, &pFolder);
 pFolder->get_Items(&pContacts);
 pContacts->QueryInterface(IID_IPOlItems, (LPVOID *) &pItem);

 int numItems,i;
 pItem->get_Count(&numItems);

 for (i = 1; i <= numItems; i++)
 {
  pItem->Item(i, (IDispatch **) &pContact);
  LPTSTR Fname,Lname;
  pContact->get_FirstName(&Fname);
  pContact->get_LastName(&Lname);
  firstname =(CString)Fname;
  lastname = (CString)Lname;
  fullname = firstname + " " + lastname;
  List1->AddString((CString)fullname);
 }
}
//

Downloads

Download source - 285 Kb
Download demo application - 5 Kb


Comments

  • linker error on CoInitializeEx(...)

    Posted by astaples on 05/13/2005 12:48pm

    I am having linker errors with CoInitializeEx(...) and CoCreateInstance(...) despite adding the "/force" option to my linker. If anyone knows the fix, I'd be very appreciative! -Alan astaples@diyprojectorcompany.com

    Reply
  • Which DLL

    Posted by WillSinger on 03/16/2005 01:00pm

    I realize I am late to the game here and maybe I missed a previous article, but what DLL is it that needs registered?

    Reply
  • DLL problem....

    Posted by Legacy on 01/28/2004 12:00am

    Originally posted by: Nitin Gahlaut

    Hi,

    I have seen your artical on "Codeguru.com" which is realted to WIN CE. So I have a query for you. I know my query is not related with ur code, but please help me, i m in trouble... actaully i could not get any help regarding that problem...

    Actually Nitin i m new in Win CE. Thats the prob....

    The problem is: I m trying to load some thride party DLL's for finger print verfication. But I when i load that DLL's on emulator through LoadLibrary(), then i got the error, i mean i always get the NULL, and in response error code sometimes "2", somethimes "126".
    But when i load some other system DLL's like "Aygshell.DLL" or "richink.DLL" etc. then it will work properly....

    One more important thing is there: only one dll which is realted to smart card is working but it is not working on emulator, it works properly only on Pocket PC. so why it not wroking on emulaotor...?


    So please tell me why i m not able to get the Handle of that DLL's. And please tell me from where i have to start to find out the solution.

    One more thing please tell me that before using that DLL, i have to register that DLL's or not. and if yes then how? Actually i also try to register that DLL's but could not able to register.


    Anyway,
    Please send the solution of my prob.... or please guid me.... please arreange few min. for writing the reply ..


    Waiting for ur resposne....

    Nitin Gahlaut
    nitin_gahlaut@yahoo.com

    Reply
  • Add Menu Item to Outlook

    Posted by Legacy on 01/14/2004 12:00am

    Originally posted by: Jason

    Is there a sample around that I can put into one of the VCE++ 3.0 or 4.0 compilers to show me how to do all this.

    I am a Delphi programmer, and don't really know how to do this, I'm having enough of a time getting around the Visual C interface let alone getting anything working.


    Can someone please help me?!

    Jason

    Reply
  • How to get notification on change in contacts?

    Posted by Legacy on 05/22/2003 12:00am

    Originally posted by: Boris

    Is there a property or signature that can be used to check if contacts collection has been changed? Is it possible to sing on notification on change?

    Thanks, Boris.

    Reply
  • I have a question,,,

    Posted by Legacy on 02/18/2003 12:00am

    Originally posted by: ilseop

    Hi,,
    I wanna sort the items.
    but it does not working.

    // incorrect working code
    polApp->GetDefaultFolder(olFolderContacts, &pFolder);
    pFolder->get_Items(&pContacts);
    pContacts->pSort( (BSTR)TEXT("[CompanyName]"), FALSE );
    //

    Please Help me!!

    Thanks!

    Reply
  • Modified Date/time of contact

    Posted by Legacy on 02/03/2003 12:00am

    Originally posted by: Rakesh

    I want to get Date/time when a contact is modified last time.

    Reply
  • It working OK ! :)

    Posted by Legacy on 10/10/2002 12:00am

    Originally posted by: ApolloVN

    Remember :
    
    - LINKING use Project->Settings->Link and add /force
    OK for PocketPC n PocketPC2002

    Reply
  • Problems with the code

    Posted by Legacy on 08/30/2002 12:00am

    Originally posted by: Brad Murdoch

    I downloaded the sources provided on the page and attempted to compile for my pocket pc. I get three errors

    --------------------Configuration: ContactMgt - Win32 (WCE ARM) Debug--------------------
    Compiling...
    StdAfx.cpp
    Compiling...
    AboutContact.cpp
    ContactMgt.cpp
    ContactMgtDlg.cpp
    Generating Code...
    Linking...
    StdAfx.obj : error LNK2005: IID_IPOutlookApp already defined in ContactMgtDlg.obj
    StdAfx.obj : error LNK2005: IID_IPOlItems already defined in ContactMgtDlg.obj
    ARMDbg/ContactMgt.exe : fatal error LNK1169: one or more multiply defined symbols found
    Error executing link.exe.

    ContactMgt.exe - 3 error(s), 0 warning(s)


    anyone know whats going on here????

    Reply
  • How to ascertain the last modify time of contact?

    Posted by Legacy on 02/04/2002 12:00am

    Originally posted by: David Liu

    As we know, there is a lastmodifytime propertiy at outlook object model on pc. But I can find the propertiy on pocket pc outlook object model. Is there a simple method to ascertain the last modify time of contact? If you know, please send me an email. Tsingslin@163.com
    Thanks a lot!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • A global data storage provider whose business is booming needed a best-in-class data center to serve as the backbone of its technical operations going forward—and it needed it delivered within a year.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds