pasteface method crashing outlook

  • Thread starter pasteface method crashing outlook
  • Start date
Status
Not open for further replies.
P

pasteface method crashing outlook

Hi,

I facing a problem while writing an Outllok addin in ATL COM. My Outlook

addin was throwing an Exception. Does

anyone has any idea why PasteFace() method is throwing an exception while

pasting a bitmap from clipboard on to the Button?

code:

hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),

MAKEINTRESOURCE(IDB_WORKSMARTBAR),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);

m_Clipboard.Backup();

::OpenClipboard(NULL);

::EmptyClipboard();

::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);

::CloseClipboard();

spWSOpenBtn->PutStyle(Office::msoButtonIconAndCaption);

hr = spWSOpenBtn->PasteFace();
 
K

Ken Slovak - [MVP - Outlook]

This group is for custom Outlook forms programming, BTW.

What are the specs of the bitmap you are putting on the clipboard? Is it a

16x16x156 color bitmap? If you are doing any masking or manipulation of the

bitmap are you putting it on the clipboard as a packed dib and not a dib

section?

"pasteface method crashing outlook" <pasteface method crashing

outlook> wrote in message

news:61E4F77B-AF05-44BE-A90D-7A2745D7E160@microsoft.com...
> Hi,
> I facing a problem while writing an Outllok addin in ATL COM. My Outlook
> addin was throwing an Exception. Does
> anyone has any idea why PasteFace() method is throwing an exception while
> pasting a bitmap from clipboard on to the Button?

> code:

> hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),
> MAKEINTRESOURCE(IDB_WORKSMARTBAR),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);

> m_Clipboard.Backup();

> ::OpenClipboard(NULL);
> ::EmptyClipboard();
> ::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
> ::CloseClipboard();

> spWSOpenBtn->PutStyle(Office::msoButtonIconAndCaption);

> hr = spWSOpenBtn->PasteFace();
>
 
P

pasteface method crashing outlook

Thanks for the reply.

I'm using 16X16X256 bitmaps. It's work fine in my development system but

crashes the outlook in one of the client system(Vista Business Edition).

Thanks

Kiran. S
wrote:


> This group is for custom Outlook forms programming, BTW.

> What are the specs of the bitmap you are putting on the clipboard? Is it a
> 16x16x156 color bitmap? If you are doing any masking or manipulation of the
> bitmap are you putting it on the clipboard as a packed dib and not a dib
> section?

> >

>

