Hi Folks,
I have an Outlook addin from which I'm trying to put localized text into the body of an appointment item. I have a string of localized text, it's cyrillic. I have my machines regional settings set to Russian. When I grab the string from my resource file and try to put it in the body, it comes up garbled, as if Outlook is displaying it in the wrong codepage. I'm sure the localized string is correct. Similar localized strings come up just fine when seen in the toolbar buttons of the addin. Additionally, we have another outlook addin that seems to be able to print localized strings in the body just fine. But for the life of me, I can't figure out the difference between what that addin is doing and what I'm trying to do. I know the old addin puts the body in the message upon pressing the "Send" button where mine does it upon initial open of the appointment item. I know that the old addin saves the appointment first (I've tried doing this to but it didnt help). And I know the old addin uses mapi to open the body property and uses mapi to read what's there before putting in the localized text. My addin doesn't have to do any of that, but I'm going to try doing some of that stuff to see if I can get the localized text to come up right. Does anyone else have any ideas. Can I manually set the codepage of the body somehow? It should already be set since I've switched the machines region to Russian, but who knows.
I'm doing the below upon opening the appointment item.
szInvitationMsg = new TCHAR [dwSize];
MyFormatMessage(_pModule->GetResourceInstance(), zInvitationMsg, dwSize, IDS_SCOPIA_INVITATION_MAIL, (LPTSTR)CW2T (bstrDesktopInvite), (LPTSTR)CW2T (bstrH323Invite),
(LPTSTR)CW2T (bstrPhoneInvite) )
m_pAppointment->put_Body(CComBSTR(szInvitationMsg));
--------------- cod of MyFormat Message()
DWORD MyFormatMessage(HINSTANCE hInst, LPTSTR szDest, DWORD nSize, UINT nFormatID, ...) { DWORD dwRes = 0; TCHAR *szFormatString = new TCHAR[nSize]; va_list argList; va_start(argList, nFormatID);
dwRes = ::LoadString(hInst, nFormatID, szFormatString, nSize); if (dwRes) { dwRes = ::FormatMessage(FORMAT_MESSAGE_FROM_STRING , szFormatString, 0, 0,(LPTSTR)szDest, nSize, &argList); ATLASSERT(dwRes > 0); DWORD dwErr = GetLastError(); dwErr = 0; } va_end(argList); delete szFormatString; return dwRes; }
|
|