COMMate a methode requires an array of variants

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

COMMate a methode requires an array of variants

Post by infratec »

Hi,

since I'm not a COMMate guru, I stumple across the following:
FindKey(<IndexName>[string], <KeyValues>[OLEVariant])
If there are more than one search criteria it expects an array of Variants.
I tried several things with Variants, but was not able to get a working solution.

Any ideas?

Code: Select all

test\Invoke("FindKey('ArtPrjNr', ???)")
Bernd
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: COMMate a methode requires an array of variants

Post by mk-soft »

It´s SafeArray

Perhaps help VariantHelper_Include.pb -> saCreateSafeArray(...)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
infratec
Always Here
Always Here
Posts: 6874
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: COMMate a methode requires an array of variants

Post by infratec »

Ok,

so I can create an array of one type.
But what should I do when the first value is a string and the second is an integer?

And how can I pass this pointer to the methode?

Maybe I'm a bit blind today.

Bernd
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: COMMate a methode requires an array of variants

Post by mk-soft »

Create a SafeArray of type Variant and...

Just moment... Coding....
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: COMMate a methode requires an array of variants

Post by mk-soft »

I am not sure...

With Variant-Helper

Code: Select all

Define.variant var

Define *psa.SAFEARRAY = saCreateSafeArray(#VT_VARIANT, 0, 2)

v_str(SA_VARIANT(*psa, 0)) = T_BSTR("Hello")
v_long(SA_VARIANT(*psa, 1)) = 100

V_ARRAY_VARIANT(var) = *psa
expand macro
VariantClear(*psa\pvData\Value[0-*psa\rgsabound\lLbound])
*psa\pvData\Value[0-*psa\rgsabound\lLbound]\vt = #VT_BSTR
*psa\pvData\Value[0-*psa\rgsabound\lLbound]\bstrVal = T_BSTR("Hello")
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply