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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULL VARIANT 1

Status
Not open for further replies.

Tdrgabi

Programmer
Jun 24, 2004
43
0
0
RO
hi, how can i check if a variant has a NULL value (it doesnt have ==).

if its value is {VT_NULL} .....

 
Test its public member vt on == VT_NULL...
 
thank you ... that works , i just didnt think of it.

just one more question .... does anybody know how to convert from a BSTRING to a LPTSTR?

i tryied wsprintf but it only returns the first letter of the BSTR.

 
Use WideCharToMultiByte() to convert BSTR => ANSI (see MSDN via compiler help).
If you want Unicode use BSTR directly (BSTRs are null-terminated). Warning: BSTRs may contain zero chars.
Code:
if (WideCharToMultiByte(CP_ACP, 0, 
                        bszName, // BSTR
                        WC_SEPCHARS, // -1
                        lpszBuf, // ansi buffer
                        cchBuf,  // bufsize
                        NULL, NULL))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top