Einzelnen Beitrag anzeigen

Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#1

PWideChar und TFilename Error ...

  Alt 14. Mär 2006, 23:14
Ich wollte die MediaInfoDLL in mein Programm einbauen (http://kent.dl.sourceforge.net/sourc...7.1.2_Win32.7z).
Das Sample konnte ich compilen. Nun gibt es folgendes Problem:

Wenn ich nun

"To_Display := To_Display + format('%d', [MediaInfo_Open(Handle, opendialog1.filename)]);"

Schreiben will gibt es die Fehlermeldung:

[Pascal Error] Unit1.pas(61): E2010 Incompatible types: 'TFileName' and 'PWideChar'
[Pascal Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'

Hier der Code:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  Handle: Cardinal;
  To_Display: WideString;
  CR: WideString;
  i: integer;
  filename:string;
begin
if opendialog1.execute then
begin
memo1.Clear;
  CR:=Chr(13) + Chr(10);
  {To_Display := MediaInfo_Option (0, 'Info_Version', '');

  To_Display := To_Display + CR + CR + 'Info_Parameters' + CR;
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Parameters', '');

  To_Display := To_Display + CR + CR + 'Info_Capacities' + CR;
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Capacities', '');

  To_Display := To_Display + CR + CR + 'Info_Codecs' + CR;
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Codecs', '');}


  Handle := MediaInfo_New();
  filename :=opendialog1.filename;
  To_Display := To_Display + CR + CR + 'Open' + CR;
  To_Display := To_Display + format('%d', [MediaInfo_Open(Handle, opendialog1.filename)]);
  //To_Display := To_Display + format('%d', [MediaInfo_Open(Handle, 'sample.avi')]);

  To_Display := To_Display + CR + CR + 'Inform with Complete=false' + CR;
  MediaInfo_Option (0, 'Complete', '');
  To_Display := To_Display + MediaInfo_Inform(Handle, 0);

  To_Display := To_Display + CR + CR + 'Inform with Complete=true' + CR;
  MediaInfo_Option (0, 'Complete', '1');
  To_Display := To_Display + MediaInfo_Inform(Handle, 0);

  To_Display := To_Display + CR + CR + 'Custom Inform' + CR;
  MediaInfo_Option (0, 'Inform', 'General;Example : FileSize=%FileSize%');
  To_Display := To_Display + MediaInfo_Inform(Handle, 0);

  To_Display := To_Display + CR + CR + 'GetI with Stream=General and Parameter:=17' + CR;
  To_Display := To_Display + MediaInfo_GetI(Handle, 0, 0, 17, 1);

  To_Display := To_Display + CR + CR + 'Count_Get with StreamKind=Stream_Audio' + CR;
  To_Display := To_Display + format('%d', [MediaInfo_Count_Get(Handle, 2, -1)]);

  To_Display := To_Display + CR + CR + 'Get with Stream:=General and Parameter=^AudioCount^' + CR;
  To_Display := To_Display + MediaInfo_Get(Handle, 0, 0, 'AudioCount', 1, 0);

  To_Display := To_Display + CR + CR + 'Get with Stream:=Audio and Parameter=^StreamCount^' + CR;
  To_Display := To_Display + MediaInfo_Get(Handle, 2, 0, 'StreamCount', 1, 0);

  To_Display := To_Display + CR + CR + 'Get with Stream:=General and Parameter=^FileSize^' + CR;
  To_Display := To_Display + MediaInfo_Get(Handle, 0, 0, 'FileSize', 1, 0);

  To_Display := To_Display + CR + CR + 'Close' + CR;
  MediaInfo_Close(Handle);
  memo1.text := to_display;
  for i := 0 to memo1.lines.Count - 1 do

  listbox1.items.add(memo1.Lines[i]);

end;
end;
Als anderes Beispiel gibt es auch folgenden Code:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  Handle: Cardinal;
  To_Display: WideString;
begin
if opendialog1.execute then
begin
memo1.Clear;
  To_Display := MediaInfo_Option (0, 'Info_Version', '');

  To_Display := To_Display + '\r\n\r\nInfo_Parameters\r\n\r\n';
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Parameters', '');

  To_Display := To_Display + '\r\n\r\nInfo_Capacities\r\n';
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Capacities', '');

  To_Display := To_Display + '\r\n\r\nInfo_Codecs\r\n';
  To_Display := To_Display + MediaInfo_Option (0, 'Info_Codecs', '');

  To_Display := To_Display + '\r\n\r\nOpen\r\n';
  Handle := MediaInfo_Open(opendialog1.filename);

  To_Display := To_Display + '\r\n\r\nInform with Complete=false\r\n';
  MediaInfo_Option (0, 'Complete', '');
  To_Display := To_Display + MediaInfo_Inform(Handle, 0);

  To_Display := To_Display + '\r\n\r\nInform with Complete=true\r\n';
  MediaInfo_Option (0, 'Complete', '1');
  To_Display := To_Display + MediaInfo_Inform(Handle, 0);

  To_Display := To_Display + '\r\n\r\nCustom Inform\r\n';
  MediaInfo_Option (0, 'Inform', 'General;Example : FileSize=%FileSize%');
  To_Display := To_Display + MediaInfo_Inform(Handle, 1);

  To_Display := To_Display + '\r\n\r\nGetI with Stream=General and Parameter:=13\r\n';
  To_Display := To_Display + MediaInfo_GetI(Handle, 0, 0, 13, 1);

  To_Display := To_Display + '\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n';
  To_Display := To_Display + format('%d', [MediaInfo_Count_Get(Handle, 2, -1)]);

  To_Display := To_Display + '\r\n\r\nGet with Stream:=General and Parameter=^AudioCount^\r\n';
  To_Display := To_Display + MediaInfo_Get(Handle, 0, 0, 'AudioCount', 1, 0);

  To_Display := To_Display + '\r\n\r\nGet with Stream:=Audio and Parameter=^StreamCount^\r\n';
  To_Display := To_Display + MediaInfo_Get(Handle, 2, 0, 'StreamCount', 1, 0);

  To_Display := To_Display + '\r\n\r\nGet with Stream:=General and Parameter=^FileSize^\r\n';
  To_Display := To_Display + MediaInfo_Get(Handle, 0, 0, 'FileSize', 1, 0);

  To_Display := To_Display + '\r\n\r\nClose\r\n';

  MediaInfo_Close(Handle);

  Memo1.Text := To_Display;
end;
end;
Nun meckert Delphi bei dieser Zeile:

"Handle := MediaInfo_Open(opendialog1.filename);"

[Pascal Error] Unit1.pas(60): E2010 Incompatible types: 'Cardinal' and 'TFileName'

Kennt Einer von Euch ne Lösung, da ich einen OpenDialog unbedingt einbauen wollte?
  Mit Zitat antworten Zitat