[fpc-pascal] mciSendString with long file names

Alexander Grotewohl alex at dcclost.com
Tue Sep 20 17:26:04 CEST 2022


I've only ever done this like:

pcmd: string;

pcmd:='open "'+filename+'" ... '+#0;

mciSendString(@pcmd[1], ...);

mciSendString does return errors.. duno if that'll be helpful.

I originally used it in Virtual Pascal and had to make a partial header myself so the FreePascal one might take parameters differently.
________________________________
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> on behalf of James Richters via fpc-pascal <fpc-pascal at lists.freepascal.org>
Sent: Tuesday, September 20, 2022 9:56:03 AM
To: 'FPC-Pascal users discussions' <fpc-pascal at lists.freepascal.org>
Cc: James Richters <james.richters at productionautomation.net>
Subject: [fpc-pascal] mciSendString with long file names


I’m trying to get mciSendString() to work with long file names with spaces in them and I’m not having any success.

I know with winnows you need quotes around long file names, so I’m trying things like this:



Var MySoundFile:String;

mciSendString(PChar('play '+Ansistring(#34+MySoundFile+#34)),Nil,0,0);



But still it works if my file name has no spaces, but does not work if there are spaces.

I think maybe it’s my conversion to a PChar, but it works as long as there are no spaces, so I don’t know.



The name of my file is in a string because it comes from a record with a string variable in it.. part of another whole system that I don’t want to change just to get this to work.



Any one have any ideas how to get long file names with spaces to work?



James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220920/1674cb7c/attachment.htm>


More information about the fpc-pascal mailing list