Go Back   Club CDFreaks - Knowledge is Power > International Chat: Software related > Nero SDK Discussion Forum


Commercial ads

Nero SDK Discussion Forum Discuss, [Delphi 7] - Events at International Chat: Software related forum; Hello. How can I handle NeroDrive-events with Delphi 7? Joe09


Reply
 
Thread Tools
Old 27-10-2003   #1 (permalink)
New on Forum
 
Join Date: Oct 2003
Posts: 4
[Delphi 7] - Events

Hello.

How can I handle NeroDrive-events with Delphi 7?

Joe09
joe09 is offline   Reply With Quote
AltToday
CD Freaks

Beitrag
__________________
This advertising will not be shown to registered members.
Register your free account today and become a member on Club CD Freaks - Knowledge is Power
Old 15-11-2003   #2 (permalink)
CD Freaks Rookie
 
Join Date: Jan 2003
Posts: 37
I was able to get events to work with delphi 7.

Now trying to figure out how to do a Multisession Disk.


mmgrover
mmgrover is offline   Reply With Quote
Old 02-12-2003   #3 (permalink)
New on Forum
 
Join Date: Dec 2003
Posts: 2
I am eager to know this aswell, somehow the NereDrive and NeroDrives events are not exported when using the Import type library :S. Anyways hope someone reply, if someone needs to know how to burn things like audio or whatever, feel free to ask, i just need 2 know how to access those events, the rest is pretty simple.

Michel.
MichelBerger is offline   Reply With Quote
Old 08-12-2003   #4 (permalink)
atf
New on Forum
 
Join Date: Dec 2003
Posts: 9
Quote:
I was able to get events to work with delphi 7.
And how did you get them working ?
atf is offline   Reply With Quote
Old 29-03-2005   #5 (permalink)
New on Forum
 
Join Date: Mar 2005
Posts: 10
Re: [Delphi 7] - Events

I tried to import the NERO - TLB and as everybody I looked for the events of the
INeroDrive object which weren't there.

So I wrote a little wrapper which functions the following way:

The object you want to receive has to implement my defined INeroDriveEvents
interface.
Then a TNeroDriveEvents object has to be created and the InvokableObject
property has to be set.

I used this wrapper e.g. for querying cd info like this

drive.CDInfo(NERO_READ_CD_TEXT or NERO_READ_ISRC);

for j := 0 to 1000 do
begin
sleep(10);
Application.ProcessMessages;
end;

Please if anybody can use this code report back if there are some
errors!

kind regards
Mike



Code of the wrapper:
unit NeroEventWrapper;

interface

uses
NEROLib_TLB;

type
INeroDriveEvents = interface(IDispatch)
['{D149A7EF-E0BB-4FDC-8DE6-8D2D441DEC34}']
procedure OnProgress(var ProgressInPercent: Integer; var Abort: WordBool);
procedure OnAddLogLine(var TextType: NERO_TEXT_TYPE; var Text: WideString);
procedure OnSetPhase(var Text: WideString);
procedure OnDisableAbort(var EnableAbort: WordBool);
procedure OnWriteDAE(var ignore: Integer; var Data: OleVariant);
procedure OnDoneDAE(var Ok: WordBool);
procedure OnDoneErase(var Ok: WordBool);
procedure OnDoneBurn(var StatusCode: NERO_BURN_ERROR);
procedure OnAborted(var Abort: WordBool);
procedure OnDoneImport(var Ok: WordBool; var Folder: INeroFolder; var CDStamp: INeroCDStamp);
procedure OnMajorPhase(var phase: NERO_MAJOR_PHASE);
procedure OnSubTaskProgress(var ProgressInPercent: Integer; var Abort: WordBool);
procedure OnDoneWaitForMedia(var Success: WordBool);
procedure OnDoneCDInfo(const pCDInfo: INeroCDInfo);
procedure OnDoneImport2(bOk: WordBool; const pFolder: INeroFolder;
const pCDStamp: INeroCDStamp;
const pImportInfo: INeroImportDataTrackInfo;
importResult: NERO_IMPORT_DATA_TRACK_RESULT);
procedure OnDriveStatusChanged(driveStatus: NERO_DRIVESTATUS_RESULT);
procedure OnDoneEstimateTrackSize(bOk: WordBool; BlockSize: Integer);
procedure OnDoneBAOCreateHandle(StatusCode: NERO_BURN_ERROR);
procedure OnDoneBAOWriteToFile(StatusCode: NERO_BURN_ERROR; lNumberOfBytesWritten: Integer);
procedure OnDoneBAOCloseHandle(StatusCode: NERO_BURN_ERROR);
end;

