Novell is now a part of Micro Focus

Another GroupWise question. I'm looking for information on...

Articles and Tips: qna

01 Sep 2003


Q.

Another GroupWise question. I'm looking for information on the format of VARIANT parameters: Item (BSTR name, VARIANT postoffice, VARIANT domain)

in the user interface. I presume they are VT_BSTR. The problem is that every time I call an interface function that takes a VARIANT, I get an exception 0x80020009. I can use the Find function just fine, as it only takes a BSTR! I'm performing the following:

VARIANT postOffice; VariantInit (&postOffice); V_VT (&postOffice) = VT_BSTR; V_BSTR (&postOffice) = SysAllocString (TO_OLE_STRING ("TEST_PO"));

The domain is done similarly by calling:

pUsers->Item ((BSTR)"test_user", postOffice, domain, &pDIADUser);

A.

Another C++ user! (And I thought I was the only one.) I have used Item() successfully with C++. The PO and Domain VARIANT parameters are of BSTR type. I believe the problem you are seeing is due to the first parameter. The Item method expects the first parameter to be a wide character (Unicode) string. So, calling the cast to a BSTR for the ->Item() call won't work. You must also convert the string for the first parameter to Unicode (TO_OLE_STRING).

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates