-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: vipul_vips
Message 1 in Discussion
HI all,
I am facing a problem in accessing a VC++ 6.0 ATL COM object via a .Net
application
The atl com dll is accessing another dll called OTAClient80.dll
The following piece of code has been written in ATL COM:
/* START OF CODE SNIPPET */
STDMETHODIMP TDDOORSApi::temp(int *count)
{
HRESULT hr = E_FAIL;
::CoInitialize(NULL);
ITDConnection *connect;
HRESULT hr = ::CoCreateInstance(__uuidof(TDConnection), NULL,
CLSCTX_INPROC_SERVER, __uuidof(ITDConnection), (LPVOID
*)&connect);
if (connect==NULL)
{
return hr;
}
connect->AddRef();
//OTAClient80.dll api
hr=connect->InitConnection("http://PC-P33774/TDBIN","","");//Making a
connection to the an application server
if (FAILED(hr))
return hr ;
//OTAClient80.dll api
hr = connect->ConnectProject("TestDirector_Demo","admin",""); //Making
a
connection to a project on the server
if (FAILED(hr))
return hr;
IRunFactory *runPointer = NULL;
IList *runFieldList = NULL;
//OTAClient80.dll api
hr = connectionPtr->get_RunFactory ((IDispatch**)&runPointer);
//This line gives an exception..
//OTAClient80.dll api
hr = runPointer->get_Fields(&runFieldList);
//Release the connection and dsiconnect from the project
connect->DisconnectProject();
connect->Release();
::CoUninitialize();
return hr;
}
/* END OF CODE SNIPPET */
When I try to invoke this code from a C# windows application or a console
application, the line
hr = runPointer->get_Fields(&runFieldList);
gives an exception as follows:
/* START OF EXCEPTION TEXT */
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80010105): The server threw
an exception.
at DOORSTDLib.TDDOORSApiClass.temp(Int32& count)
at WindowsApplicationTesting.Form1.button1_Click(Object sender, EventArgs
e) in c:\documents and settings\mahendsa\my documents\visual studio
projects\windowsapplicationtesting\windowsapplicationtesting\form1.cs:line
123
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
WindowsApplicationTesting
Assembly Version: 1.0.1662.29448
Win32 Version: 1.0.1662.29448
CodeBase:
file:///C:/Documents%20and%20Settings/mahendsa/My%20Documents/Visual%20Studi
o%20Projects/WindowsApplicationTesting/WindowsApplicationTesting/bin/Debug/W
indowsApplicationTesting.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e
089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/sy
stem.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system
xml.dll
----------------------------------------
Interop.DOORSTDLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///C:/Documents%20and%20Settings/mahendsa/My%20Documents/Visual%20Studi
o%20Projects/WindowsApplicationTesting/WindowsApplicationTesting/bin/Debug/I
nterop.DOORSTDLib.DLL
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
---------------------------------------------
/* END OF EXCEPTION TEXT */
Sometimes, I get the error as under:
/* START OF ERROR TEXT */
The value of ESP was not properly saved across function call. This is
usually a result of calling a function
declared with one calling convention with a function pointer declared with
a different calling convention.
/* END OF ERROR TEXT */
There are no errors if I invoke the dll from an MFC application.
The following is the code invoked from the C# application:
DOORSTDLib.TDDOORSApiClass obj = new TDDOORSApiClass();
obj.temp();
Can someone please throw some light as to where can the problem be / what is
the solution?
Regards
Vipul
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]