using System; using System.Runtime.InteropServices; using System.Text; namespace Vanara.PInvoke { public static partial class Shell32 { /// One of the following values indicating the supported type. [PInvokeData("shobjidl.h", MSDNShortId = "NN:shobjidl.ICDBurnExt")] [Flags] public enum CDBE_ACTIONS : uint { /// /// 0x00000001. Music files are supported. The CD writing extension is invoked for the Copy to audio CD task in the My /// Music folder. /// CDBE_TYPE_MUSIC = 0x1, /// 0x00000002. Data files are supported. The CD writing extension is excluded from Copy to audio CD. CDBE_TYPE_DATA = 0x2, /// /// (int)0xFFFFFFFF. All files are supported. The CD writing extension is invoked for the Copy to audio CD task in the My /// Music folder. /// CDBE_TYPE_ALL = 0xffffffff } /// /// Exposes methods that determine whether a system has hardware for writing to CD, the drive letter of a CD writer device, and /// programmatically initiate a CD writing session. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nn-shobjidl-icdburn [PInvokeData("shobjidl.h", MSDNShortId = "NN:shobjidl.ICDBurn")] [ComImport, Guid("3d73a659-e5d0-4d42-afc0-5121ba425c8d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(CDBurn))] public interface ICDBurn { /// Gets the drive letter of a CD drive that has been marked as write-enabled. /// /// Type: LPWSTR /// A pointer to a string containing the drive letter, for example "F:". /// /// /// Type: UINT /// /// The size of the string, in characters, pointed to by pszDrive. This value will normally be 4. Values larger than 4 are /// allowed, but the extra characters will be ignored by this method. Values less than 4 will generate an E_INVALIDARG error. /// /// /// /// /// The drive whose letter designation is returned by this method is the drive that has the Enable cd writing on this /// drive option selected. This option is found on the drive's property sheet. Only one drive on a system can have this /// option selected. /// /// If a recordable CD drive is present but that option has been deselected, the method will return an error code. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-icdburn-getrecorderdriveletter HRESULT // GetRecorderDriveLetter( LPWSTR pszDrive, UINT cch ); void GetRecorderDriveLetter([MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDrive, uint cch); /// Instructs data to be copied from the staging area to a writable CD. /// /// Type: HWND /// The handle of the parent window of the UI. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// The staging area has a default location of %userprofile%\Local Settings\Application Data\Microsoft\CD Burning. Its actual /// path can be retrieved through SHGetFolderPath, SHGetSpecialFolderPath, SHGetFolderLocation, SHGetSpecialFolderLocation, or /// SHGetFolderPathAndSubDir by using the CSIDL_CDBURN_AREA value. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-icdburn-burn HRESULT Burn( HWND hwnd ); void Burn(HWND hwnd); /// Scans the system for a CD drive with write-capability, returning TRUE if one is found. /// /// Type: BOOL* /// A pointer to a Boolean value containing TRUE if a suitable device is located, FALSE otherwise. /// /// /// This search does not rely on the state of the Enable cd writing on this drive option found on the drive's property /// sheet. Instead, the determination is based on IMAPI. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-icdburn-hasrecordabledrive HRESULT // HasRecordableDrive( BOOL *pfHasRecorder ); [return: MarshalAs(UnmanagedType.Bool)] bool HasRecordableDrive(); } /// /// /// [ ICDBurnExt is available for use in the operating systems specified in the Requirements section. It may be altered or /// unavailable in subsequent versions.] /// /// Exposes a single method that determines content types supported by a CD writing extension. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nn-shobjidl-icdburnext [PInvokeData("shobjidl.h", MSDNShortId = "NN:shobjidl.ICDBurnExt")] [ComImport, Guid("2271dcca-74fc-4414-8fb7-c56b05ace2d7"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ICDBurnExt { /// Determines the supported data type for a CD writing extension. /// /// Type: CDBE_ACTIONS* /// One of the following values indicating the supported type. /// CDBE_TYPE_MUSIC (0x00000001) /// /// 0x00000001. Music files are supported. The CD writing extension is invoked for the Copy to audio CD task in the My /// Music folder. /// /// CDBE_TYPE_DATA (0x00000002) /// 0x00000002. Data files are supported. The CD writing extension is excluded from Copy to audio CD. /// CDBE_TYPE_ALL ((int)0xFFFFFFFF) /// /// (int)0xFFFFFFFF. All files are supported. The CD writing extension is invoked for the Copy to audio CD task in the My /// Music folder. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-icdburnext-getsupportedactiontypes HRESULT // GetSupportedActionTypes( CDBE_ACTIONS *pdwActions ); CDBE_ACTIONS GetSupportedActionTypes(); } /// CoClass for ICDBurn [PInvokeData("shobjidl.h")] [ComImport, Guid("fbeb8a05-beee-4442-804e-409d6c4515e9"), ClassInterface(ClassInterfaceType.None)] public class CDBurn { } } }