01-07-2009 07:48 AM - edited 03-13-2019 05:58 PM
Hi everybody.
I have been reviewing the examples in the XML IP Phone Services SDK 4.1.1.
I tried to make a C# class from the "logo.asp" example just to have a component to convert JPG/GIF files to Cisco IP Phone (CIP) data in order to display the picture in the Cisco IP Phones. The client code of this C# class (BOCipImage.cs) is as follows:
public static void Main(String[] args)
{
BOCipImage cip = new BOCipImage(@"C:\DELL\", "Default.jpg");
Console.WriteLine(cip.ConvertPicture());
}
I know the SDK contains a COM Server called: "cipimage.dll" which I registered successfully in my system (WinXP Pro) using the command:
regsvr32 cipimage.dll
The trouble? I'm getting this exception:
System.BadImageFormatException was unhandled
Message="Invalid access to memory location. (Exception from HRESULT: 0x800703E6)"
Source="Interop.CIPIMAGE"
StackTrace:
at CIPIMAGE.ImageProcessorClass.SaveCIPDataToBuffer()
at Common.Business.BOCipImage.ConvertPicture() in BOCipImage.cs:line 139
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Do I need to make "something extra" within Visual Studio 2005 in order to invoke properly the "cipimage.dll's" methods. I've got it correctly referenced at my VS2005 Console Project and it compiles successfullly but at runtime it failS.
What is interesting it's that trying the same JPG/GIF file with the "logo.asp" script, it works perfectly...
Any ideas? Thanks in advance.
01-07-2009 09:47 AM
OK!
I made a very dumb mistake...
Method "CalculateAspectRatio" was not correctly implemented...width/height was being calculated at 0 which fairly explains the "System.BadImageFormatException".
Also, I corrected the "IsFileExtensionValid" method which had a minor bug.
I post the corrected version of the BOCipIMage.cs component.
Thanks.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: