473,327 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

help! need "translation" from C++

Hi,

I'm trying to play an AVI file from memory with MCI. The documentation is
great
if you want to play a file from a file but directly from memory... almost
nothing.

After hours of searching I found this:
http://support.microsoft.com/kb/q155360/
and after that:
http://binaryworld.net/Main/CodeDetail.aspx?CodeId=3780

Which describes how to do what I want... the problem is that the first code
is in C++ and the second in VB.

For the past few hours I've been trying to translate this into C# but
without any luck. This is what I have so far:

public const long MMIO_INSTALLPROC = 0x10000;
public const long MMIO_GLOBALPROC = 0x10000000;
public const long MEY = 0x2059454D;

[DllImport("winmm.dll")]
private static extern long mmioInstallIOProc(long fccIOProc,
MulticastDelegate pIOProc, long dwFlags);

long retVal = mmioInstallIOProc(MEY, new CallbackDelegate(IOProc),
MMIO_INSTALLPROC | MMIO_GLOBALPROC);

private long IOProc(ref MMIOINFO lpMMIOInfo, long uMessage, IntPtr lParam1,
IntPtr lParam2)
{
.....
}

// NOTE1: I found the definition of MMIOINFO on the second link
Everytime I try calling mmioInstallIOProc I get this warning:
"A call to PInvoke function 'Media!MMedia.Media::mmioInstallIOProc' has
unbalanced the stack. This is likely because the managed PInvoke signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature."

I continue execution and see that the movie isn't loaded...

Could someone PLEASE help me with correct "translations" of these methods?

Thank you,
sačo
Apr 18 '06 #1
4 1975
"Sačo Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:e2**********@planja.arnes.si...
Could someone PLEASE help me with correct "translations" of these methods?


Use int (or Int32) instead of long. Long is 64 bits but the functions are
most likely expecting 32 bits.

You should be using direct show for this now as MCI is very old now.

Michael
Apr 19 '06 #2
Changing from long to int didn't help... I still get the same result...

As for the the second suggestion. Doesn't this mean that the user has to
have directx installed on his machine? I don't like this idea very much
since
this means that before the user could use my little player (100kb) he would
have to install 50MB of stuff (.net framework + directx)...

"Michael C" <no****@nospam.com> wrote in message
news:OE**************@TK2MSFTNGP02.phx.gbl...
"Sačo Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:e2**********@planja.arnes.si...
Could someone PLEASE help me with correct "translations" of these
methods?


Use int (or Int32) instead of long. Long is 64 bits but the functions are
most likely expecting 32 bits.

You should be using direct show for this now as MCI is very old now.

Michael

Apr 19 '06 #3
"Sačo Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:e2**********@planja.arnes.si...
Changing from long to int didn't help... I still get the same result...
Some other parameter must be incorrect in length then or you have too many
params. Did you change the definition of the import or just the consts? Do
you need to use a multicast delegate? I'm not sure what effect this will
have but it might cause a problem.

As for the the second suggestion. Doesn't this mean that the user has to
have directx installed on his machine? I don't like this idea very much
since
this means that before the user could use my little player (100kb) he
would
have to install 50MB of stuff (.net framework + directx)...


That's true.

Michael
Apr 19 '06 #4
The first parameters are OK I think the problem might be with the delegate.
you asked about the multicast delegate...
I used it because I saw an example like this on the internet...
What other kind of delegate could I use to pass a callback function to that
method?

sačo

"Michael C" <no****@nospam.com> wrote in message
news:ei**************@TK2MSFTNGP05.phx.gbl...
"Sačo Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:e2**********@planja.arnes.si...
Changing from long to int didn't help... I still get the same result...


Some other parameter must be incorrect in length then or you have too many
params. Did you change the definition of the import or just the consts? Do
you need to use a multicast delegate? I'm not sure what effect this will
have but it might cause a problem.

As for the the second suggestion. Doesn't this mean that the user has to
have directx installed on his machine? I don't like this idea very much
since
this means that before the user could use my little player (100kb) he
would
have to install 50MB of stuff (.net framework + directx)...


That's true.

Michael

Apr 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: Steven Green | last post by:
I need some help to get a training grant. If you are responsible for hiring Oracle professionals please read on. I want to become an Oracle DBA and am seeking to take a DBA certificate program....
4
by: Scott Holland | last post by:
HELP - Need to connect to DB2 database on AIX from NT server. Also AS/400 from NT Server -- I am experienced in ORACLE and a novice at DB2. What tools would be the equivalent of Net*8 or...
1
by: Dhiraj | last post by:
hello, everybody, this is Dhiraj here. I need help urgently, as i am getting error on my web page. The error is "Microsoft JET Database Engine error '80004005'" whenever i want to open links of...
3
by: amanda | last post by:
Hope someone can help me with this - I've been staring at it stupidly for hours now, convinced there must be an easy way to achieve the results I want: I have a very large table recording every...
2
by: Pasacco | last post by:
dear I want to ask help on this problem. Array a is partitioned into a0 and a1 in main(). Then a1 is partitioned into a2 and a3 in th_partition() function. And I think this problem is something...
5
by: Chad A. Beckner | last post by:
Hey all, I know this has been done using C++ (I have one with source code), but I don't know C++ that well. Does anyone know of a C++ to C# converter? - OR - does anyone know to to retrieve a...
2
by: M Skabialka | last post by:
I installed Visual Studio Beta 2005 but setting up the SQL server was so complex I uninstalled it and put Visual Studio 2003 Academic on. I am totally new to Visual Studio and trying to teach...
4
by: Web_PDE_Eric | last post by:
I don't know where to go, or what to buy, so plz re-direct me if I'm in the wrong place. I want to do high performance integration of partial differential eqns in n dimensions (n=0,1,2,3..etc) I...
0
by: riflefire | last post by:
Hello Everyone, I am using the new MITE c# text game engine to code up a MUD style game. I need a lot of help as i am new to C#. The reason i need the help is that the engine requires c# scripts to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.