Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Need to convert C# code to C (System32) Wrapper (dll) (http://www.go4expert.com/forums/convert-c-sharp-code-c-system32-wrapper-t10543/)

subba 12May2008 08:29

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

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 vc++.net 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.


shabbir 12May2008 09:51

Re: Need to convert C# code to C (System32) Wrapper (dll)
Please use code block when you have code in the post

All times are GMT +5.5. The time now is 22:49.