Hi All,
I am trying to call COM Component in .NET using PInvoke.
In the following scenario, ( I am getting an exception called SEH -
External component has thrown an exception)
UnManaged Code
---------------
virtual HRESULT IDispatch::GetIDSOfNames(const IID & riid, LPWSTR *
rgizNames, UINT CNames, LCID lcid, DISPID *rgDispID)
Managed Code (I have rewritten)
------------
int GetIDsOfNames ([In] System.Guid guid, ref System.String[]
rgNames,[In] System.UInt32 cNames, [In] System.UInt32 lcid,
[Out] out long[] dispID);
Public Test()
{
AXIDispatch pIScriptDispatch;
String[] wszScriptFunctions = new String[1];
wszScriptFunctions[0] = "entryMethod";
long[] dispIDFunctions = new long[1];
pIScriptHost.GetScriptDispatch (out pIScriptDispatch);
IntPtr p = Marshal.GetIDispatchForObject(pIScriptHost);
IntPtr ppv;
Marshal.QueryInterface(p,ref diug,out ppv);
pIScriptDispatch = (AXUtil.AXIDispatch)Marshal.GetObjectForIUnknown(p pv);
try
{
pIScriptDispatch.GetIDsOfNames (guid,ref wszScriptFunctions, 1,
1033, out dispIDFunctions);
}
catch (Exception ex)
{
Console.WriteLine (ex.ToString ());
}
}
If I execute Test() I will be getting the following Exception for
Invoking "GetIDsOfNames(....)"
System.Runtime.InteropServices.SEHException: External component has
thrown an exception.
What could be the reason to get this kind exeception, I don't know
what to do in order to handle it error. Could anyone
kindly help me to solve ? I will greatly appreciate.
Thanks & Regards
R. Muthiah Samy 1 2554
Muthiah,
You should not have to call GetIdsOfNames. If you want to make late
bound calls, you should use reflection instead. What exactly are you trying
to do? Are you indeed trying to make late bound calls?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Muthiah Samy" <mu******@aztec.soft.net> wrote in message
news:4b**************************@posting.google.c om... Hi All,
I am trying to call COM Component in .NET using PInvoke.
In the following scenario, ( I am getting an exception called SEH - External component has thrown an exception)
UnManaged Code --------------- virtual HRESULT IDispatch::GetIDSOfNames(const IID & riid, LPWSTR * rgizNames, UINT CNames, LCID lcid, DISPID *rgDispID)
Managed Code (I have rewritten)
------------
int GetIDsOfNames ([In] System.Guid guid, ref System.String[] rgNames,[In] System.UInt32 cNames, [In] System.UInt32 lcid,
[Out] out long[] dispID);
Public Test() {
AXIDispatch pIScriptDispatch; String[] wszScriptFunctions = new String[1]; wszScriptFunctions[0] = "entryMethod"; long[] dispIDFunctions = new long[1];
pIScriptHost.GetScriptDispatch (out pIScriptDispatch); IntPtr p = Marshal.GetIDispatchForObject(pIScriptHost); IntPtr ppv; Marshal.QueryInterface(p,ref diug,out ppv); pIScriptDispatch = (AXUtil.AXIDispatch)Marshal.GetObjectForIUnknown(p pv);
try { pIScriptDispatch.GetIDsOfNames (guid,ref wszScriptFunctions, 1, 1033, out dispIDFunctions); } catch (Exception ex) { Console.WriteLine (ex.ToString ()); }
}
If I execute Test() I will be getting the following Exception for Invoking "GetIDsOfNames(....)"
System.Runtime.InteropServices.SEHException: External component has thrown an exception. What could be the reason to get this kind exeception, I don't know what to do in order to handle it error. Could anyone
kindly help me to solve ? I will greatly appreciate.
Thanks & Regards R. Muthiah Samy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Muthiah Samy |
last post by:
Hi All,
I am trying to call COM Component in .NET using PInvoke.
In the following scenario, ( I am getting an exception called SEH -
External component has thrown an exception)
UnManaged...
|
by: Miyra |
last post by:
Hi. I'm working with an app that uses exceptions for control flow.
These are code blocks where exceptions are thrown/caught regularly. A
couple hundred exceptions occur per hour and they're caught...
|
by: HairlipDog58 |
last post by:
I have a VC++6 project where I need to delay load a DLL. I used a structured
exception handling frame and all seems to work when I build the debug version
and run it (either in or out of the...
|
by: Don Lopez |
last post by:
I get this exception when I try to run open on the MySQLConnection
object. It goes like this:
System.TypeLoadException: Invalid PInvoke metadata format.
at...
|
by: IT |
last post by:
I want to fire off threads to start retrieving File from several locations.
FTP and the local network. Is it ok to start these threads on the main form
load.
Ex.
Every day we load EDI files...
|
by: Johnny |
last post by:
Hi guys,
I created a user-defined SEH by following Crash Course SEH article by Matt
Pietrek. When building the app in Debug mode, it has no problem catching
exception and entering the user...
|
by: yogeshnelwadkar |
last post by:
Hello, i have a problem with replacing c++ exception handling with
structured exception handling. How to replace the " catch(...) " in
c++ exception handling with, __except , a structured...
|
by: yewen |
last post by:
My C# client (.dotNet 2.0 and WSE 3.0) generated the following SOAP
message.
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope
...
|
by: =?Utf-8?B?UXVpbWJseQ==?= |
last post by:
We're the ReportViewer Control in a .NET 2.0 winforms app.
Here's the call I'm making:
byte reportBytes = this.reportViewerInstallRpt.LocalReport.Render("PDF",
null, out mimeType, out...
|
by: j4richard |
last post by:
Help please,
I am getting this "Unhandled Exception has occurred in your application"
" A Generic error occurred in GDI+"
See the end of this message for details on...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |