Re: Invoke with an string array as out parameter

Eric Baelen <[email protected]> Mon, 31 Oct 2005 10:35:46 +0100
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <000401c5ddfe$78bf93e0$5601070a@nberic>
Unfortunately no. 


-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Gábor Móczár
Sent: Friday, October 28, 2005 2:58 PM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

Hi Eric,

Any progress in your problem?
Have you managed to solve the issue?

THX

Gabor

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]]On Behalf Of Eric Baelen
Sent: Friday, October 07, 2005 10:14 AM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter


When I do so, I receive a org.jawin.COMException: 8002000d: Memory is
locked.

Regards
Eric

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Andrew Rendle
Sent: Friday, October 07, 2005 9:59 AM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

Again, displaying my ignorance of Java<>Windows, but don't you have to
reserve the memory by initialising the array prior to the invoke and not
just pass an empty array to receive the result

Regards

Andrew Rendle
Team QuickSilver Software

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]]On Behalf Of Christophe Warland
(FRSGlobal)
Sent: 07 October 2005 07:51
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

Gabor,

Since you mention Tomcat, I am wondering whether you made sure to always
access Jawin COM references via the thread that obtained them. If you
don't,
then you will hit the 'apartment' problem.


-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Gábor Móczár
Sent: Thursday, October 06, 2005 6:12 PM
To: [email protected]
Subject: Re: Invoke with an string array as out parameter

It is the same with my code, posted before.
Even Tomcat halts.

Gabor

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin =
[mailto:[email protected]]On Behalf Of Eric Baelen
Sent: Thursday, October 06, 2005 6:05 PM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter


It seems very unstable. After several calls, I receive access violation
from JAWIN.

Can someone confirm what Christophe says is correct or not?

Tx
Eric

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Eric Baelen
Sent: Thursday, October 06, 2005 12:47 PM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

Tx Christophe. It works.

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Christophe Warland
(FRSGlobal)
Sent: Thursday, October 06, 2005 11:56 AM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

With the risk of displaying my complete ignorance of the subject, may I
suggest that you try with an array of byte arrays? i.e. :

outValueRef =3D new Variant.ByrefHolder(new byte[0][]);

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Eric Baelen
Sent: Thursday, October 06, 2005 11:26 AM
To: [email protected]
Subject: Invoke with an string array as out parameter

Hi,

I try to invoke a method with one of the out parameter who is an array
of String:

uint32 EnumKey([IN] uint32 hDefKey =3D 2147483650, [IN] string
sSubKeyName, [out] string sNames[]);

The code is

       Variant.ByrefHolder outValueRef =3D new Variant.ByrefHolder(new
String());
       Object[] objs =3D new Object[3];
       objs[0] =3D new Integer(0x80000002);
       objs[1] =3D
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
       objs[2] =3D outValueRef;

        result =3D (Integer) lSWbemObjectRegProv.invokeN("EnumKey", =
objs);

I've tried everything of the outValueRef:

       Variant.ByrefHolder outValueRef =3D new Variant.ByrefHolder(new
String[]{""});
       Variant.ByrefHolder outValueRef =3D new Variant.ByrefHolder(new
String[1000]);
       .

Basically I receive memory lock or access violation when the invoke is
called.

What is the correct syntax for string array of an out parameter?

Thank you for your help,
Best regards
Eric
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/123 - Release Date:
06.10.2005

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/123 - Release Date:
06.10.2005