NeroVisionAPI sample c# program

Hi,

Is there any examples of creating a DVD viideo disk using C# and NeroVisionAPI?.

Cheers

Mick

Ok, So i’ve been playing a bit but not got too far and only have even more questions!

I can see that I can the following statements to allow me to start using some of the API’s

using NeroVisionAPI;
using NEROLib;

and then

NEROLib.NeroClass neroAPI = new NEROLib.NeroClass();

…Do stuff with Nero…

neroProj.SetXMLString(“some xml”);
NeroVisionAPI.INeroBurnContext context;
neroProj.CreateNeroBurnContext(neroAPI,null,out context);

The problem I have is that the CreateNeroBurnContext need a handle to the neroAPI dll! - in the old days this would have been a loadlibrary or something - but I am new to c# and don’t know where to get this from.

Also in the c++ example it tals about a glue library - do I need to use this?.

Perhaps someone could get me started - please.

Cheers

Mick

Hey Mick,

I’ve been doing a similar thing in trying to use Nero Vision from .net. The best way is to create a wrapper in c++ using Nero Vision/Nero API, then use that in c#.

To use the NeroVision api, it needs to be linked with static libraries, which can only be done in c++. I dont think that Nero Vision COM library is meant to be used.

Thanks for the reply - I am OK at C++ but really new to this .NET stuff!, any chance you could post some or all of your ‘wrapper’ class file so I can see the sort of thing that needs to be done.

Thanks

Mick

Can no one help me here?

Someone must have this working, so please could a small code snippet be posted just to get me started.

Thanks a lot.

Mick

NeroVisionAPI is meant to be used along with NeroAPI. There is no official way to use along with NeroCOM. This will surely be fixed soon.

Lets hope so…

Mick,

There is a sample NeroVision c++ project in the SDK.

All you need to do is use that as a starting point. Then you need to decide wether to do a Managed c++ dll or un-managed c++ dll to use in .net. I wasn’t too familiar with the pro and cons of doing something like this in managed c++, so i went for the un-managed path.

A managed c++ dll is a typicaly .net assembly which uses the .net framework and is used by adding a reference to it in c#.

An un-managed c++ dll can only be used using the interop “DLLImport” attribute. Since you cannot use un-managed c++ classes (unless its a com object) using DllImport, you must create a c style function library and declare you functions with the “extern” keyword to use from .net, such as.

extern "C" __declspec(dllexport) void EjectDrive()

Then use them c# like this:

		
[DllImport("your-unmanaged-library.dll")]
private static extern void EjectDrive();

Whichever method you choose, you need to link your c++ project with the NeroApiGlue libraries. See the sample NeroVision project.

OK things are moving…

I have the following code

        NeroVisionAPI.Project neroProj = new Project();
        NeroVisionAPI.INeroBurnContext context;
        try
        {
            neroProj.SetXMLFile("c:\

erotext.xml");

            //Ok lets get a drive
            NEROLib.NeroDrives availDrives =          neroAPI.GetDrives(NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_DVD_M);
            NEROLib.INeroDrive drive = availDrives.Item(1);

// drive.
long size=0;
neroProj.EstimateDiskSize(out size);

            double seconds=0;
            neroProj.EstimateCreateNeroBurnContextTime(null, out seconds);

            System.IntPtr handle = getNeroModuleHandle();
            
            if (neroProj.CreateNeroBurnContext(handle,null,out context))
            {
                string strText = "Context created";
            }

This is all working!, I have created an un managed DLL that defines the getNeroModuleHandle and this is OK.

As far as I can see I now need to call NeroBurn!, this does not seem to be available from a NEROLib.INeroDrive object. Am I completely off track here?

Mick

As far as I can see I now need to call NeroBurn!, this does not seem to be available from a NEROLib.INeroDrive object. Am I completely off track here?
Yes you are, unfortunately. As I have previously posted, you cannot currently do this. This will probably be changed in the upcoming release.

OK. Thanks, I’ll hang on for that then, any ETA that we know of?.

Regards

Mick

No, sorry. Nothing specific. The upcoming release is the best I can say.

Can you share a little more light on the method getNeroModuleHandle();