question about mci

Everything else that doesn't fall into one of the other PB categories.
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

question about mci

Post 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
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: question about mci

Post by Olliv »

You cannot use them without buying the license.
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

Re: question about mci

Post by khalidel »

Olliv wrote:You cannot use them without buying the license.
thank you for your reply
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: question about mci

Post 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
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: question about mci

Post 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)
?
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

Re: question about mci

Post 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
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: question about mci

Post by Olliv »

Take the code of UserRussian, and ask several questions in the "coding questions" section to be sure to have good answers.
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: question about mci

Post 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
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: question about mci

Post by Olliv »

I did not think prototypes was available on demo. Thank you User Russian, for having managed the Khalidels question very cleverly.
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

Re: question about mci

Post 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
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: question about mci

Post 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
Image Image
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: question about mci

Post 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
Hygge
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: question about mci

Post 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.
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

Re: question about mci

Post 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
khalidel
User
User
Posts: 17
Joined: Sat Mar 23, 2019 7:45 pm

Re: question about mci

Post 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.
Post Reply