Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Convert vbscript into vb6 code for imapi controls

Avatar of eneate
eneateFlag for United Kingdom of Great Britain and Northern Ireland asked on
Visual Basic ClassicVB Script
2 Comments1 Solution1107 ViewsLast Modified:

I am working through another section of vbscript to convert to vb6 i have attached the section of vb script

the first part is fine

Private DiscMaster As New MsftDiscMaster2
 Private DiscRecorder As New MsftDiscRecorder2

then in the sub

Dim datawriter As MsftDiscFormat2Data
Set datawriter = New MsftDiscFormat2Data
    ' Create a DiscRecorder object for the specified burning device.
      DiscRecorder.InitializeDiscRecorder DiscMaster.Item(0)

 If datawriter.IsRecorderSupported(DiscRecorder) <> True Then
        MsgBox "The current CD/DVD writer on your system does not support writing to disc.", vbSystemModal + vbOKOnly + vbCritical
        Exit Function
    End If

If datawriter.IsCurrentMediaSupported(DiscRecorder) <> True Then
        MsgBox "Current optical media IS NOT supported.", vbSystemModal + vbOKOnly
        Exit Function
    End If

Debug.Print "ClientName = " & datawriter.ClientName

but although datawriter is recognied it is not passing any data and the debug code for clientname is empty.

everything i have tried with currentmedia status fails

any help would be appreciated, sorry but this is the first time i have used imapi or vbscript... ;-)
Dim Index                ' Index to recording drive.
    Dim recorder             ' Recorder object
    Dim Stream               ' Data stream for burning device
    Index = 1                ' Second drive on the system

    ' Create a DiscMaster2 object to connect to CD/DVD drives.
    Dim g_DiscMaster
    Set g_DiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2")

    ' Create a DiscRecorder object for the specified burning device.
    Dim uniqueId
    set recorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2")
    uniqueId = g_DiscMaster.Item(index)
    recorder.InitializeDiscRecorder( uniqueId )

    ' Define the new disc format and set the recorder
    Dim dataWriter
    Set dataWriter = CreateObject ("IMAPI2.MsftDiscFormat2Data")
    dataWriter.recorder = recorder

    Dim boolResult
    boolResult = dataWriter.IsRecorderSupported(recorder)
    If boolResult = True then
        WScript.Echo "--- Current recorder IS supported. ---"
        WScript.Echo "Current recorder IS NOT supported."
    end if

    boolResult = dataWriter.IsCurrentMediaSupported(recorder)
    If boolResult = True then
        WScript.Echo "--- Current media IS supported. ---"
        WScript.Echo "Current media IS NOT supported."
    end if

    WScript.Echo "ClientName = " & dataWriter.ClientName

    ' Check a few CurrentMediaStatus possibilities. Each status
    ' is associated with a bit and some combinations are legal.
    Dim curMediaStatus
    curMediaStatus = dataWriter.CurrentMediaStatus
    WScript.Echo "Checking Current Media Status"
Avatar of nffvrxqgrcfqvvc
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers