From: Boris P. on
Hello! I have a function in C++ like this:

typedef struct
{
int x;
int y;
} sRect;

typedef struct
{
bool bPrintOut;
sRect WindowRect;
} sSettings;

int SetParameter(int DataLen, sSettings Settings);

I am trying to call this function from VB6.

Can anybody please tell me how to call this function?
I think I have tried just any combination of VarPtr, LenB, Byref and
Byval that I could think of.

It would be really nice if somebody could tell me how this has to be called.

Thank you.
Boris

From: Mayayana on
It loooks like it should be like this:

Public Type sRect
x as long
y as long
End Type

Public Type sSettings
bPrintOut as long
WindowRect as sRect
End Type

Public Function SetParameter(ByVal DataLen as long, Settings as sSettings)
as long

It's odd, though, because a window rect is usually
4 longs, for top, left, width, height.

In any case, this is a VBScript group, not a
VB group. If you need more help you should
repost to microsoft.public.vb.general.discussion



From: Boris P. on
Hi Mayayana,

our newsgroup is gone (as you perhaps already know), and here seemed to
be the best alternative place.

Yes, I already tried as well what you proposed, but I am still getting a
"Bad dll calling convention error".

Is it because the function is not a _stdcall? Is that possible?
Any hint that you can give may be great!

Thank you in advance!
Boris

Mayayana:
> It loooks like it should be like this:
>
> Public Type sRect
> x as long
> y as long
> End Type
>
> Public Type sSettings
> bPrintOut as long
> WindowRect as sRect
> End Type
>
> Public Function SetParameter(ByVal DataLen as long, Settings as sSettings)
> as long
>
> It's odd, though, because a window rect is usually
> 4 longs, for top, left, width, height.
>
> In any case, this is a VBScript group, not a
> VB group. If you need more help you should
> repost to microsoft.public.vb.general.discussion
>
>
>

From: Mayayana on

| Yes, I already tried as well what you proposed, but I am still getting a
| "Bad dll calling convention error".
|
| Is it because the function is not a _stdcall? Is that possible?
| Any hint that you can give may be great!
|

Yes, I think that's usually what that means. By
coincidence, I actually just wrote a VB wrapper for
cabinet.dll last week. It's all CDECL, but I was able
to do it easily with Paul Caton's CDECL class that
uses inline assembly to translate.

You should repost this to the VB group. People
using VBS shouldn't have to put up with a C++
discussion. And maybe try to find more info. about
the C++ declaration. That should say what kind
of calling convention it's using.

The deal with the groups is this: ALL of the MS
groups will be discontiued by MS by sometime in
October. This VBScript group is going, too. But it's
only that MS is dropping support. The groups are like
a public, shared bulletin board. Many servers are
continuing to carry them. I switched from the MS
server to eternal-september.org. It's easy. It's free.
And once you switch you'll see that none of the groups
are gone anymore. :) Unfortunately, though, they
are all more quiet than they used to be. Partly because
some people don't know they can still be accessed,
and partly because a surprising number of programmers
"jump when Microsoft says jump". Those people have
dutifully moved to the [unusable] MS web forums.


From: Al Dunbar on


"Mayayana" <mayayana(a)invalid.nospam> wrote in message
news:i823rt$smv$1(a)news.eternal-september.org...

<snip>

> The deal with the groups is this: ALL of the MS
> groups will be discontiued by MS by sometime in
> October. This VBScript group is going, too. But it's
> only that MS is dropping support. The groups are like
> a public, shared bulletin board. Many servers are
> continuing to carry them. I switched from the MS
> server to eternal-september.org. It's easy. It's free.

I finally made the switch, too...

> And once you switch you'll see that none of the groups
> are gone anymore. :) Unfortunately, though, they
> are all more quiet than they used to be. Partly because
> some people don't know they can still be accessed,

and partly because you need to register. That's not a bad thing in itself,
but it is just one extra step.

> and partly because a surprising number of programmers
> "jump when Microsoft says jump". Those people have
> dutifully moved to the [unusable] MS web forums.

It would be interesting to see if those that moved there are still there, or
if they gave up because of the lower functionality...

/Al