extracting Friendly Name from VARIANT

This is a discussion on extracting Friendly Name from VARIANT within the Windows Programming forums, part of the Platform Specific Boards category; hey guys, I have this VARIANT varName that contains the friendly name of a device that I need to print ...

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

    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 01:06 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    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.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 07-02-2007, 09:22 AM
  2. VARIANT function or variable?
    By NewGuy100 in forum C Programming
    Replies: 7
    Last Post: 07-29-2005, 12:54 PM
  3. Extracting only file name from file path
    By President in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2004, 09: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, 03:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21