A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[C#] Play Song or Movie without Media Player

1.5k views · started by Chad ·
#1
[C#] Play Song or Movie without Media Player
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength,
IntPtr hwndCallback);

Would go up top some where. Need using System.Runtime.InteropServices;

    mciSendString("open \"" + File_To_Play + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
mciSendString("play MediaFile", null, 0, IntPtr.Zero);


Goes in the play button and what not.

    mciSendString("close MediaFile", null, 0, IntPtr.Zero);

Stop playing.
#2
How exactly would you view the video?
#3
MattSmith wrote:
How exactly would you view the video?


Not exactly sure. You would probably have to make that function. I only figure this out this morning.
#4
That's cool.
Watching the video would be even awesome-er. Might want to do some research on how media players work before going into that, though.