The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development

Reply
 
Thread Tools Display Modes
Old 07-14-2004, 03:45 PM   #1
Constant Bitrate
 
Needstorage's Avatar
 
Join Date: May 2004
Location: Belgium
Vehicle: Volvo XC90 2005 summum RTI
Posts: 176
My Photos: (0)
Cool Embedding BSPlayer

Small tutorial on how to embed BSPlayer into your VB6 application.

Starting up BSPlayer:
- Just use Shell to start up the main BSPlayer exe and get the window handle to start:


Code:
Shell "c:\Program Files\BSPlayer\bsplayer.exe" Do DoEvents TheHandle = FindWindow("BSPlayer", "BSPlayer") Loop While TheHandle = 0

Now we have the handle, put BSPlayer in our container. That's just a fancy word for a simple picturebox. (picContainer in my example)
Now if you switch to full screen when playing a movie, it fills your container. So actually you can control its dimensions. (When I go to my main menu while playing a movie, the movie plays on in a small tumbnail-view)

Code:
SetParent TheHandle, Me.picContainer.hwnd

Now you can start manipulating the thing.

- request the status of the player:
Code:
Status = SendMessage(TheHandle, WM_BSP_CMD, BSP_GetStatus, 0 // 0 - STOP // 1 - PAUSE // 2 - PLAY // 4 - No movie open

- open a media file:
Code:
Dim cds As COPYDATASTRUCT Dim buf(1 To 255) As Byte Dim sFileName as string sFileName = "c:\media\media file.something" Call CopyMemory(buf(1), ByVal sFileName, Len(sFileName)) With cds .dwData = BSP_OpenFile .cbData = Len(sFileName) + 1 .lpData = VarPtr(buf(1)) End With Call SendMessage(TheHandle, WM_COPYDATA, 0, cds)

- pause, play, stop, fwd, back
Code:
SendMessage TheHandle, WM_BSP_CMD, BSP_Pause, 0 SendMessage TheHandle, WM_BSP_CMD, BSP_Play, 0 SendMessage TheHandle, WM_BSP_CMD, BSP_Stop, 0 SendMessage TheHandle, WM_BSP_CMD, BSP_Forw, 0 SendMessage TheHandle, WM_BSP_CMD, BSP_Rew, 0


You will also need the next declares and types and all sort of API stuff:

Code:
Public Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function GetParent Lib "user32.dll" (ByVal hwnd As Long) As Long Public Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Public Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Public Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, lpRect As RECT) As Long Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long) Public Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long Public Type POINTAPI X As Long Y As Long End Type Public Const GWL_STYLE = (-16) Public Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME Public Const WS_MAXIMIZEBOX = &H10000 Public Const WS_MINIMIZEBOX = &H20000 Public Const WS_SYSMENU = &H80000 Public Const WM_KEYDOWN = &H100 Public Const WM_CLOSE = &H10 Public Const WM_USER = &H400 Public Const WM_COPYDATA = &H4A Public Const WM_BSP_CMD = WM_USER + 2 Public Type COPYDATASTRUCT dwData As Long ' Use this to identify your message cbData As Long ' Number of bytes to be transferred lpData As Long ' Address of data End Type Public Const BSP_OpenFile = &H10108 Public Const BSP_FS_SWITCH = 10 Public Const BSP_Play = 20 Public Const BSP_Rew = 14 Public Const BSP_Forw = 15 Public Const BSP_Pause = 21 Public Const BSP_Stop = 22 Public Const BSP_Exit = 77 Public Const BSP_Mute = 35 Public Const BSP_GetStatus = &H10102 Public Const BSP_GetFileName = &H1010B Private Enum ESetWindowPosStyles SWP_SHOWWINDOW = &H40 SWP_HIDEWINDOW = &H80 SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE SWP_NOACTIVATE = &H10 SWP_NOCOPYBITS = &H100 SWP_NOMOVE = &H2 SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering SWP_NOREDRAW = &H8 SWP_NOREPOSITION = SWP_NOOWNERZORDER SWP_NOSIZE = &H1 SWP_NOZORDER = &H4 SWP_DRAWFRAME = SWP_FRAMECHANGED HWND_NOTOPMOST = -2 End Enum Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type

