PC Review


Reply
Thread Tools Rate Thread

AxHost.GetIPictureDispFromPicture causes Excel 2002 to crash

 
 
MTC75
Guest
Posts: n/a
 
      16th Jan 2009
I've created a C# object in a DLL that is loaded in the Excel process.
During the object's initialization, it creates new Excel toolbars and
attempts to place icons on the toolbar.

The code I'm using to get these icons is the following:

sealed private class ConvertImage : System.Windows.Forms.AxHost
{
private ConvertImage()
: base(null)
{
}

/// <summary>
/// Convert System.Drawing.Image to stdole.IPictureDisp.
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
public static stdole.IPictureDisp Convert
(System.Drawing.Image image)
{
return (stdole.IPictureDisp)System.
Windows.Forms.AxHost
.GetIPictureDispFromPicture(image);
}
}

Then a call is made:
IPictureDisp pic = ConvertImage.Convert(image);

However, if this code is executed on a machine with Office 2002, then upon
exiting Excel I get an error window ("An unexpected error has occurred" with
the checkbox to restart Excel). If I comment out the call to
GetIPictureDispFromPicture or if I run on a machine with Office 2003, there
is no problem.

Is there any way around this problem?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to easily crash Excel 2002. Jim Luedke Microsoft Excel Discussion 1 6th Sep 2009 10:55 PM
AxHost.GetIPictureDispFromPicture =?Utf-8?B?WWFlbA==?= Microsoft C# .NET 3 31st May 2007 02:29 PM
Excel 2002 File Save As Crash Grant Microsoft Excel Crashes 0 23rd Feb 2004 04:01 PM
Excel 2002 system crash JeffH Microsoft Excel Crashes 2 24th Oct 2003 09:59 PM
Excel 2002 Crash with Quartile Function Jason Microsoft Excel Crashes 1 21st Oct 2003 05:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:16 PM.