[fpc-pascal] mciSendString with long file names
James Richters
james.richters at productionautomation.net
Tue Sep 20 18:31:38 CEST 2022
I just tried it that way:
Var
pcmd: String;
MyFileName: String;
pcmd:='play "'+MyFileName+'"'+#0;
mciSendString(@pcmd[1],Nil,0,0);
I get the same results, files with no spaces in the name even long file
names play fine, if there's spaces, they won't play.
I had the idea to just get the windows short file name and pass it on to
play the sound instead of bothering to figure out why spaces won't work.
I found getshortpathname:
https://www.freepascal.org/daily/packages/winunits-jedi/jwawinbase/getshortp
athname.html
function GetShortPathName(
lpszLongPath: LPCTSTR;
lpszShortPath: LPTSTR;
cchBuffer: Windows.DWORD
):Windows.DWORD;
does anyone know how to convert a pascal string to the LPCTSTR needed for
the long path and then how to convert the LPTSTR short path to LPCTSTR for
mciSendString?
Are the LPCTSTR and LPTSTR just PChar strings or something else?
James
>I've only ever done this like:
>
>pcmd: string;
>
>pcmd:='open "'+filename+'" ... '+#0;
>
>mciSendString(@pcmd[1], ...);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220920/17cb676e/attachment-0001.htm>
More information about the fpc-pascal
mailing list