Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

OpenDialog nonvcl

  Alt 6. Apr 2011, 18:59
Hab hier ein problem mit dem opendialog glaube von turboPASCAL: War ( ist ) der.

Einmal kann ich meinen Song einladen danach kracht es ...
Hab den fehler noch nicht gefunden.
Delphi-Quellcode:
function OpenFileDialog(hParent: THandle; Filter: String): string;
var
  ofn: TOpenFilename;
  FileNames: array[0..MAX_PATH - 1] of Char;
  FFilter: array[0..MAX_PATH - 1] of Char;
  i: integer;
begin
  Result := '';

  if Filter = 'then
  begin
     Filter := 'All files (*.*)|*.*';
  end else
  begin
    ZeroMemory(@FFilter[0], sizeof(FFilter));
    for i := 0 to length(Filter)-1 do
      if Filter[i+1] = '|then FFilter[i] := #0
        else FFilter[i] := Filter[i+1];
  end;

  ZeroMemory(@FileNames[0], sizeof(FileNames));
  ZeroMemory(@ofn, sizeof(TOpenFilename));
  if IsNt5OrHigher
    then ofn.lStructSize := sizeof(TOpenFilename)
    else ofn.lStructSize := OPENFILENAME_SIZE_VERSION_400;
  ofn.hWndOwner := hParent;
  ofn.hInstance := hInstance;
  ofn.lpstrFile := @FileNames[0];
  ofn.nMaxFile := sizeof(FileNames);
  ofn.Flags := OFN_EXPLORER or OFN_ALLOWMULTISELECT or OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST;
  ofn.lpstrFilter := FFilter;
  ofn.lpstrInitialDir := '.';

  { Datei-Öffnen-Dialog aufrufen }
  if GetOpenFileName(ofn)
   then Result := ofn.lpstrFile
   else Result := '';
end;
Aufruf..

Delphi-Quellcode:
        ID_LOAD:
        begin
          if MidiTracker.FVisible then
            TrackerFile := SKAERO_OpenFileDialog(MainHandle, 'MidiTracker files (*.mtf*)|*.mtf*');
            if TrackerFile <> 'then
              MidiTracker.ParseFile(TrackerFile);

           TrackerFile := '';
        end;
gruss
  Mit Zitat antworten Zitat