> "pasteface method crashing outlook" <pasteface method crashing
> outlook> wrote in message
> news:61E4F77B-AF05-44BE-A90D-7A2745D7E160@microsoft.com...
> > Hi,
> > I facing a problem while writing an Outllok addin in ATL COM. My Outlook
> > addin was throwing an Exception. Does
> > anyone has any idea why PasteFace() method is throwing an exception while
> > pasting a bitmap from clipboard on to the Button?
> > code:
> > hBmp =(HBITMAP)::LoadImage(_Module.GetResourceInstance(),
> > MAKEINTRESOURCE(IDB_WORKSMARTBAR),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
> > m_Clipboard.Backup();
> > ::OpenClipboard(NULL);
> > ::EmptyClipboard();
> > ::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
> > ::CloseClipboard();
> > spWSOpenBtn->PutStyle(Office::msoButtonIconAndCaption);
> > hr = spWSOpenBtn->PasteFace();
> >


>
 
K

Ken Slovak - [MVP - Outlook]

If it works OK on one machine and not another you need to see what's

different and/or missing on the other machine. Look for any missing

dependencies also.

"pasteface method crashing outlook"

<pastefacemethodcrashingoutlook> wrote in message

news:E1F05644-1A08-407E-BC71-F3798A1B88A5@microsoft.com...
> Thanks for the reply.

> I'm using 16X16X256 bitmaps. It's work fine in my development system but
> crashes the outlook in one of the client system(Vista Business Edition).

> Thanks
> Kiran. S
 
P

pasteface method crashing outlook

Ken

The OS version in which Outlook crashes on using Pasteface method is Vista

Business Edition. Do I need to add any additional Re-Distribution packages or

need to update .NET framework?

-Kiran
wrote:


> If it works OK on one machine and not another you need to see what's
> different and/or missing on the other machine. Look for any missing
> dependencies also.

> >

>

> "pasteface method crashing outlook"
> <pastefacemethodcrashingoutlook> wrote in message
> news:E1F05644-1A08-407E-BC71-F3798A1B88A5@microsoft.com...
> > Thanks for the reply.
> > I'm using 16X16X256 bitmaps. It's work fine in my development system but
> > crashes the outlook in one of the client system(Vista Business Edition).
> > Thanks
> > Kiran. S


>
 
K

Ken Slovak - [MVP - Outlook]

I've never had PasteFace problems on any Vista edition, and I don't deploy

anything differently for Vista than Windows XP or Windows 2000.

"pasteface method crashing outlook"

<pastefacemethodcrashingoutlook> wrote in message

news:B5489A02-A771-4BF3-BB8A-EE458EFBC973@microsoft.com...
> Ken

> The OS version in which Outlook crashes on using Pasteface method is Vista
> Business Edition. Do I need to add any additional Re-Distribution packages
> or
> need to update .NET framework?

> -Kiran
 
P

pasteface method crashing outlook

Thanks for the reply. Can you please go through the code below and let me

know if anything found wrong.

Code:

::NewInspector(IDispatch* pdispInspector)

{

try

{

CComQIPtr<Outlook::_Inspector> spInspector(pdispInspector);

ATLASSERT(spInspector);

CComQIPtr<Outlook::_AppointmentItem> spAppointmentItem;

spInspector->get_CurrentItem((IDispatch **)&spAppointmentItem);

ATLASSERT(spAppointmentItem);

OlObjectClass itemclass;

spAppointmentItem->get_Class(&itemclass);

m_spAppointmentItem = spAppointmentItem;

if (itemclass == olAppointment)

{

CWSNewInspectorEvents *newInspectorEvents = new

CWSNewInspectorEvents(this);

OutlookNewInspectotInfo *info = new OutlookNewInspectotInfo;

info->newInspectorEvents = newInspectorEvents;

info->m_spAppointmentItem = spAppointmentItem;

HRESULT hr;

hr = newInspectorEvents->CloseInspectEvents::DispEventAdvise((IDispatch*)

info->m_spAppointmentItem);

if( FAILED (hr))

return;

CComPtr < Office::_CommandBars> spCmdBars;

spInspector->get_CommandBars(&spCmdBars);

ATLASSERT(spCmdBars);

m_pCmdBars = spCmdBars;

// now we add a new toolband to Outlook

// to which we'll add 2 buttons

CComVariant vName("WorldSmart OutlookAddin");

CComPtr <Office::CommandBar> spNewCmdBar;

// position it below all toolbands

//MsoBarPosition::msoBarTop = 1

CComVariant vPos(1);

CComVariant vTemp(VARIANT_TRUE); // menu is temporary

CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);

//Add a new toolband through Add method

// vMenuTemp holds an unspecified parameter

//spNewCmdBar points to the newly created toolband

spNewCmdBar = spCmdBars->Add(vName, vPos, vEmpty, vTemp);

ATLASSERT(spNewCmdBar);

m_pCmdBar = spNewCmdBar;

//now get the toolband's CommandBarControls

CComPtr < Office::CommandBarControls> spBarControls;

spBarControls = spNewCmdBar->GetControls();

ATLASSERT(spBarControls);

//MsoControlType::msoControlButton = 1

CComVariant vButtonType(1);

CComVariant vPopupType(msoControlPopup);

//show the toolbar?

CComVariant vShow(VARIANT_TRUE);

//SmartMeetingURL

CComPtr < Office::CommandBarControl> spSmartMeetingURL;

spSmartMeetingURL = spBarControls->Add(vButtonType, vEmpty, vEmpty,

vEmpty, vShow);

ATLASSERT(spSmartMeetingURL);

CComQIPtr < Office::_CommandBarButton
spSmartMeetingURLBtn(spSmartMeetingURL);

ATLASSERT(spSmartMeetingURLBtn);

spSmartMeetingURLBtn->PutStyle(Office::msoButtonIconAndCaption);

HICON hIco =(HICON)::LoadImage(_Module.GetResourceInstance(),

MAKEINTRESOURCE(IDI_ICON_COPYURL),IMAGE_ICON,0,0,LR_LOADTRANSPARENT |

LR_LOADMAP3DCOLORS);

ICONINFO oIconInfo;

GetIconInfo(hIco, &oIconInfo);

m_Clipboard.Backup();

// put Icon into Clipboard

::OpenClipboard(NULL);

::EmptyClipboard();

::SetClipboardData(CF_BITMAP, oIconInfo.hbmColor);

::CloseClipboard();

::DeleteObject(hIco);

hr = spSmartMeetingURLBtn->PasteFace();

fprintf(fileptr,"[NewInspector]spSmartMeetingURLBtn->PasteFace()

success\r\n");

fflush(fileptr);

m_Clipboard.Restore();

if (FAILED(hr))

return;

spSmartMeetingURLBtn->PutVisible(VARIANT_TRUE);

spSmartMeetingURLBtn->PutCaption(OLESTR("Copy Conference Link"));

spSmartMeetingURLBtn->PutEnabled(VARIANT_TRUE);

spSmartMeetingURLBtn->PutTooltipText(OLESTR("Copy Conference Link"));

spSmartMeetingURLBtn->PutTag(OLESTR("CopyMeetingLink"));

spSmartMeetingURLBtn->PutVisible(VARIANT_TRUE);

//SmartMeetingStartup

CComPtr < Office::CommandBarControl> spSmartMeetingStartup;

spSmartMeetingStartup = spBarControls->Add(vButtonType, vEmpty, vEmpty,

vEmpty, vShow);

ATLASSERT(spSmartMeetingStartup);

CComQIPtr < Office::_CommandBarButton
spSmartMeetingStartupBtn(spSmartMeetingStartup);

ATLASSERT(spSmartMeetingStartupBtn);

HICON hIcon =(HICON)::LoadImage(_Module.GetResourceInstance(),

MAKEINTRESOURCE(IDI_ICON_METTING),IMAGE_ICON,0,0,LR_LOADTRANSPARENT |

LR_LOADMAP3DCOLORS);

ICONINFO IconInfo;

GetIconInfo(hIcon, &IconInfo);

spSmartMeetingStartupBtn->PutStyle(Office::msoButtonIconAndCaption);

m_Clipboard.Backup();

// put Icon into Clipboard

::OpenClipboard(NULL);

::EmptyClipboard();

::SetClipboardData(CF_BITMAP, IconInfo.hbmColor);

::CloseClipboard();

::DeleteObject(hIcon);

hr = spSmartMeetingStartupBtn->PasteFace();

fprintf(fileptr,"[NewInspector]spSmartMeetingStartupBtn->PasteFace()

success\r\n");

fflush(fileptr);

m_Clipboard.Restore();

if (FAILED(hr))

return;

spSmartMeetingStartupBtn->PutVisible(VARIANT_TRUE);

spSmartMeetingStartupBtn->PutCaption(OLESTR("Start Conference"));

spSmartMeetingStartupBtn->PutTooltipText(OLESTR("Start Conference"));

spSmartMeetingStartupBtn->PutTag(OLESTR("StartConference"));

spSmartMeetingStartupBtn->PutVisible(VARIANT_TRUE);

spSmartMeetingStartupBtn->PutEnabled(VARIANT_TRUE);

m_pSmartMeetingURLBtn = spSmartMeetingURLBtn;

info->m_pSmartMeetingURLBtn = m_pSmartMeetingURLBtn;

hr =

newInspectorEvents->CopyURLEvent::DispEventAdvise((IDispatch*)info->m_pSmartMeetingURLBtn);

if(FAILED(hr))

return;

m_pSmartMeetingStartupBtn = spSmartMeetingStartupBtn;

info->m_pSmartMeetingStartupBtn = m_pSmartMeetingStartupBtn;

hr =

newInspectorEvents->MeetingStartupEvent::DispEventAdvise((IDispatch*)info->m_pSmartMeetingStartupBtn);

if(FAILED(hr))

return;

m_VInspectorInfo->push_back(*info);

spNewCmdBar->PutVisible(VARIANT_TRUE);

fprintf(fileptr,"[NewInspector]Return Success\r\n");

fflush(fileptr);

}

else

{

}

}

catch(...)

{

DWORD dError = GetLastError();

fprintf(fileptr,"[NewInspector]Exception::%ld",dError);

fflush(fileptr);

}

}

In a new appointment page I'm trying to add a tool bar with two buttons.

-Kiran
wrote:


> I've never had PasteFace problems on any Vista edition, and I don't deploy
> anything differently for Vista than Windows XP or Windows 2000.

> >

>

> "pasteface method crashing outlook"
> <pastefacemethodcrashingoutlook> wrote in message
> news:B5489A02-A771-4BF3-BB8A-EE458EFBC973@microsoft.com...
> > Ken
> > The OS version in which Outlook crashes on using Pasteface method is Vista
> > Business Edition. Do I need to add any additional Re-Distribution packages
> > or
> > need to update .NET framework?
> > -Kiran


>
 
K

Ken Slovak - [MVP - Outlook]

I don't do C++ code so I won't even attempt to evaluate your code.

"pasteface method crashing outlook"

<pastefacemethodcrashingoutlook> wrote in message

news:F7D98248-62BB-4548-9110-9929C833D719@microsoft.com...
> Thanks for the reply. Can you please go through the code below and let me
> know if anything found wrong.


<snip
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 2
oliv- FASTEST METHOD TO ENUMERATE FOLDERS Outlook VBA and Custom Forms 3
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
Diane Poremsky My Speedy CPAO Modification Method Using Outlook 0
N Get the seconds with userproperties.add method VBA Outlook Outlook VBA and Custom Forms 4
S Best method to use Outlook Standalone with iPhone Using Outlook 13
G run-time 438: object doesn't support this property or method Using Outlook 2
A Need method to rapidly correct telephone contact telephone number formatting Using Outlook 1
C MailItem Find method doesn't work Using Outlook 0
S Looking for client-side method (Outlook 2007/Exchange 2007) for users to delete Outlook VBA and Custom Forms 2
S Restrict method question on email. What am I doing wrong? Outlook VBA and Custom Forms 2
S MailItem Find Method question Outlook VBA and Custom Forms 6
A SmallScroll Method Outlook VBA and Custom Forms 1
D Call add-in method from macro? Outlook VBA and Custom Forms 1
P Question on getExchangeUser method in Outlook Add-in Outlook VBA and Custom Forms 3
M Create email from Access on Outlook and make sure that email has beensent using WithEvents method Outlook VBA and Custom Forms 3
H Outlook 365 issue getting details from embedded files, crashing routine Outlook VBA and Custom Forms 0
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
B Outlook 213 keeps crashing. I just found out there are DMP files. How can I tell Why? Using Outlook 2
P Questions On Crashing, Sluggish, and Configurations Using Outlook 1
C Outlook (365) is crashing as soon as its opened Using Outlook 2
L Outlook Office 365 cached mode crashing Using Outlook 0
E Gmail crashing Outlook Using Outlook 2
C Outlook Crashing on Specific BCM Lead File BCM (Business Contact Manager) 2
J BCM Crashing with Add-in Enabled in User Mode BCM (Business Contact Manager) 2
F Difficult Oulook Crashing Problem Using Outlook 1
D outlook keeps crashing with cLucene error Using Outlook 2
J Checking PST File Keeps Crashing Using Outlook 2
U Need a help please Outlook 2007 crashing Using Outlook 2
P Was Helvetica crashing Outlook, now fix has messed up explorer Using Outlook 4
T Outlook 2010 Crashing Using Outlook 3
T BCM Crashing during search - 2007 edition BCM (Business Contact Manager) 3
Q Constant crashing BCM (Business Contact Manager) 2
B RE: Outlook 2007 - SMS Link (mobile text) crashing outlook Outlook VBA and Custom Forms 1
V Calendar Printing Assistant Crashing on Me Using Outlook 1

Similar threads

Top