Page 1 of 1

need help please

Posted: Tue Feb 20, 2007 2:42 pm
by FreeThought

Code: Select all

Import "oleaut32.lib"
VariantChangeTypeEx(vdst.p-variant ,vsrc.p-variant,lcid.l,cal.l,str$)
EndImport
if above is correct, how can I assign date() to vsrc.

Thanks.

Re: need help please

Posted: Tue Feb 20, 2007 7:28 pm
by SFSxOI
FreeThought wrote:

Code: Select all

Import "oleaut32.lib"
VariantChangeTypeEx(vdst.p-variant ,vsrc.p-variant,lcid.l,cal.l,str$)
EndImport
if above is correct, how can I assign date() to vsrc.

Thanks.
OK, I'm just guessing here, a first guess:

From the MSDN, the actual function is:
VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvarSrc, LCID lcid, unsigned short wFlags, VARTYPE vt )

(http://msdn2.microsoft.com/en-us/library/ms221634.aspx)

where:

*pvargDest and *pvarSrc are pointers to something. So...to simplify it a little, it would look like this for PureBasic (I think)

VariantChangeTypeEx_(*pvargDest, *pvarSrc, lcid, wFlags, vt)
(need the _ to use API)

*pvarSrc can be VT_BSTR, VT_DISPATCH, or VT_DATE - so *pvarSrc points to one of those.

I think VT_DATE is a string = a date = VT_DATE.s
I think VT_BSTR is a string = a binary string = VT_BSTR .s
not sure what VT_DISPATCH is.

If they are strings:
VT_DATE.s = (the date)
VT_BSTR .s = (binary string)

using the date
pvarSrc.s = (the date)
pvargDest = (what ever is supposed to be here)

VariantChangeTypeEx_(@pvargDest, @pvarSrc, lcid, wFlags, vt)

@pvarSrc is pointing to the date now.

pvargDest [Out] Destination for the converted variant.
pvargSrc [Out] Source variant to change the type of.
lcid [In] LCID for the conversion.
wFlags [In] VARIANT_ flags from "oleauto.h".
vt [In] Variant type to change pvargSrc into.


Just a guess, i'm probably wrong. I'm sure someone will come along with a more suitable example for you.

Posted: Wed Feb 21, 2007 4:29 am
by FreeThought
Thanks for responding.
I believe the correct way is as follow:

Code: Select all

vdst.VARIANT
vsrc.VARIANT

vsrc\date=Date()

VariantChangeTypeEx_(@vdst,@vsrc,lcid.l,flag,vt.w)
the only thing I amn't sure of is the vsrc\date=Date(),but I think is correct.
please note lcid =locale id,flag=type of calander(in my case),vt=7(date in my case).you can pickup these from msdn.