<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MP3s mit Leerstellen abspielen mit  mciSendString]]></title><description><![CDATA[<p>Servus</p>
<p>wir machen grade in der schule ein Projekt und ich möchte unter anderem einen Filemanager schreiben, der auch MP3s abspielt.... ( alles in der konsole )</p>
<p>Nach einigem googeln bin ich auch mciSendString gestoßen</p>
<p>das sieht dann zb so aus:</p>
<pre><code>pfad = &quot;musik\\Metal\\test.mp3&quot;;
 		string szCommand = &quot;open &quot; + pfad;
      mciSendString(szCommand.c_str(), NULL, 0, NULL);
</code></pre>
<p>allerdings klappt das nicht, wenn der Pfad eine (oder mehrere...) Leerstellen enthält....<br />
nun hab ich iwo gelesen, dass mciSendString die Leerstellen als was anderes einliest.</p>
<p>weitergegoogelt und ich fand das hier:</p>
<pre><code>[B]function GetShortPathName(fn: TFileName): TFileName;
var
  buf: array [0..MAX_PATH] of Char;
begin
  SetString(Result, PChar(@buf),
    Windows.GetShortPathName(PChar(fn), @buf, MAX_PATH)
  )
end;[/B]

procedure TForm1.Button1Click(Sender: TObject);
const
  FileName = '&quot;C:\WINDOWS\Media\Windows XP-kritischer Fehler.wav&quot;';
begin
  label1.Caption := inttostr( MCISendString(PChar('open ' + GetShortPathName(FileName)), nil, 0, Handle));
end;
</code></pre>
<p>Bezieht sich auf mein Problem mit mciSendString, ist allerdings in <strong>Delphi</strong> geschrieben und davon hab ich absolut kP. Könnte das vll jemand <strong>in c++ umwandeln</strong> oder mir sagen was in der Funktion GetShortPathName passiert??</p>
<p>Oder gibt es unkomplizierte alternativen zu mciSendString ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/211543/mp3s-mit-leerstellen-abspielen-mit-mcisendstring</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 05:23:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/211543.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Apr 2008 12:10:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 12:10:24 GMT]]></title><description><![CDATA[<p>Servus</p>
<p>wir machen grade in der schule ein Projekt und ich möchte unter anderem einen Filemanager schreiben, der auch MP3s abspielt.... ( alles in der konsole )</p>
<p>Nach einigem googeln bin ich auch mciSendString gestoßen</p>
<p>das sieht dann zb so aus:</p>
<pre><code>pfad = &quot;musik\\Metal\\test.mp3&quot;;
 		string szCommand = &quot;open &quot; + pfad;
      mciSendString(szCommand.c_str(), NULL, 0, NULL);
</code></pre>
<p>allerdings klappt das nicht, wenn der Pfad eine (oder mehrere...) Leerstellen enthält....<br />
nun hab ich iwo gelesen, dass mciSendString die Leerstellen als was anderes einliest.</p>
<p>weitergegoogelt und ich fand das hier:</p>
<pre><code>[B]function GetShortPathName(fn: TFileName): TFileName;
var
  buf: array [0..MAX_PATH] of Char;
begin
  SetString(Result, PChar(@buf),
    Windows.GetShortPathName(PChar(fn), @buf, MAX_PATH)
  )
end;[/B]

procedure TForm1.Button1Click(Sender: TObject);
const
  FileName = '&quot;C:\WINDOWS\Media\Windows XP-kritischer Fehler.wav&quot;';
begin
  label1.Caption := inttostr( MCISendString(PChar('open ' + GetShortPathName(FileName)), nil, 0, Handle));
end;
</code></pre>
<p>Bezieht sich auf mein Problem mit mciSendString, ist allerdings in <strong>Delphi</strong> geschrieben und davon hab ich absolut kP. Könnte das vll jemand <strong>in c++ umwandeln</strong> oder mir sagen was in der Funktion GetShortPathName passiert??</p>
<p>Oder gibt es unkomplizierte alternativen zu mciSendString ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497418</guid><dc:creator><![CDATA[BlaCkOuT1911]]></dc:creator><pubDate>Thu, 24 Apr 2008 12:10:24 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 12:17:40 GMT]]></title><description><![CDATA[<p>für GetShortPathName siehe MSDN <a href="http://msdn2.microsoft.com/en-us/library/aa364989(VS.85).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/aa364989(VS.85).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497424</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497424</guid><dc:creator><![CDATA[Airdamn]]></dc:creator><pubDate>Thu, 24 Apr 2008 12:17:40 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 12:48:28 GMT]]></title><description><![CDATA[<pre><code>[b]Syntax[/b]

DWORD WINAPI GetShortPathName(
  __in   LPCTSTR lpszLongPath,
  __out  LPTSTR lpszShortPath,
  __in   DWORD cchBuffer
);

Parameters    

[i]lpszLongPath[/i]
    The path string. The function retrieves the short form of this path.
    In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend &quot;\\?\&quot; to the path. For more information, see Naming a File.

[i]lpszShortPath[/i]
    A pointer to a buffer to receive the null-terminated short form of the path that lpszLongPath specifies.

[i]cchBuffer[/i]
    The size of the buffer that lpszShortPath points to, in TCHARs.
</code></pre>
<p>ok bin noch nicht sehr gut in c++ von daher wäre ein Beispielcode, der GetShortPathName verwendet, sehr hilfreich. Danke im voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497448</guid><dc:creator><![CDATA[BlaCkOuT1911]]></dc:creator><pubDate>Thu, 24 Apr 2008 12:48:28 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 15:31:21 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">pfad = &quot;\&quot;mu sik\\M et al\\test.mp3\&quot;&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1497591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497591</guid><dc:creator><![CDATA[...............]]></dc:creator><pubDate>Thu, 24 Apr 2008 15:31:21 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 16:12:54 GMT]]></title><description><![CDATA[<p>bitte mit erklärung....</p>
<p>funzt aber auch nicht^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497632</guid><dc:creator><![CDATA[Blackout1911]]></dc:creator><pubDate>Thu, 24 Apr 2008 16:12:54 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 16:18:39 GMT]]></title><description><![CDATA[<p>sorry</p>
<pre><code class="language-cpp">pfad = &quot;musik\\Metal\\test.mp3&quot;;
string szCommand = &quot;\\&quot; + open &quot; + pfad + &quot;\\&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1497638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497638</guid><dc:creator><![CDATA[....................]]></dc:creator><pubDate>Thu, 24 Apr 2008 16:18:39 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 16:19:39 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">string szCommand = &quot;\\&quot; + &quot;open &quot; + pfad + &quot;\\&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1497640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497640</guid><dc:creator><![CDATA[.................]]></dc:creator><pubDate>Thu, 24 Apr 2008 16:19:39 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 16:21:12 GMT]]></title><description><![CDATA[<p>so jetzt aber!</p>
<pre><code class="language-cpp">string szCommand = &quot;\&quot;&quot; + &quot;open &quot; + pfad + &quot;\&quot;&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1497642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497642</guid><dc:creator><![CDATA[.................]]></dc:creator><pubDate>Thu, 24 Apr 2008 16:21:12 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 16:21:57 GMT]]></title><description><![CDATA[<p>sorry bin besoffen ich kriegs nicht richtig hin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497643</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497643</guid><dc:creator><![CDATA[.................]]></dc:creator><pubDate>Thu, 24 Apr 2008 16:21:57 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 19:14:30 GMT]]></title><description><![CDATA[<p>...aha....!</p>
<p>sieht aber nicht so aus als obs auf ne lösung für mein problem hinausläuft...</p>
<p>wenn zb die datei dort liegt:</p>
<pre><code>[b]musik\\Metal\\artist - song.mp3[/b]
</code></pre>
<p>muss ich das irgendwie so machen:</p>
<pre><code>[b]char dateiname_lang[100]=&quot;artist - song.mp3&quot;;
char dateiname_kurz[100];
char play[4]=&quot;play&quot;;  [i]// müsste eigentlich  [ ..=&quot;play &quot;; ] da sonst -&gt; pla[u]ym[/u]usik\\Metal\\artist - song.mp3[/i]

GetShortPathName(dateiname_lang, dateiname_kurz,255);

     strcat(play,dateiname_kurz);  [i]// play = &quot;play &quot; +  &quot;musik\\Metal\\artist - song.mp3&quot;[/i]

		mciSendString(play, NULL, 0, NULL);[/b]
</code></pre>
<p>das lässt sich zumindest mal compilieren, aber getShortPathName funktioniert anscheinend mit strings nicht (mit denen ich aber arbeite^^).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497735</guid><dc:creator><![CDATA[BlaCkOuT1911]]></dc:creator><pubDate>Thu, 24 Apr 2008 19:14:30 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 19:23:47 GMT]]></title><description><![CDATA[<p><a href="http://c-plusplus.net/forum/viewtopic-var-t-is-39378.html" rel="nofollow">http://c-plusplus.net/forum/viewtopic-var-t-is-39378.html</a></p>
<p>Die dort vorgestellte Funktion funktioniert mit Leerzeichen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497743</guid><dc:creator><![CDATA[..............]]></dc:creator><pubDate>Thu, 24 Apr 2008 19:23:47 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 20:37:23 GMT]]></title><description><![CDATA[<p>na das ist doch mal was...</p>
<p>ich weiß zwar nicht genau wieso es klappt, denn auch wenn ich den code teilweise übernehme klappts mit meinem eigenen nicht hmm... ich probiers morgen (bzw Montag) weiter...</p>
<p>vielen dank &quot;...........&quot; für deine Bemühungen!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497789</guid><dc:creator><![CDATA[BlaCkOuT1911]]></dc:creator><pubDate>Thu, 24 Apr 2008 20:37:23 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Thu, 24 Apr 2008 22:12:12 GMT]]></title><description><![CDATA[<p>Der &quot;Trick&quot; dabei ist, dass der Pfad mit Gänsefüßchen (&lt;-lange nicht mehr gesagt/geschrieben :)) ummantelt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1497836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1497836</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Thu, 24 Apr 2008 22:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Fri, 25 Apr 2008 17:39:54 GMT]]></title><description><![CDATA[<p>Ich glaube, ich habs verstanden. Demnach müsste das &quot;geheimnis&quot; in dem</p>
<pre><code>\&quot;%\&quot;
</code></pre>
<p>liegen?!</p>
<pre><code>wsprintf(cmd,&quot;play \&quot;%s\&quot;&quot;,path); [i] // cmd = &quot;play ...&quot; + der pfad[/i]

mciSendString(cmd,NULL,NULL,NULL) [i]// dann wird cmd abgespielt....[/i]
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1498211</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1498211</guid><dc:creator><![CDATA[Blackout1911]]></dc:creator><pubDate>Fri, 25 Apr 2008 17:39:54 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Sat, 26 Apr 2008 14:06:55 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-403.html" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1498537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1498537</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sat, 26 Apr 2008 14:06:55 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Sat, 26 Apr 2008 16:08:06 GMT]]></title><description><![CDATA[<p>Blackout1911 schrieb:</p>
<blockquote>
<p>Demnach müsste das &quot;geheimnis&quot; in dem</p>
<pre><code>\&quot;%\&quot;
</code></pre>
<p>liegen?!</p>
</blockquote>
<p>Genau! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> (Soll ja keine Frage unbeantwortet bleiben :)).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1498629</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1498629</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sat, 26 Apr 2008 16:08:06 GMT</pubDate></item><item><title><![CDATA[Reply to MP3s mit Leerstellen abspielen mit  mciSendString on Sat, 26 Apr 2008 16:22:03 GMT]]></title><description><![CDATA[<p>Badestrand schrieb:</p>
<blockquote>
<p>Blackout1911 schrieb:</p>
<blockquote>
<p>Demnach müsste das &quot;geheimnis&quot; in dem</p>
<pre><code>\&quot;%\&quot;
</code></pre>
<p>liegen?!</p>
</blockquote>
<p>Genau! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> (Soll ja keine Frage unbeantwortet bleiben :)).</p>
</blockquote>
<p>Danke! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> (Soll ja keine Antwort unbedankt bleiben :)).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1498637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1498637</guid><dc:creator><![CDATA[Blackout911]]></dc:creator><pubDate>Sat, 26 Apr 2008 16:22:03 GMT</pubDate></item></channel></rss>