Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CSharp / OLE

1 view
Skip to first unread message

Looki VanDyke

unread,
Apr 17, 2007, 3:06:16 AM4/17/07
to
Hi,

I want to get a
string value out of
an
activex-component.

I solved it easily
in delphi:

var
hlpstrptr
: WideString;
hlp_string
: String;

...


ActiveXComponent.GetCreatorID(hlpstrptr);
hlp_CreatorID :=
hlpstrptr;

but in C# ??

I only know that

string hlpstr =
"";

result =
axActiveXComponent1.GetCreatorID(ref
hlpstr);


will not work, cause
the
"ActiveXComponent.GetCreatorID"-function
fails
with "wrong
parameter type".

So: hlpstr should be
a pointer to a
WideString (in
"dephi-words")

How can I achive
this with C#?

Best regards
Loki

Marc Rohloff [TeamB]

unread,
Apr 18, 2007, 11:16:27 PM4/18/07
to
On Tue, 17 Apr 2007 09:06:16 +0200, Looki VanDyke wrote:

> I only know that
> string hlpstr = "";
>
> result =
> axActiveXComponent1.GetCreatorID(ref
> hlpstr);
>
> will not work, cause the
> "ActiveXComponent.GetCreatorID"-function
> fails with "wrong parameter type".
>
> So: hlpstr should be a pointer to a WideString (in
> "dephi-words")
> How can I achive this with C#?

.NET doesn't have the concept of a pointer to a widestring.

The first thing to do would be to find out what the GetCreatorID
function expects as parameters, code insite should tell you this as
should a decent reflection tool.

What ActiveX are you trying to access?

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com

Looki VanDyke

unread,
Apr 20, 2007, 3:33:50 AM4/20/07
to
Marc Rohloff [TeamB]
schrieb:

> On Tue, 17 Apr 2007 09:06:16 +0200, Looki VanDyke wrote:
>
>> I only know that
>> string hlpstr = "";
>>
>> result =
>> axActiveXComponent1.GetCreatorID(ref
>> hlpstr);
>>
>> will not work, cause the
>> "ActiveXComponent.GetCreatorID"-function
>> fails with "wrong parameter type".
>>
>> So: hlpstr should be a pointer to a WideString (in
>> "dephi-words")
>> How can I achive this with C#?
>
> .NET doesn't have the concept of a pointer to a widestring.
>
> The first thing to do would be to find out what the GetCreatorID
> function expects as parameters, code insite should tell you this as
> should a decent reflection tool.
>

The documentation of
this routine says:
long
GetCreatorID(BSTR
FAR*
pbstrCreatorID);

The result of this
function is -4, a
table in the
documentation says
that -4 is "invalid
parameter" (buy the
way you are right
this error message
is internally
created by the
activex component).
Never the less I got
the same result when
I tried
hlpstr : String
instead of
hlpstr : WideString
with delphi.
Therefor I need an
equivalent
expression for this
in C#.

Thanks in advance
Loki.

0 new messages