MCiWnd api problem.
-
hey guys, im building a media player using the MCiWND class in VB 6.0. im using the SendMessageAsString function to send commands to the Mci device. it runs fine and all that, but after a song is done playing, the status of my window does not change. it keeps playing even after the file is done. i.e i cant find a way to read the status change of the Mci device. ive set the flags to Notify Mode change.. now my problem is, i dont know how to read the mode change that occurs after the song is done playing. can i treat the mode change as an event? or anything else i can do? here's what ive coded so far.:
'Create a MciWND class
Call MCIWndRegisterClass
flags = WS_CHILD And MCIWNDF_NOTIFYMODE Or MCIWNDF_NOTIFYALLszFileName = Playlist1.Text
hMCIWnd = CreateWindowExAsString(0&, "MCIWndClass", "ORCA", flags, _
10&, 10&, 0&, 0&, _
Me.hwnd, _
0&, _
App.hInstance, _
szFileName)Call SendMessageAsString(hMCIWnd, MCIWNDM_SENDSTRING, flags, "play")
here's a screenshot of the problem: http://img33.picoodle.com/img/img33/3/1/24/f_scrnshtm_5a52658.jpg[^] as u can see, its pretty basic.. lots of stuff to add :P suggestions and criticism are welcome.. :)
-
hey guys, im building a media player using the MCiWND class in VB 6.0. im using the SendMessageAsString function to send commands to the Mci device. it runs fine and all that, but after a song is done playing, the status of my window does not change. it keeps playing even after the file is done. i.e i cant find a way to read the status change of the Mci device. ive set the flags to Notify Mode change.. now my problem is, i dont know how to read the mode change that occurs after the song is done playing. can i treat the mode change as an event? or anything else i can do? here's what ive coded so far.:
'Create a MciWND class
Call MCIWndRegisterClass
flags = WS_CHILD And MCIWNDF_NOTIFYMODE Or MCIWNDF_NOTIFYALLszFileName = Playlist1.Text
hMCIWnd = CreateWindowExAsString(0&, "MCIWndClass", "ORCA", flags, _
10&, 10&, 0&, 0&, _
Me.hwnd, _
0&, _
App.hInstance, _
szFileName)Call SendMessageAsString(hMCIWnd, MCIWNDM_SENDSTRING, flags, "play")
here's a screenshot of the problem: http://img33.picoodle.com/img/img33/3/1/24/f_scrnshtm_5a52658.jpg[^] as u can see, its pretty basic.. lots of stuff to add :P suggestions and criticism are welcome.. :)
V.G wrote:
suggestions and criticism are welcome
You're making work for yourself. VB6 is crap, and it's unsupported ( you should put VB6 in your subject line if you're using it, b/c hardly anyone does ). VB.NET has a media player control you just drop into a form and it works.
Christian Graus Driven to the arms of OSX by Vista.
-
V.G wrote:
suggestions and criticism are welcome
You're making work for yourself. VB6 is crap, and it's unsupported ( you should put VB6 in your subject line if you're using it, b/c hardly anyone does ). VB.NET has a media player control you just drop into a form and it works.
Christian Graus Driven to the arms of OSX by Vista.
-
yes i know how that works, but im doing this for my college and they require VB 6. anything you can suggest regarding my problem..?
V.G wrote:
but im doing this for my college and they require VB 6.
I'd start looking for a new university to go to. Something that doesn't teach you to use technology that's long been dead now. Notifications come to you through window messages. You have to override the message handler (WndProc in a VB.NET app) and pick out the MCI message you get. VB6 and VB.NET will not automagically do this for you and create an event out of something it knows nothing about. So, you have to write the code to catch the message and generate the event. Sorry, I don't have any VB6 examples of this. I stopped using VB6 7 years ago. I did manage to find this example[^] that might help you do this...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008