Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VARIANT DATA TYPE !!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I convert an Visual Basic datatype
"Variant" into an Foxpro "variant" or "string" ?

How can I typecast an "variant" in foxpro ?

t.i.a.

Patrick
 
The only way to deal with Variants, that I've found, is to use String, and then "know" what's really to be used. So if it's not a string, you'll need to programatically reconstruct what the variant is supposed to be. e.g. if it's an Integer:
intresult = asc(substr(tmpstr, 1, 1)) ;
+ asc(substr(tmpstr, 2, 1)) * 256 ;
+ asc(substr(tmpstr, 3, 1)) * 256 ^ 2 ;
+ asc(substr(tmpstr, 4, 1)) * 256 ^ 3

Rick
 
Is it possible to get vc++ com dll variant datatype result into visual fox pro6 string ?
PUBLIC objCrypt,lpoutput
objCrypt = CreateObject("CryptDemo.Crypt.1")
plaintext, string key, string @Encrypted, integer algorithm,integer inputformat,integer keyformat,integer outputformat,integer mode,integer padding,integer endofstreaming,integer @iRetVal
lpoutput = SPACE(255) && REPLICATE( CHR(0), 50)
retvalue=objCrypt.EncryptData(strinput,strkey1,@lpoutput ,1,0,0,2,0,0,1)
lpoutput=SUBSTR(lpoutput , 1, 50)
MessageBox(lpoutput)
release objCrypt

As it is vc++ com dll.
VC declaration:
STDMETHODIMP CCrypt::EncryptData(VARIANT *vaPlainData, VARIANT *vaKey, VARIANT *vaCipherData, caAlgID AlgID, cifInputFormat InputFormat, ckfKeyFormat KeyFormat, cofOutputFormat OutputFormat, cmMode Mode, cpPadding Padding, BOOL EndOfStreaming, int *RetVal)
when declared the method using declare command.....the error was "Cannot load 32-bit DLL CryptDemo.DLL (it is com dll)
Pl tell how to use @ to get variant com dll output parameter value, with CreateObject into string in foxpro.
Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top