Thread: extracting Friendly Name from VARIANT

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195

    extracting Friendly Name from VARIANT

    hey guys, I have this VARIANT varName that contains the friendly name of a device that I need to print out. The problem is I cant figure out how to access the string within the vaiant. I retrieved the name with
    Code:
    pPropBag->Read(L"FriendlyName", &varName, 0);
    I tried using pbVal, parray, and pbstrVal. All I get is a single character to print out.
    Last edited by abachler; 08-02-2007 at 02:06 PM.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    OK, i fingered it out. Seems the string that is returned is a Wide character string, which means when I was passing the poointer, the high byte was zero, forcing the messagebox to think it reached the end of the string. Using the wide character version of the messagebox function properly displays the friendly names.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 07-02-2007, 10:22 AM
  2. VARIANT function or variable?
    By NewGuy100 in forum C Programming
    Replies: 7
    Last Post: 07-29-2005, 01:54 PM
  3. Extracting only file name from file path
    By President in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2004, 10:51 PM
  4. How to define a variant record type in C
    By Diepvien_007 in forum C Programming
    Replies: 2
    Last Post: 03-12-2003, 04:23 PM
Website Security Test