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

Discussion in 'C' started by subba, May 12, 2008.

  1. subba

    subba New Member

    Joined:
    May 12, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    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.

    -----------------------------------------------------------------------------------------------------------------------------------------------------
    Code:
    [DllImport("winmm.dll")]
    
    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

    ---------------------------------------------------------------------------------------------------------
    Code:
    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.



    thanks,
     
    Last edited by a moderator: May 12, 2008
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Please use code block when you have code in the post
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice