Need to convert C# code to C (System32) Wrapper (dll)

subba's Avatar, Join Date: May 2008
Newbie Member

I got to write a wrapper in C to make use of winmm.dll. There is another application, which will use C wrapper to call winmm API's.

Here is the C# code, can some body help me in converting to C code, I got to have this as dll. so I'm using system32 app.


private static extern long mciSendString(

string strCommand,

StringBuilder strReturn,

int iReturnLength,

IntPtr oCallback);


public void OpenMediaFile(string strFileName)


PlayCommand = "Open \"" + strFileName + "\" alias MediaFile";

mciSendString(PlayCommand, null, 0, IntPtr.Zero);

isOpen = true;



public void PlayMediaFile(bool loop)


if (isOpen)


PlayCommand = "Play MediaFile";

if (loop)

PlayCommand += " REPEAT";

mciSendString(PlayCommand, null, 0, IntPtr.Zero);


this is the code I have written, but incomplete

long __declspec(dllimport) __stdcall mciSendStringA(char*, char *, int ,int *);

int PlayMediaFile()


int out = 0;

mciSendStringA("Play MediaFile", "", 0, &out);

return 0;


I appreciate if someone help me here.


Last edited by shabbir; 12May2008 at 09:51.. Reason: Code block
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Please use code block when you have code in the post