PDA

View Full Version : Delphi help



jbjorgen
06-18-2004, 02:43 AM
When I try to run this code in delphi, I get an eAccessViolation error on the AddFromFile line. Any hints as to what I'm leaving out or doing wrong?



uses
..., DMCSCRIPTINGLib_TLB;

------

procedure TForm1.Button1Click(Sender: TObject);
var
Converter: IConverterDisp;
begin

Converter.AddFromFile(WideString('d:\\music\\file. m4a')); // Add a File
Converter.GoConversion(WideString('Mp3 (Lame)'),0,0,0,0); // Convert
end;

Spoon
06-18-2004, 06:57 AM
I am guessing (as don't use Delphi), that the Widestring is not correct, a BStr is needed (which is slightly different to a normal unicode string).

jbjorgen
06-24-2004, 11:52 PM
It specifically says in the help that WideString is compatible with the COM BSTR type. There is no BStr function. I think the problem is that the Converter is not initialized properly...

some kind of Converter.create() or something?

jbjorgen
06-24-2004, 11:56 PM
all I'm looking for is a quick executable that will take a command line argument and convert it to MP3 lame. It's basically three or four lines of code. If someone could compile it for me, that'd be great.

donny
06-26-2004, 08:32 AM
you are probably right about that converter.create....

try like this (looselly):

converter := IConverterDisp.create();

or something like that any way...
in my case (for the player) I had :

amp:= tamp.create(form1);

then I was able to access amp.volume (for instance)