Page 1 of 1

interface IDiscRecorder2 ... in VISTA

Posted: Tue Feb 27, 2007 4:51 pm
by bingo
a first sample for using new "Imapi2" interfaces in VISTA ...

Code: Select all

;http://msdn2.microsoft.com/en-us/library/aa365407.aspx

Import "shlwapi.lib"
SHUnicodeToAnsi(pwszSrc.l,pszDst.l,cchBuf.l)
EndImport

Interface IDiscMaster2 Extends IDispatch
  get__NewEnum(a)
  get_Item(a,b)
  get_Count(a)
  get_IsSupportedEnvironment(a)
EndInterface

Interface IDiscRecorder2 Extends IDispatch
  EjectMedia()
  CloseTray()
  AcquireExclusiveAccess(a,b)
  ReleaseExclusiveAccess()
  DisableMcn()
  EnableMcn()
  InitializeDiscRecorder(a)
  get_ActiveDiscRecorder(a)
  get_VendorId(a)
  get_ProductId(a)
  get_ProductRevision(a)
  get_VolumeName(a)
  get_VolumePathNames(a)
  get_DeviceCanLoadMedia(a)
  get_LegacyDeviceNumber(a)
  get_SupportedFeaturePages(a)
  get_CurrentFeaturePages(a)
  get_SupportedProfiles(a)
  get_CurrentProfiles(a)
  get_SupportedModePages(a)
  get_ExclusiveAccessOwner(a)
EndInterface

Procedure.s Uni2Ansi(unicode.l) 
ansi.s = Space(500)
SHUnicodeToAnsi(unicode,@ansi,500)
ProcedureReturn ansi  
EndProcedure

pp.variant
pp\vt = #VT_BSTR

CoInitialize_(0) 
If CoCreateInstance_(?CLSID_MsftDiscMaster2,0,1,?IID_IDiscMaster2,@object1.IDiscMaster2) = 0 
If CoCreateInstance_(?CLSID_MsftDiscRecorder2,0,1,?IID_IDiscRecorder2,@object2.IDiscRecorder2) = 0 

object1\get_Item(0,@pp\bstrval) ; first drive
Debug uni2ansi(pp\bstrval)

object2\InitializeDiscRecorder(pp\bstrval) ;init drive

object2\EjectMedia() ;eject
object2\get_VendorId(@pp\bstrval)
Debug uni2ansi(pp\bstrval) ;vendor
   
EndIf
EndIf

CoUninitialize_()

End

DataSection
  CLSID_MsftDiscMaster2:
    Data.l $2735412E
    Data.w $7F64,$5B0F
    Data.b $8F,$0,$5D,$77,$AF,$BE,$26,$1E
  CLSID_MsftDiscRecorder2:
    Data.l $2735412D
    Data.w $7F64,$5B0F
    Data.b $8F,$0,$5D,$77,$AF,$BE,$26,$1E
  IID_IDiscMaster2:
    Data.l $27354130
    Data.w $7F64,$5B0F
    Data.b $8F,$0,$5D,$77,$AF,$BE,$26,$1E
  IID_IDiscRecorder2:
    Data.l $27354133
    Data.w $7F64,$5B0F
    Data.b $8F,$0,$5D,$77,$AF,$BE,$26,$1E
EndDataSection

8)

Posted: Tue Feb 27, 2007 9:53 pm
by Num3
I hate interfaces :x

MS way to complicate stuff... Grrrr...

Posted: Wed Feb 28, 2007 2:29 pm
by Tranquil
Num3 wrote:I hate interfaces :x

MS way to complicate stuff... Grrrr...
+1!

I dont understand this wired stuff! These absolutely unreadable CLSID's ...

Anyway, thanks for shareing. I will try it in one year if Vista is stable enough and let me install my display drivers. :D