473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

cominterop runtime callable wrapper

Hi, maybe some of you can give me a hand with this,
I have a dll written in VB 6 but i havent the source code of it.
In Visual Basic 6 this dll instanciates with createobject and the method was
accesed in this way:

mydll.method "1", "2", "3", True

Now in Asp.net when i add the reference and try to call it this way:

mydll.method("1","2","3",true);

It fails telling me that the parameters are by reference!!!! and some of the
parameters appears in the intellisense as ref object!!!!
The TLBIMp is wrong?

thanks
Nov 15 '05 #1
2 1515
Ariel,

No, it is not wrong. If in a method definition there are no modifiers,
then VB will pass them by reference. So, to call them, you have to use:

string pstr1 = "1", pstr2 = "2", pstr3 = "3";
bool pbln1 = true;

// Make the call.
mydll.method(ref pstr1, ref pstr2, ref pstr3, ref pbln1);

That is assuming that the parameters are typed, and not variants. If
they are variants, then you will have to declare pstr1, pstr2, pstr3, and
pbln1 as objects, and cast to/from the object. In this case, you might want
to write wrapper objects that are type-safe, so that you don't have to deal
with casts every time.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ariel Gimenez" <arielgimenez@--sacar--esto--yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi, maybe some of you can give me a hand with this,
I have a dll written in VB 6 but i havent the source code of it.
In Visual Basic 6 this dll instanciates with createobject and the method was accesed in this way:

mydll.method "1", "2", "3", True

Now in Asp.net when i add the reference and try to call it this way:

mydll.method("1","2","3",true);

It fails telling me that the parameters are by reference!!!! and some of the parameters appears in the intellisense as ref object!!!!
The TLBIMp is wrong?

thanks

Nov 15 '05 #2
Thanks Nicholas!

Your solution works fine to me!!!!

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@tk2msftngp13.phx.gbl...
Ariel,

No, it is not wrong. If in a method definition there are no modifiers, then VB will pass them by reference. So, to call them, you have to use:

string pstr1 = "1", pstr2 = "2", pstr3 = "3";
bool pbln1 = true;

// Make the call.
mydll.method(ref pstr1, ref pstr2, ref pstr3, ref pbln1);

That is assuming that the parameters are typed, and not variants. If
they are variants, then you will have to declare pstr1, pstr2, pstr3, and
pbln1 as objects, and cast to/from the object. In this case, you might want to write wrapper objects that are type-safe, so that you don't have to deal with casts every time.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ariel Gimenez" <arielgimenez@--sacar--esto--yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi, maybe some of you can give me a hand with this,
I have a dll written in VB 6 but i havent the source code of it.
In Visual Basic 6 this dll instanciates with createobject and the method

was
accesed in this way:

mydll.method "1", "2", "3", True

Now in Asp.net when i add the reference and try to call it this way:

mydll.method("1","2","3",true);

It fails telling me that the parameters are by reference!!!! and some of

the
parameters appears in the intellisense as ref object!!!!
The TLBIMp is wrong?

thanks


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Roy Smith | last post by:
I've got a function which gets passed a call-back function as a parameter. I want to check to make sure the thing passed in is indeed callable. Is: assert '__call__' in dir (param) the...
4
by: Michal Vitecek | last post by:
hello everyone, today i've come upon a strange exception, consider the following file test.py: --- beginning of test.py --- class A(object): def method1(parA): print "in A.method1()"
2
by: Paul Arun | last post by:
When I'm using the COM components in c# I get the Exception: 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication1.exe Additional information: COM object with CLSID...
1
by: Nadav | last post by:
Hi, Introduction: **************** I have created a .NET COM interop Assembly, this assembly references another COM object. The Problem: ***************** To enable registration of the...
0
by: Mário Sobral | last post by:
Hi ! I have developed a .NET library that references another .NET library. MyLibrary -> OtherLibrary I then create a COMInterop wrapper assembly to use it from a VB6 project:
4
by: Ariel Gimenez | last post by:
Hi in my app im working with excel using cominterop when fished my work with excel i execute this code oWB.Close(null,null,null); oXL.Workbooks.Close(); oXL.Quit();...
0
by: yatharth | last post by:
I have Query related to RCW(Runtime Callable Wrapper), how to use unmanaged code through managed C# and how to interact with COM component by C#. Actually I have to use C/C++/VC++ developed API in...
5
by: Jens | last post by:
The general problem is that I have to start an Application, programmed in C#, out of a c++-programm. To do this, I have made a com callable wrapper around the assembly and startet my application....
6
by: Ron Garret | last post by:
If I do this: def f(self): print self class c1: pass setattr(c1, 'm1', f) Then f is automagically transmogrified into the appropriate sort of method depending on how it is used:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.