how do you write a "wrapper" for vb.net in vc++ ? (to embed windows media player)

M

Mad Scientist Jr

I need to embed windows media player in my pocket pc app, and be able
to make it play/pause an mp3 file, and also read the play time (the
min/sec the file is currently paused at). .. i found an faq from MS ,
the excerpt below says you need to use eVC to write a "wrapper" so you
can call WMP for pocket pc from eVB (i assume... that is -HOPE- this
still holds true for VC++/VB.NET for Smart Devices). Anyway, using
VS.NET 2003, can someone outline how to write a wrapper to access WMP
7.1 (which works on my Pocket PC 2000 iPAQ, not sure if WMP 9 would
work) from my Pocket PC program? i am not a c or c++ programmer but I
suppose with the right guidance I can hack this wrapper together and
compile to a DLL. any help appreciated ! and your karma will improve
tenfold!


eMbedded Visual Basic

Q: How can I automate the MediaPlayer from eVB?

A: Unfortunately, eVB cannot automate the MediaPlayer. There are a
couple of alternatives to play media files from eVB:

1. Launch the MediaPlayer with the CreateProcess API with the media
file
as one of the command line parameters.

2. If you're just playing a .wav file, use the PlaySound API.

3. There is a Windows Media Player for Pocket PC SDK available on the
Microsoft website. Unfortunately, it does not support usage directly
from
eVB. There is an eVC sample that downloads with the SDK: "The SDK
also
includes a code sample that demonstrates how to embed the control in a
custom C++ program using Microsoft eMbedded Visual C++®." So you
could
conceivably wrap it in eVC and expose it to eVB.
 
C

Chris Tacke, eMVP

It's going to require COM interop, and if you're not a C++ programmer, I'll
let you know you're in for a long haul. You might look at the CFCOM
offering from Odyssey.
 
E

Emma Gumbdough

argh. they don't sell a CFCOM for only the WMP control, you have to buy
the whole thing, which is $400-500 for the minimum # of licenses. that's
too egg-spensive... how hard can it be to write this in c++? i just want
to be able to play/pause a darned mp3 file, and when it's paused, be
able to read the time it is paused at.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
P

Paul G. Tobey [eMVP]

How hard can it be to learn COM? Hmmm. Well, pretty hard, in general. You
can probably get something kind of working in a couple of days, but it's
likely to have memory leaks and other problems with it. If this is for a
commercial product, buy CFCOM; you've already used up enough time to pay for
it just posting questions. If it's non-commercial, think about how you
might live without embedding the media player in your application.

Paul T.
 
C

Chris Tacke, eMVP

If you're not a C++ programmer it could take you a year. If you are a
novice, 6 months. An expert, a month. And that's just for media player.
If you want to replicate CFCOM, probably double or better.

-Chris
 
E

Emma Gumbdough

If it's non-commercial, think about how you
might live without embedding the media player in your application

well this is a noncommercial project that i would probably put up on
tucows when it's done. it's mainly for my personal use and actually is
pretty important to me but i wouldn't be making any $ off of it

i need the easiest way to play/pause an mp3 file, get the time it's
paused at, and also it would be nice to be able to jump ahead/back to a
specific time and read the total time of the file.

i'm not a novice, but i'm nowhere near an expert, programmer. the
quicker/dirtier/easier i can get this done the better.

as is i have my hands full just reading about how to play a wav file let
alone record a simple voice memo
(
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetco
mp/html/WaveInOut.asp )

i can't BELIEVE no one makes a simple programmable mp3 player for pocket
pc. that would seem like such a popular thing. . .

well thanks anyway



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
C

Chris Tacke, eMVP

I'd think WinAmp or something would be available. There are surely
open-source mp3 codecs out there, just probably no managed versions.

-Chris
 
E

Emma Gumbdough

Hmm... WinAmp would be great! But will it run on Pocket PC? ANYTHING
would be great. Is there a planetsourcecode for Pocket PC VB.NET apps?


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
M

Mad Scientist Jr

How hard can it be to learn COM? Hmmm. Well, pretty hard, in general.

here we are in 2004 and it's like writing a graduate thesis just
trying to get a pocket pc to record a stupid wav file. isnt this stuff
supposed to get EASIER as technology advances?!!! :^O

I'm trying to make sense of

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/WaveInOut.asp

and convert it to vb.net which is proving a daunting enough task as it
is.

for instance, what the hell is a MMSYSERR

public MMSYSERR Init(uint bufferLength, bool init)

if anyone ambitious and is reading this, there is money to be had by
bringing simple programming tasks such as recording a voice memo TO
THE PEOPLE!

:)
 
M

Mad Scientist Jr

ok, back to square one, i have a naive question. why can't the methods
and properties in the wmp.dll be exposed with a bunch of statements
like this:

Public Declare Function PlaySound Lib "coredll.dll" Alias "PlaySoundW"
(ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As
Long) As
Long

??

also, where are the methods/properties for wmp documented?

thanks
 
P

Paul G. Tobey [eMVP]

PlaySound() is *not* a method. A "method" is defined as a functional
attribute of an object. There's no object-orientation associated with
PlaySound(). It's a procedural call. ActiveX controls (and all COM
objects), define a particular interface by where a C++ program would expect
to find a table of the object's methods. No doubt CFCOM does something with
this and implements things as you describe, but it's not as simple as
defining an interface to a DLL-exported function because COM objects don't
export those functions from a DLL.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top