const IID_DRIVEEVENTS : TGUID = '{7DC919C5-94D3-11D4-821C-D08D42000000}';

type
TNeroDriveEvents = class(TObject, IDispatch)
private
FInvokableObj : INeroDriveEvents;
FCon : integer;
FSource : INeroDrive;
protected
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
function GetIDsOfNames(const IID: TGUID; Names: Pointer;
NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall;
function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
public
property InvokableObject : INeroDriveEvents read FInvokableObj write FInvokableObj;

constructor Create(source : INeroDrive);
destructor Destroy; override;
end;

implementation

uses
Windows, ActiveX, SysUtils, ComObj;
{ TNeroDriveEvents }

function TNeroDriveEvents.GetIDsOfNames(const IID: TGUID; Names: Pointer;
NameCount, LocaleID: Integer; DispIDs: Pointer): HResult;
begin
Result := E_NOTIMPL;
end;

function TNeroDriveEvents.GetTypeInfo(Index, LocaleID: Integer;
out TypeInfo): HResult;
begin
Result := E_NOTIMPL;
end;

function TNeroDriveEvents.GetTypeInfoCount(out Count: Integer): HResult;
begin
Count := 0;
Result := S_OK;
end;

// funcionality mostly cpied from TOleServer
function TNeroDriveEvents.Invoke(DispID: Integer; const IID: TGUID;
LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo,
ArgErr: Pointer): HResult;
var
ParamCount, I: integer;
VarArray : Array of OleVariant;
intVal : integer;
retVal : WordBool;
txt : WideString;
textType : NERO_TEXT_TYPE;
neroBurnError : NERO_BURN_ERROR;
folder : INeroFolder;
cdStamp : INeroCDStamp;
neroPhase : NERO_MAJOR_PHASE;
neroCDInfo : INeroCDInfo;
neroImportInfo: INeroImportDataTrackInfo;
importResult: NERO_IMPORT_DATA_TRACK_RESULT;
driveStatus : NERO_DRIVESTATUS_RESULT;
begin
Result := S_OK;
// Get parameter count
ParamCount := TDispParams(Params).cArgs;
// Set our array to appropriate length
SetLength(VarArray, ParamCount);
// Copy over data
for I := Low(VarArray) to High(VarArray) do
VarArray[High(VarArray)-I] := OleVariant(TDispParams(Params).rgvarg^[i]);

try
// Invoke call on object
if FInvokableObj <> nil then
begin
// call correct proc
case DispID of
1: begin
intVal := VarArray[0];
retVal := VarArray[1];
FInvokableObj.OnProgress(intVal, retVal);
VarArray[1] := retVal;
end;
2: begin
textType := VarArray[0];
txt := VarArray[1];
FInvokableObj.OnAddLogLine(textType, txt);
end;
3: begin
txt := VarArray[0];
FInvokableObj.OnSetPhase(txt);
end;
4: begin
retVal := VarArray[0];
FInvokableObj.OnDisableAbort(retVal);
VarArray[0] := retVal;
end;
5: begin
intVal := VarArray[0];
FInvokableObj.OnWriteDAE(intVal, VarArray[1]);
VarArray[0] := intVal;
end;
6: begin
retVal := VarArray[0];
FInvokableObj.OnDoneDAE(retVal);
VarArray[0] := retVal;
end;
7: begin
retVal := VarArray[0];
FInvokableObj.OnDoneErase(retVal);
VarArray[0] := retVal;
end;
8: begin
neroBurnError := VarArray[0];
FInvokableObj.OnDoneBurn(neroBurnError);
VarArray[0] := neroBurnError;
end;
9: begin
retVal := VarArray[0];
FInvokableObj.OnAborted(retVal);
VarArray[0] := retVal;
end;
10:begin
retVal := VarArray[0];
Supports(VarArray[1], INeroFolder, folder);
Supports(VarArray[2], INeroCDStamp, cdStamp);
FInvokableObj.OnDoneImport(retVal, folder, cdStamp);
VarArray[0] := retVal;
end;
11:begin
neroPhase := VarArray[0];
FInvokableObj.OnMajorPhase(neroPhase);
end;
12:begin
intVal := VarArray[0];
retVal := VarArray[1];
FInvokableObj.OnSubTaskProgress(intVal, retVal);
VarArray[1] := retVal;
end;
13:begin
retVal := VarArray[0];
FInvokableObj.OnDoneWaitForMedia(retVal);
VarArray[0] := retVal;
end;
14:begin
Supports(VarArray[0], INeroCDInfo, neroCdInfo);
FInvokableObj.OnDoneCDInfo(neroCdInfo);
end;
15:begin
retVal := VarArray[0];
Supports(VarArray[1], INeroFolder, folder);
Supports(VarArray[2], INeroCDStamp, cdStamp);
Supports(VarArray[3], INeroImportDataTrackInfo, neroImportInfo);
importResult := VarArray[4];
FInvokableObj.OnDoneImport2(retVal, folder, cdStamp, neroImportInfo, importResult);
end;
16:begin
driveStatus := VarArray[0];
FInvokableObj.OnDriveStatusChanged(driveStatus);
end;
17:begin
retVal := VarArray[0];
intVal := VarArray[1];
FInvokableObj.OnDoneEstimateTrackSize(retVal, intVal);
end;
18:begin
neroBurnError := VarArray[0];
FInvokableObj.OnDoneBAOCreateHandle(neroBurnError);
end;
19:begin
neroBurnError := VarArray[0];
intVal := VarArray[1];
FInvokableObj.OnDoneBAOWriteToFile(neroBurnError, intVal);
end;
20:begin
neroBurnError := VarArray[0];
FInvokableObj.OnDoneBAOCloseHandle(neroBurnError);
end;
else
Result := E_NOTIMPL;
end;
end;
except
Result := E_UNEXPECTED;
end;

// Clean array
SetLength(VarArray, 0);
end;

function TNeroDriveEvents._AddRef: Integer;
begin
Result := 1;
end;

function TNeroDriveEvents._Release: Integer;
begin
Result := 1;
end;

function TNeroDriveEvents.QueryInterface(const IID: TGUID;
out Obj): HResult;
begin
Result := E_NOINTERFACE;

//If events interface requested, return IDispatch
if IsEqualIID(IID, IID_DRIVEEVENTS) then
begin
if GetInterface(IDispatch, Obj) then
Result := S_OK
end
else
//Handle other interface requests normally
if GetInterface(IID, Obj) then
Result := S_OK
end;

constructor TNeroDriveEvents.Create(source: INeroDrive);
var intf : IUnknown;
begin
inherited Create;

FSource := source;

QueryInterface(IID_DRIVEEVENTS, intf);

// now connect the the nero drive object
InterfaceConnect(FSource, _INeroDriveEvents, intf, FCon);
end;

destructor TNeroDriveEvents.Destroy;
begin
// disconnect events
InterfaceDisconnect(FSource, IID_DRIVEEVENTS, FCon);

inherited;
end;

end.
mRabat is offline   Reply With Quote
Old 30-03-2005   #6 (permalink)
New on Forum
 
Join Date: Mar 2005
Posts: 10
Re: [Delphi 7] - Events

Forget what I wrote.

There is a nice website where a tool for such things is available:

http://www.techvanguards.com/products/eventsinkimp/
mRabat is offline   Reply With Quote
 
Reply


If you can't find where you are looking for, then become a member and get an answer fast! We have thousands of people online every moment of the day to help you! Click here


Can't find where you are looking for? Search our knowledgebase! Our Community Friends
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Nero events gapilazo Nero SDK Discussion Forum 4 15-03-2005 14:04
.NET C# events again chelala Nero SDK Discussion Forum 0 19-07-2004 23:14
Events don't work... gerhard_pichler Nero SDK Discussion Forum 0 13-04-2004 01:47
Delphi 7 and NeroCOM Events GMTyrael Nero SDK Discussion Forum 5 17-02-2004 14:53
NeroCOM and .NET and events LouClarkso Nero SDK Discussion Forum 7 19-12-2003 13:03


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT +2. The time now is 06:57.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0