Now this was just an intro on embedding BSPlayer into a VB6 project. If you guys have any questions 'bout this, shoot.

I'm using this stuff in conjunction with a lot of other API-calls to give it a true embedded look & feel. (manipulation of the positions and dimensions of the BSplayer windows, mouse cursor hiding in BSPlayer windows, catching clicks in BSPlayer windows...) So it is possible that the declares-section described has some extra API calls I forgot to clean out for this tutorial.
__________________
Needstorage
--------------------------

Who the hell is general failure?!?
And what the f@#k is he doing reading my drive C:\?
Needstorage is offline   Reply With Quote
Sponsored Links
Old 07-14-2004, 04:05 PM   #2
Raw Wave
 
Confused's Avatar
 
Join Date: Aug 2003
Location: Essex, England
Vehicle: Honda Prelude 2.2 VTEC / Ford Anglia 105E
Posts: 2,224
My Photos: (0)
Thanks for that information, Needstorage, I will definately have a look


Garry
__________________
Co-Developer of A.I.M.E.E
www.aimee.cc
Confused is offline   Reply With Quote
Old 07-14-2004, 04:14 PM   #3
Maximum Bitrate
 
mobileh1's Avatar
 
Join Date: Apr 2004
Location: San Francisco
Vehicle: Hummer H1
Posts: 454
My Photos: (0)
What does bsplayer have that either winamp or WMP lacks?
__________________
.//Daren
(Epia M10000/C134) (C137/MII 10000) Liliput /Opus 150W/DVD/512MB/80GB/Hummer H1
MediaCar/CoPilot7/Routis
mobileh1 is offline   Reply With Quote
Old 07-14-2004, 06:44 PM   #4
9 Fingered Administrator
Lesbian
 
frodobaggins's Avatar
 
Join Date: Jan 2003
Location: Ruston, LA
Vehicle: 1998 Ranger/1991 Sunbird
Posts: 9,852
My Photos: (0)
Wrong thread. Oops.
__________________
FrodoPlayer.com
TeaBaggins.com
[H]4 Life
My next generation Front End is right on schedule.
It will be done sometime in the next generation.
I'm a lesbian too.
I am for hire!
frodobaggins is offline   Reply With Quote
Old 07-15-2004, 01:12 AM   #5
Constant Bitrate
 
Needstorage's Avatar
 
Join Date: May 2004
Location: Belgium
Vehicle: Volvo XC90 2005 summum RTI
Posts: 176
My Photos: (0)
Quote: Originally Posted by mobileh1
What does bsplayer have that either winamp or WMP lacks?

