Link to home
Create AccountLog in
Avatar of JRumana
JRumana

asked on

IPropertyStorage com interface problem

I am developing an application in xp for CD burning using XPBurn component. In that i want to give label name to the CD so i instantiate XPBurn component as follows but internally it is using IPropertyStorage to change the property

xpburn.volumename = "My Cd"; I will give the code snippet where this line will go after that fuction execution the xpburn.volumename is always blank ("") i dont know where the problem is and i would like to have some idea how to debug this problem?

I have a doubt whether this is a problem of any  VISUAL STUDIO 2005 IDE setting? please guide me....
/// <summary>
        /// Reads the volume name of the CD in the currently selected recorder.  
        /// This property will be read/write in the future.
        /// </summary>
        unsafe public string VolumeName
        {
            set
            {
                
                fDiscMaster.Open();
                IPropertyStorage ppPropStg;
 
                fDataDiscWriter.GetJolietProperties(out ppPropStg);
 
                string propertyID = "VolumeName";
                PROPSPEC propSpec = new PROPSPEC();
                propSpec.ulKind = 0;
                propSpec.__unnamed.lpwstr = (char*)Marshal.StringToCoTaskMemUni(propertyID);
 
                PROPVARIANT propVar = new PROPVARIANT();
                propVar.__unnamed.__unnamed.__unnamed.bstrVal = (char*)Marshal.StringToCoTaskMemUni(value);
                try
                {
                    //delcare un safe variables
                    PROPSPEC[] rgSpecs = new PROPSPEC[1];
                    rgSpecs[0] = propSpec;
 
                    PROPVARIANT[] rgVar = new PROPVARIANT[1];
                    rgVar[0] = propVar;
 
                    object val = value;
                    ppPropStg.WriteMultiple(1, ref propSpec, ref val, 3);
                    ppPropStg.Commit(0x8);
                    fDataDiscWriter.SetJolietProperties(ppPropStg);
                }
                finally
                {
                    Marshal.FreeCoTaskMem(new IntPtr(propSpec.__unnamed.lpwstr));
                    Marshal.FreeBSTR(new IntPtr(propVar.__unnamed.__unnamed.__unnamed.bstrVal));
                    fDiscMaster.Close();
                }
            }
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of wackym
wackym

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account