Haris,
Since you changed your interface, you will also need to change the class
that implements it. If you can't change that class, you will need to change
the interface back to what it was before, and find another work around.
Assuming you CANNOT change the class and interface to be VB friendly (either
by modifying existing calls, or adding new ones), I think your only option
would be to create a small helper .dll in C# to make the call for you. To
tell the truth, I've not created a C# dll to be compatable with VB 6... but
here's the meat of it...esentially the same suggestion I mentioned earlier,
but now using your parametrs
[whatever attributes necessary to make COM compliant]
class ITestingVB6Adapter
{
[whatever attributes necessary to make COM compliant]
public bool TestCheck(
ITesting testing, // testing object to make the call against
int param1_hi, // high-order 32 bits of 64 bit param1
int param1_lo, // low-order 32 bits of 64 bit param1
int param2_hi, // high-order 32 bits of 64 bit param2
int param2_lo) // low-order 32 bits of 64 bit param2
{
Int64 param1;
Int64 param2;
param1 = param1_hi; // assign high order bits
param1 = param1 << 32; // shift up
param1 = param1 + param1_lo; // add low order bits
param2 = param2_hi; // assign high order bits
param2 = param2 << 32; // shift up
param2 = param2 + param2_lo; // add low order bits
// return result of object method
return testing.TestCheck(param1, param2);
}
}
In VB you would call this passing your object and methods.
Dim oT As new ITesting
Dim oH As new ITestingVB6Adapter
Dim b as Boolean
Dim param1 As Long
Dim param2 As Long
param1 = 1234567
param2 = 7654321
// since VB Long's are 32 bit numbers, you can always pass 0 for high 32
bits
// if you need real 64 bit values, you will have to work out the math
somehow.
b = oH.TestCheck(oT, 0, param1, 0, param2)
Hope this helps
<ha*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Thanks everyone.
From the replies I can summarize that either change VB code by
converting Int64 to Currency or something else useable by VB or create
another function in C# dll that expose int to VB yet call the function
with Int64 parameters.
Actually I am trying to avoid both solution. I was thinking more in the
line of changing the ITesting interface declaration.
I have tried to do this:
public interface ITesting
{
bool TestConnect(string strc, string usr, string pwd);
void TestDisconnect();
bool Start(bool boolparam);
//bool TestCheck(Int64 param1, Int64 param2);
bool TestCheck(int param1, int param2);
//Int64 TestID{get;}
int TestID{get;}
}
There is two error:
'Testing' does not implement interface member 'ITesting.TestCheck(int,
int)'
'Testing' does not implement interface member 'ITesting.TestID'.
'Testing.TestID' is either static, not public, or has the wrong return
type.
I can understand why the error is given. Just wondering is there a work
around for this? If this cannot be done appreciate some explanation on
why it cannot be done.
Thanks and regards,
Haris