WMP?! Are you kidding me?
Way too much overkill! (I'd probably need to implement swapfile-technology into my Embedded XP distro in order for WMP to play an mp3 )

Winamp... well, besides winamp as audio player, i don't know why I should choose for it. (Does winamp play mpg/avi/... DivX, XVid, ... ?)

BSPlayer is pretty small and does not require a lot of resources and it starts fast. It has built in subtitle support. (Subs, srt, ...) and it has:
- custom AR (aspect ratios)
- Fully Skinnable (if you are not "stealth"-embedding it)
- Remote control support (WinLIRC)
- Multiple Audio Streams in AVI's supported
- ...

just look at this page for more detailed info on BSPlayer.
__________________
Needstorage
--------------------------

Who the hell is general failure?!?
And what the f@#k is he doing reading my drive C:\?
Needstorage is offline   Reply With Quote
Old 07-15-2004, 01:14 AM   #6
Constant Bitrate
 
Needstorage's Avatar
 
Join Date: May 2004
Location: Belgium
Vehicle: Volvo XC90 2005 summum RTI
Posts: 176
My Photos: (0)
Quote: Originally Posted by frodobaggins
Wrong thread. Oops.

Frodo, can you explain this? Or have you been drinking too much again?
__________________
Needstorage
--------------------------

Who the hell is general failure?!?
And what the f@#k is he doing reading my drive C:\?

Last edited by Needstorage : 07-15-2004 at 01:16 AM.
Needstorage is offline   Reply With Quote
Old 07-15-2004, 01:23 AM   #7
9 Fingered Administrator
Lesbian
 
frodobaggins's Avatar
 
Join Date: Jan 2003
Location: Ruston, LA
Vehicle: 1998 Ranger/1991 Sunbird
Posts: 9,852
My Photos: (0)
Quote: Originally Posted by Needstorage
Frodo, can you explain this? Or have you been drinking too much again?

I had two windows open.
Pasted into wrong quick reply.
__________________
FrodoPlayer.com
TeaBaggins.com
[H]4 Life
My next generation Front End is right on schedule.
It will be done sometime in the next generation.
I'm a lesbian too.
I am for hire!
frodobaggins is offline   Reply With Quote
Old 07-15-2004, 01:58 AM   #8
Variable Bitrate
 
NoPistonPC's Avatar
 
Join Date: Apr 2004
Location: Boston
Vehicle: 1994 Mazda RX-7
Posts: 360
My Photos: (0)
I hate to preach, but I still don't understand why no one has bothered to use DirectShow to play music and videos (without needing to run winamp, WMP, BSPlayer, or any other external app) with just a few lines of code:

http://www.mp3car.com/vbulletin/show...1&postcount=13

Maybe I'm missing something obvious... if so, please enlighten me.
__________________
1994 RX-7, EPIA P4-ITX w/ Celeron 2.4 Ghz, Arise PSU, Xenarc 700TSV (new model)
NoPistonPC is offline   Reply With Quote
Old 07-15-2004, 01:59 AM   #9
9 Fingered Administrator
Lesbian
 
frodobaggins's Avatar
 
Join Date: Jan 2003
Location: Ruston, LA
Vehicle: 1998 Ranger/1991 Sunbird
Posts: 9,852
My Photos: (0)
Quote: Originally Posted by NoPistonPC
I hate to preach, but I still don't understand why no one has bothered to use DirectShow to play music and videos (without needing to run winamp, WMP, BSPlayer, or any other external app) with just a few lines of code:

http://www.mp3car.com/vbulletin/show...1&postcount=13

Maybe I'm missing something obvious... if so, please enlighten me.

because the problem of handling visualizations yourself. As well as a lot of othe nice things the other objects offer.

Frodo
__________________
FrodoPlayer.com
TeaBaggins.com
[H]4 Life
My next generation Front End is right on schedule.
It will be done sometime in the next generation.
I'm a lesbian too.
I am for hire!
frodobaggins is offline   Reply With Quote
Old 07-15-2004, 02:11 AM   #10
Variable Bitrate
 
NoPistonPC's Avatar
 
Join Date: Apr 2004
Location: Boston
Vehicle: 1994 Mazda RX-7
Posts: 360
My Photos: (0)
Quote: Originally Posted by frodobaggins
because the problem of handling visualizations yourself. As well as a lot of othe nice things the other objects offer.

While there isn't visualization support out-of-the-box, you can use 3rd party, open-source DirectShow filters, such as DC-DSP which will let you do cool things like use WinAmp visualization plugins and provides a parametric equalizer and other sounds filters.
__________________
1994 RX-7, EPIA P4-ITX w/ Celeron 2.4 Ghz, Arise PSU, Xenarc 700TSV (new model)
NoPistonPC is offline   Reply With Quote
Sponsored Links
Old 07-15-2004, 08:02 AM   #11
I should've eaten the blue pill.
 
Bitoholic's Avatar
 
Join Date: Apr 2004
Location: Port Saint Lucie, FL
Vehicle: 1998 Honda Accord Ex
Posts: 682
My Photos: (0)
Quote: Originally Posted by NoPistonPC
While there isn't visualization support out-of-the-box, you can use 3rd party, open-source DirectShow filters, such as DC-DSP which will let you do cool things like use WinAmp visualization plugins and provides a parametric equalizer and other sounds filters.

Using DirectSound and a combination of FFT forumlas/aglorithms you can make your own Visualization system. That is what I had to do with MMC. We are supporting third part as well as our own system. You then just export that FFT data to the developers of the Visuals. I agree with Frodo though, that there is a lot of nice objects that support this already. I just did it so I could learn about DirectSound and sound programming related stuff like FFT (Fast Fourier Transform)

http://mathworld.wolfram.com/FastFourierTransform.html
http://ourworld.compuserve.com/homep...ifowit/fft.htm
http://en.wikipedia.org/wiki/Fast_Fourier_transform

Take care
__________________
Ben S. Stahlhood II
Hybrid Mobile
MMC/Transcend Developer
--------------------------------------
http://www.hybrid-mobile.com/
http://www.cocoamachine.com/
http://weblogs.asp.net/bstahlhood/

Last edited by HybridEngineer : 07-15-2004 at 08:04 AM.
Bitoholic is offline   Reply With Quote
Old 07-15-2004, 08:10 AM   #12
Super Moderator
 
hijinks21's Avatar
 
Join Date: May 2002
Location: Albany, NY
Vehicle: 98 Exporer Sport
Posts: 1,802
My Photos: (0)
Quote: Originally Posted by frodobaggins
because the problem of handling visualizations yourself. As well as a lot of othe nice things the other objects offer.

Frodo

lazy programmers.... you want everything done for you
__________________
'98 Explorer Sport
http://mp3car.zcentric.com (down atm)
AMD 800mhz 192megs RAM 60gig hard drive 9 inch widescreen VGA
80% done
hijinks21 is offline   Reply With Quote
Old 07-15-2004, 08:11 AM   #13
I should've eaten the blue pill.
 
Bitoholic's Avatar
 
Join Date: Apr 2004
Location: Port Saint Lucie, FL
Vehicle: 1998 Honda Accord Ex
Posts: 682
My Photos: (0)
Quote: Originally Posted by NoPistonPC
I hate to preach, but I still don't understand why no one has bothered to use DirectShow to play music and videos (without needing to run winamp, WMP, BSPlayer, or any other external app) with just a few lines of code:

http://www.mp3car.com/vbulletin/show...1&postcount=13

Maybe I'm missing something obvious... if so, please enlighten me.

I use DirectSound/DirectShow for everything in Mobile Media Center. That is why it is so fast. I even wrote some portions in pure ILASM code so that I could make sure of the best tweaks. You do not need any other programs to piggy back of off. So I know what you mean. This is a very huge pain in the arse though, since you have to do a lot of things yourself, where other SDK's and software like Winamp already have it done and tested for many years.
__________________
Ben S. Stahlhood II
Hybrid Mobile
MMC/Transcend Developer
--------------------------------------
http://www.hybrid-mobile.com/
http://www.cocoamachine.com/
http://weblogs.asp.net/bstahlhood/
Bitoholic is offline   Reply With Quote
Old 07-15-2004, 08:12 AM   #14
I should've eaten the blue pill.
 
Bitoholic's Avatar
 
Join Date: Apr 2004
Location: Port Saint Lucie, FL
Vehicle: 1998 Honda Accord Ex
Posts: 682
My Photos: (0)
Quote: Originally Posted by hijinks21
lazy programmers.... you want everything done for you

Or they just want to save some of the time they volunteer, so they have a life...
__________________
Ben S. Stahlhood II
Hybrid Mobile
MMC/Transcend Developer
--------------------------------------
http://www.hybrid-mobile.com/
http://www.cocoamachine.com/
http://weblogs.asp.net/bstahlhood/

Last edited by HybridEngineer : 07-15-2004 at 08:14 AM.
Bitoholic is offline   Reply With Quote
Old 07-15-2004, 08:47 AM   #15
Super Moderator
 
hijinks21's Avatar
 
Join Date: May 2002
Location: Albany, NY
Vehicle: 98 Exporer Sport
Posts: 1,802
My Photos: (0)
Quote: Originally Posted by HybridEngineer
Or they just want to save some of the time they volunteer, so they have a life...

didn't see the sarcaism there did ya??
__________________
'98 Explorer Sport
http://mp3car.zcentric.com (down atm)
AMD 800mhz 192megs RAM 60gig hard drive 9 inch widescreen VGA
80% done
hijinks21 is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
embedding copilot in mediacar kuo MediaCar 50 10-04-2004 04:05 AM
Embedding a window in VB6 - Help pioneer Software & Software Development 9 06-22-2004 04:25 PM
Embedding apps in vb6 Laidback Software & Software Development 9 05-09-2004 07:44 PM
WMP_EXE.exe Fireball ME Archive 9 11-04-2003 09:27 AM


All times are GMT -5. The time now is 07:21 PM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics