|
Hi,
I have a .Net application set up for COM/COM+. This component has a function that returns an array of a specific type/object. I use a VB6 application to call the function. The function works a supposed when the .net component is only installed in COM (regasm/gacutil), but when I setup and install the application for COM+ (regsvcs/gacutil), the VB6 test application crashes when I try to read data from the object/type in the array (e.g temp_str = myObjArr(0).myStr). I can read the size of the array using UBound without any problems, tough.
The error I get is the standard windows error "Visual Basic has encountered a problem and needs to close. We are sorry for the inconvenience."
Is there a known issue with passing array of objects from .net to vb6?
Thanks in advance!
BR
Øivind
|
|
|
|
|
Previously someone here asked about the following:
why the Exception Retrieving the COM class factory for component with CLSID failed due to the following error: 80004005. occurs how to resolve this.
The response was to look at the constructor of the COM object if posible, however I do not have access to the code. Other people have no problem reading this COM, could I be having a problem because my OS and IDE are both 64 bit and I am trying to read a VB6 COM object. How can I get around this problem if it is because of the 64 bit, if not what else is the possibility. What are my options, can I change a Library into 32 bit (I am using VS2005 Pro 64), build a Dll and hook into it. What would be the best way to approach this whether it is the problem I mentioned or otherwise.
Thanks in advance,
Michael
|
|
|
|
|
MAW30 wrote: Previously someone here asked about the following:
why the Exception Retrieving the COM class factory for component with CLSID failed due to the following error: 80004005. occurs how to resolve this.
The response was to look at the constructor of the COM object if posible
I mentioned about looking into COM coclass constructor because -
Few months back, the application I was once working on, was calling a COM object created in VB6. Now although the component was registered I got a standard COM error, if I am not wrong it was "Class not registered" error.
After a lot of digging in, I looked at VB6 code and found out that the constructor was raising an exception but somewhere in the process this error was mapped to "Class not registered". The reason for raising an exception was that some environment variable was not set.
MAW30 wrote: Other people have no problem reading this COM, could I be having a problem because my OS and IDE are both 64 bit and I am trying to read a VB6 COM object.
Likely, I do not have 64-bit PC with me at the moment so can't tell you exact results. VB6 COM component being 32 bit is likely to be the cause. It will help if you can have 64 bit version of same component. How do you run your application - from commandline or explorer? I have seen some VBScripts failing because wrong version of CScript.exe was executed because of the flavor (32 bit / 64 bit) of command prompt.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
This was my exact message below:
Retrieving the COM class factory for component with CLSID {31C0BC9B-2250-4964-A582-BA03058BAC93} failed due to the following error: 80040154.
Though when I look in the registry it is there.
I do not have access to the code nor will I be able to get the COM in a 64 bit version. What do you suggest I do. Is it possible to setup a Library as 32 bit where the rest of the solution is in 64 bit.
Thanks,
Michael
-- modified at 2:36 Tuesday 24th July, 2007
|
|
|
|
|
MAW30 wrote: Retrieving the COM class factory for component with CLSID {31C0BC9B-2250-4964-A582-BA03058BAC93} failed due to the following error: 80040154.
Though when I look in the registry it is there.
HRESULT 80040154 = REGDB_E_CLASSNOTREG - is what I was talking about
MAW30 wrote: I do not have access to the code nor will I be able to get the COM in a 64 bit version. What do you suggest I do. Is it possible to setup a Library as 32 bit where the rest of the solution is in 64 bit.
I would suggest, make a sample application to use your COM component. This application must be 32-bit. Test.
Also, as I mentioned earlier, does your component require you to do some initial setup in registry etc? If yes, then check wether you have everything in place. You could monitor registry using Sysinternals RegMon tool[^].
If I were you, I would first try compiling my application as 32-bit and use the COM component. This will help identify whether the problem is because of 32bit 64bit portability.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Error code 80004005 is the generic COM error code E_FAIL . Most likely the class is registered properly, but the DLL's DllGetClassObject function returned E_FAIL .
|
|
|
|
|
The following is the results I get from a test I ran for RegMon, therefore it does not see the class as being registered at all.
This is the Regitry Monitor result (RegMon reported it NOT FOUND 3x before I received the error message)
72.23125458 MBTest.vshost.e:2632 OpenKey HKCR\CLSID\{31C0BC9B-2250-4964-A582-BA03058BAC93} NOT FOUND
This is the Registry entry under Software
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31C0BC9B-2250-4964-A582-BA03058BAC93}
I also tried Late Binding and it said the file was not found.
I will work on a 32 bit program and see if that works.
Michael
|
|
|
|
|
I resolved this problem by setting the Platform from Any CPU to x86.
Thanks for the help,
Michael
|
|
|
|
|
MAW30 wrote: Platform from Any CPU to x86
That's what I meant when I said 32-bit version of your application.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I'm sure this is really basic, but if I create a Document using a COleDispatchDriver-derived interface, how can I keep that Document open after the program that created it closes?
|
|
|
|
|
I am not too sure about this, but you can implement a solution using an extra AddRef-Release from withing Document
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
It depends on the Application you are automating.
For example automating Word you just call word_application.SetVisible(TRUE) but for Excel you should call excel_application.SetVisible(TRUE) followed by excel_application.SetUserControl(TRUE) and of course dont call Close() on the document.
|
|
|
|
|
I have a COM component. I want to access the component through a HTML file. I'm trying to create COM object using Java Script. Can anyone tell me how to do this?
Thanks,
Priya
|
|
|
|
|
|
Thanks Sohail.But still i'm able to access a function within the script. To access a component method i need to create a com object in the script. How should i go about creating a COM object?
|
|
|
|
|
The link I provided has a sample JavaScript code to create XMLHttp object and call its methods.
Following is the syntax of creating XMLHttp object
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
where "Microsoft.XMLHTTP" is the version independent ProgId of XMLHttp COM Component.
In your case, replace "Microsoft.XMLHTTP" with your components ProgId.
The above said, is example of creating COM objects in IE. For Mozilla refer the same link and the example.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Ya I have tried doing this, but when I create an ActiveXObject it throws an error which says "Automation server can't create object", when I searched through the net I got to know enabling "Initialize and script activeX controls not marked as safe" in IE solves this error. But after enabling this I'm getting a Undefined error. This made me think there should be some other way of creating my com object. When I try creating a wscript.shell object it works fine. I get a problem only when i try creating my COM object.
Priya
|
|
|
|
|
PriyaJ.2206 wrote: "Initialize and script activeX controls not marked as safe" in IE solves this error
Yes, I read about this.
PriyaJ.2206 wrote: But after enabling this I'm getting a Undefined error.
What is the error number and description? Do you get undefined error when creating object or calling its method?
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Its IE script error dialog, it shows line number, code no. as 0, error as "Unspecified error". The line number which is shows in the line at which object is created ie. var obj = new ActiveXObject("MyComponent.MyComponentObj").
Error occurs at creating object line.
Priya
|
|
|
|
|
What version of IE are you using?
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
|
Does the following sample work in your browser (It works fine on my IE6 browser)
<html><br />
<head><br />
<script type="text/javascript"><br />
var xmlhttp;<br />
<br />
function testXMLHttp()<br />
{<br />
xmlhttp=null<br />
if (window.XMLHttpRequest)<br />
{<br />
xmlhttp=new XMLHttpRequest()<br />
}<br />
else if (window.ActiveXObject)<br />
{<br />
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")<br />
}<br />
if (xmlhttp!=null)<br />
{<br />
alert("Your browser does support XMLHTTP.")<br />
}<br />
else<br />
{<br />
alert("Your browser does not support XMLHTTP.")<br />
}<br />
}<br />
</script><br />
</head><br />
<body onload="testXMLHttp()"><br />
<br />
</body><br />
</html>
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Thanks Sohail,
Actually when i was trying to fix it up, I came to know that the problem is only when accessing my component. I tried creating another simple component and accessed it by creating object through ActiveXObject, it works fine.
I'm creating a CAxWindow object and embedding the html content into a toolbar using CAxWindow's create control method. Now I doubt whether creating a CAxWindow causes the actual problem.
Priya
|
|
|
|
|
PriyaJ.2206 wrote: Actually when i was trying to fix it up, I came to know that the problem is only when accessing my component. I tried creating another simple component and accessed it by creating object through ActiveXObject, it works fine.
Good.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi,
I'm trying to get a c# server component to pass a user defined type array to a VB6 client component through COM+. Is this possible with early binding?
I have created a c# component that works fine in COM (it passes bool, int etc). But when I try to pass a user defined type array, the array received in VB6 is empty (0 items), even tough I force the c# component to return at least one item in the array.
Heres my code:
C# function:
public MyType[] MyTypes()
{
MyType[] mt = {new MyType()};
return mt;
}
VB6 call:
Dim tool as MySpace.Tools
Dim retVal() as MySpace.MyType
Set tool = new MySpace.Tools
retVal = tool.MyTypes
Output UBound retVal gives 0 items.
Can't I pass arrays like this between C# and VB6 in COM+?
What is the solution to my problem?
Thanks in advance!
BR
Øivind
|
|
|
|