Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 6 Jahren, 12 Monaten
Letzter Beitrag:
vor 6 Jahren, 12 Monaten
Beteiligte Autoren:
windevn00b

WinDev .NET Assembly accessible via COM

Startbeitrag von windevn00b am 25.07.2011 13:46

Hello girls and boys,

I've created a WinDev .NET Assembly, and I'm trying to make it accessible via COM so that it can be called from a VB6 application. There is some rationale behind this madness but I'd rather not go there as it's too depressing. let's just say I need to access it via COM and leave it at that.

So, I create a class in my WinDev 16 component, and I leave the constructor blank, as suggested, and I add a single method that does stuff. Nice and easy.

I check out the compilation options and sure enough, there is "Generate a .NET Assembly".

I follow the instructions in http://doc.windev.com/en-US/?2012003

I've created a .SNK file, no problem, and I pick "Accessible by COM", and I point it at the .SNK file. That part of it goes swimmingly, not a problem. I did, by the way, try this both with the 2.0 framework and the 4.0 framework.

Where I am getting stuck is on what to do next. I can't run RegSvr32.exe for the generated DLL. It doesn't like that. When I pick "Create the setup procedure of the Assembly", none of the generated setups appear to include the DLL file (!?!?!?). When I manually drop the DLL into C:\Windows\assembly it does appear to "install" it, at least when compiled for the .NET 2.0 Framework. But even though it then appears as listed in c:\windows\assembly, the VB6 project from which I try to invoke it appears to know nothing about the component, and I cannot instantiate the class no matter what I try. Nor is there anything in the registry that looks like the registration of a COM component (or -placeholder) for this assembly.

There is one example in the aforementioned link but it's for C++ and it talks about a .tlb which does not appear to get generated when I generate the Assembly.


I'm sure I'm doing something fairly trivial wrong. But what?

Antworten:

I tried generating a .tlb using RegAsm on the generated DLL. It created the .tlb

I then managed to make the VB6 project recognise the .tlb

However, if I then try to instantiate the object I get a "file not found" error. I tried copying everything that was generated into the system32 directory (which is most definitely in my path), including the WD160*net*.dll files ... to no avail

:-(

von windevn00b - am 25.07.2011 14:20
*sigh* ... two steps forward, one step back.

I managed to make it work with a very simple example DLL. The solution in that particular case was to run REGASM.EXE [dllname.dll] /tlb:[dllname.tlb] /codebase - the addition of /codebase solved the problem.

However, I then proceeded to try again with my original component and now when I instantiate the class - and I do nothing whatsoever in the constructor - it returns an "automation error"



von windevn00b - am 25.07.2011 15:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.