| | |
MAPI Unicode problem
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2005
Posts: 1
Reputation:
Solved Threads: 0
Hello,
i have problem with Mapi and unicode.
I'm workking under win XP, outlook 2000, visual studio c++ 6.0 and extended MAPI.
I'm trying get contacts (and information about contacts) from outlook.
Everything working when i'm not using Unicode. I get contacts, properties and so on. Problem
occurs, when i'm start doing the same in Unicode. Funny is, that functions did not return
error, everything looks fine, but the memory field with information is empty!!! Why?
Here is code:
<< moderator edit: added [code][/code] tags >>
Thanks a lot!!!
i have problem with Mapi and unicode.
I'm workking under win XP, outlook 2000, visual studio c++ 6.0 and extended MAPI.
I'm trying get contacts (and information about contacts) from outlook.
Everything working when i'm not using Unicode. I get contacts, properties and so on. Problem
occurs, when i'm start doing the same in Unicode. Funny is, that functions did not return
error, everything looks fine, but the memory field with information is empty!!! Why?
Here is code:
C++ Syntax (Toggle Plain Text)
#include "stdafx.h" #include <afxwin.h> #include <mapi.h> #include <mapix.h> #include <mapiutil.h> int main(int argc, char* argv[]) { HRESULT hr = S_OK; ULONG cbeid = 0L; LPENTRYID lpeid = NULL; LPSRowSet pRow; ULONG ulObjType; LPMAPITABLE lpContentsTable = NULL; LPABCONT lpGAL = NULL; LPADRBOOK m_pAddrBook = NULL; LPMAPISESSION pSession; SizedSPropTagArray ( 13, sptCols ) = { 13, PR_ENTRYID, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS, PR_ACCOUNT, PR_ASSISTANT, PR_ASSISTANT_TELEPHONE_NUMBER, PR_BUSINESS_FAX_NUMBER, PR_BUSINESS_TELEPHONE_NUMBER, PR_BUSINESS2_TELEPHONE_NUMBER, PR_CALLBACK_TELEPHONE_NUMBER, PR_CAR_TELEPHONE_NUMBER, PR_COMPANY_NAME, PR_COUNTRY }; hr = MAPIInitialize (NULL); hr = MAPILogonEx (NULL, NULL, NULL, MAPI_EXTENDED | MAPI_ALLOW_OTHERS | MAPI_NEW_SESSION | MAPI_LOGON_UI | MAPI_EXPLICIT_PROFILE | MAPI_UNICODE,&pSession); hr = pSession->OpenAddressBook(NULL,NULL,NULL,&m_pAddrBook); hr = m_pAddrBook->GetPAB(&cbeid,&lpeid); hr = m_pAddrBook->OpenEntry((ULONG) cbeid,(LPENTRYID) lpeid,NULL,MAPI_BEST_ACCESS,&ulObjType,(LPUNKNOWN *)&lpGAL); hr = lpGAL->GetContentsTable(0L, &lpContentsTable); hr = HrQueryAllRows (lpContentsTable,(SPropTagArray*) &sptCols, NULL, NULL, 0,&pRow); for(int x=0; x < (int) pRow->cRows ;x++) { wprintf(L"%ls\n", pRow->aRow[x].lpProps[1].Value.lpszW); wprintf(L"%ls\n", pRow->aRow[x].lpProps[2].Value.lpszW); wprintf(L"%ls\n", pRow->aRow[x].lpProps[3].Value.lpszW); wprintf(L"%ls\n", pRow->aRow[x].lpProps[4].Value.lpszW); wprintf(L"%ls\n", pRow->aRow[x].lpProps[5].Value.lpszW); } if ( NULL != lpGAL) { lpGAL -> Release ( ); lpGAL = NULL; } if ( lpContentsTable ) { lpContentsTable -> Release ( ); lpContentsTable = NULL; } m_pAddrBook->Release(); pSession->Release(); return true; }
Thanks a lot!!!
![]() |
Similar Threads
- VS compiler error??? (C++)
- internet explorer / virus problem here (Viruses, Spyware and other Nasties)
- bridge.dll problem (Viruses, Spyware and other Nasties)
- Same Bridge.dll problem :) (Viruses, Spyware and other Nasties)
- "About:blank" problem (Viruses, Spyware and other Nasties)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
Other Threads in the C++ Forum
- Previous Thread: Error compiling complex.cpp
- Next Thread: Linker Error>Undefined reference error to xyz
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int java lib library lines linkedlist linker loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return sort string strings struct studio system temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





