Announcement

Collapse
No announcement yet.

MP3Name an WinAmp übergeben

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MP3Name an WinAmp übergeben

    Hallo liebe Leute,

    auf dringendsten Wunsch (...) meines Sohnes, habe ich neben meiner regulären Arbeit eine kleine Anwendung geschrieben, die seine MP3's in einer Datenbank verwaltet mit WinAMP - Anbindung.

    Das geht soweit auch gut, nun hat er aber Dateien mit Sonderzeichen, die zwar das System erkennt und einliest, bei der Übergabe an WinAMP scheint WinAMP diese Dateien aber nicht zu finden (nichts tut sich).

    Die Gegenprobe im Explorer (Doppelklick) startet solche Dateien problemlos...

    Da das Problem nur bei Dateien mit Sonderzeichen auftritt, schließe ich einen Fehler im Aufruf aus, bleibt nur eine falsche Zeichentabelle !?

    Wäre schön wenn mir hier jemand helfen könnte

    Ich bedanke mich für jeden Tip !

    mfg Holger Rogge

  • #2
    Hi Holger,

    wie hast Du den Aufruf von WinAMP implementiert? Gib mal das Codeschnipselchen.

    mf

    Comment


    • #3
      Hallo Michael,

      mit der folgenden Methode rufe ich Winamp auf und übergebe dabei die MP3:

      function TPlayer.ExecApp(App, Params: string; bWait: Boolean): Boolean;
      (* Startet das externe Programm "App" und übergibt den/die Parameter "Params".
      Ist "bWait" gesetzt, wartet die Anwendung bis die externe Anwendung gestartet ist *)
      var
      StartupInfo: TStartupInfo;
      ProcessInfo: TProcessInformation;
      S : string;
      begin
      Result := False;
      FillChar( StartupInfo, SizeOf( TStartupInfo), #0 );
      StartupInfo.cb := SizeOf( TStartupInfo );
      StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
      StartupInfo.wShowWindow := SW_SHOWNORMAL;
      S := Format( '"%s" "%s"', [ App, Params ] );
      Result := CreateProcess( nil, // Anwendungsname
      PChar( S ), // Parameter
      nil, // Security
      nil, // Security
      False,
      NORMAL_PRIORITY_CLASS, // Priorität
      nil, // Environment
      nil, //PChar(DestPath), // Verzeichnis
      StartupInfo,
      ProcessInfo );
      if Result then begin
      if bWait then
      WaitForSingleObject( ProcessInfo.hProcess, INFINITE ); // Kein Time-out
      end;
      CloseHandle( ProcessInfo.hProcess );
      end;

      Mit "Sonderzeichen" meine ich übrigens Zeichen, deren ASCII-Code jenseits von 127 anzusiedeln sind...

      mfg Holger Rogg

      Comment


      • #4
        Ich habe mir mal die Hilfe/MSDN/WindowsSDK zu CreateProcess angeschaut. Da steht was von Unicode. Da habe ich aber keinen Plan von, da ich davon (noch) nicht betroffen bin.

        Hier mal die entsprechende Stelle (nur Auszug).

        <blockquote>
        <b>lpEnvironment</b>

        Pointer to an environment block for the new process. If this parameter is NULL, the new process uses the environment of the calling process.
        An environment block consists of a null-terminated block of null-terminated strings. Each string is in the form:

        name=value

        Because the equal sign is used as a separator, it must not be used in the name of an environment variable.

        If an application provides an environment block, rather than passing NULL for this parameter, the current directory information of the system drives is not automatically propagated to the new process. For a discussion of this situation and how to handle it, see the following Remarks section.

        An environment block can contain Unicode or ANSI characters. If the environment block pointed to by lpEnvironment contains Unicode characters, the dwCreationFlags field's CREATE_UNICODE_ENVIRONMENT flag will be set. If the block contains ANSI characters, that flag will be clear.

        Note that an ANSI environment block is terminated by two zero bytes: one for the last string, one more to terminate the block. A Unicode environment block is terminated by four zero bytes: two for the last string, two more to terminate the block.
        <blockquote&gt

        Comment


        • #5
          Als "Feiglingslösung" könnte es auch funktionieren, den alten 8.3 Namen zu übergeben, habs aber nicht getestet

          Comment


          • #6
            Hallo Michael und Falk,

            manche Wahrheiten sind unangenehm, besonders wenn man Fehler zugeben muss...

            Ich speichere die Laufwerke, Directories und Dateinamen in verschiedenen Tabellen und verknüpfe sie über eindeutige ID's miteinander.

            Im Hinterkopf hatte ich noch eine Konstante mit der Länge 127 für Dateinamen (ich denke aus der WinAPI) und habe diese Länge als max. Länge des Dateinamens in die DB aufgenommen...

            Diese Konstante ist nichts mehr wert...

            Natürlich vielen Dank für eure Versuche mir zu helfen !

            MfG Holger Rogg

            Comment

            Working...
            X