Page 1 of 1

question about mci

Posted: Wed Mar 27, 2019 12:01 am
by khalidel
hello pb family, i am a new user of pb just one month and i often face this term mci so : 1/ what is mci? 2/ can i use it as pb demo user? 3/ if yes, how can i use it?
best regards

Re: question about mci

Posted: Wed Mar 27, 2019 12:47 am
by Olliv
You cannot use them without buying the license.

Re: question about mci

Posted: Wed Mar 27, 2019 10:38 am
by khalidel
Olliv wrote:You cannot use them without buying the license.
thank you for your reply

Re: question about mci

Posted: Fri Mar 29, 2019 11:52 am
by User_Russian
You about this? https://en.wikipedia.org/wiki/Media_Control_Interface

In the demo version you can use API functions. Example.

Code: Select all

If OpenLibrary(0, "User32.dll")
  CallFunction(0, "MessageBoxW", 0, @"Hello", @"World", 0)
  CloseLibrary(0)
EndIf

Re: question about mci

Posted: Fri Mar 29, 2019 3:46 pm
by Olliv
Ups... I looped a step : API are available on demo version via library functions.

On complete license, I suppose equivalent code is

Code: Select all

MessageBox_(0, "Hello", "World", 0)
?

Re: question about mci

Posted: Sat Mar 30, 2019 1:07 pm
by khalidel
hello friends, thank you. so can you help with this uncomplete code

Code: Select all

openlibrary(0, "winmm.dll")
callfunction(0, "mcisendstring")
mci("play")
mci("stop")
closelibrary(0)
please debug this code to work on demo.
regards

Re: question about mci

Posted: Mon Apr 01, 2019 3:16 pm
by Olliv
Take the code of UserRussian, and ask several questions in the "coding questions" section to be sure to have good answers.

Re: question about mci

Posted: Tue Apr 02, 2019 3:39 pm
by User_Russian

Code: Select all

Prototype mciSendString(lpszCommand.p-unicode, *lpszReturnString=0, *cchReturn=0, *hwndCallback=0)

If OpenLibrary(0, "winmm.dll")
  mci.mciSendString = GetFunction(0, "mciSendStringW")
  If mci
    File.s = OpenFileRequester("", "", "Music|*.wav;*.mp3", 0)
    If File
      mci(~"open \""+File+~"\" type MpegVideo ALIAS Music")
      mci("play Music")
      MessageRequester("", "")
      mci("stop Music")
      mci("close Music")
    EndIf
  EndIf
  CloseLibrary(0)
EndIf

Re: question about mci

Posted: Tue Apr 02, 2019 8:45 pm
by Olliv
I did not think prototypes was available on demo. Thank you User Russian, for having managed the Khalidels question very cleverly.

Re: question about mci

Posted: Tue Apr 02, 2019 9:47 pm
by khalidel
User_Russian wrote:

Code: Select all

Prototype mciSendString(lpszCommand.p-unicode, *lpszReturnString=0, *cchReturn=0, *hwndCallback=0)

If OpenLibrary(0, "winmm.dll")
  mci.mciSendString = GetFunction(0, "mciSendStringW")
  If mci
    File.s = OpenFileRequester("", "", "Music|*.wav;*.mp3", 0)
    If File
      mci(~"open \""+File+~"\" type MpegVideo ALIAS Music")
      mci("play Music")
      MessageRequester("", "")
      mci("stop Music")
      mci("close Music")
    EndIf
  EndIf
  CloseLibrary(0)
EndIf
thank you but have you tested it because it is still not accepted in demo. errors like : structure not found mcisendstring. mci() is not recognized.

sincerely

Re: question about mci

Posted: Tue Apr 02, 2019 10:57 pm
by Paul
Life is much easier with the full version and having direct access to API commands.
Best to buy full version :)

Code: Select all

#Lib=0

Procedure.i Mci(command.s)
  buffer.s=Space(256) 
  ProcedureReturn CallFunction(#Lib,"mciSendStringW",@command,@buffer,256,0)
EndProcedure

If OpenLibrary(#Lib, "winmm.dll")
  File.s = OpenFileRequester("", "", "Music|*.wav;*.mp3|Video|*.mp4", 0)
  If File
    mci("open "+Chr(34)+file+Chr(34)+" type MpegVideo ALIAS Music")
    mci("play Music")
    MessageRequester("", "")
    mci("stop Music")
    mci("close Music")
  EndIf
  CloseLibrary(#Lib)
EndIf

Re: question about mci

Posted: Wed Apr 03, 2019 8:50 am
by Kiffi
Paul wrote:Life is much easier with the full version and having direct access to API commands.
Best to buy full version :)
+1

Re: question about mci

Posted: Wed Apr 03, 2019 8:58 am
by User_Russian
khalidel wrote:but have you tested it because it is still not accepted in demo.
Yes. I tested in demo 5.50 Win x86 and 5.70 Win x86. The code compiled without errors and worked fine.

Re: question about mci

Posted: Wed Apr 03, 2019 11:30 am
by khalidel
User_Russian wrote:
khalidel wrote:but have you tested it because it is still not accepted in demo.
Yes. I tested in demo 5.50 Win x86 and 5.70 Win x86. The code compiled without errors and worked fine.
sorry you are right. it works well with demo. best regards

Re: question about mci

Posted: Wed Apr 03, 2019 12:16 pm
by khalidel
Paul wrote:Life is much easier with the full version and having direct access to API commands.
Best to buy full version :)

Code: Select all

#Lib=0

Procedure.i Mci(command.s)
  buffer.s=Space(256) 
  ProcedureReturn CallFunction(#Lib,"mciSendStringW",@command,@buffer,256,0)
EndProcedure

If OpenLibrary(#Lib, "winmm.dll")
  File.s = OpenFileRequester("", "", "Music|*.wav;*.mp3|Video|*.mp4", 0)
  If File
    mci("open "+Chr(34)+file+Chr(34)+" type MpegVideo ALIAS Music")
    mci("play Music")
    MessageRequester("", "")
    mci("stop Music")
    mci("close Music")
  EndIf
  CloseLibrary(#Lib)
EndIf
thank you too, your code is also working well.