locked
Invoke windows media player RRS feed

  • Question

  • Hi all,

              I develop the application for playing amr and 3gp files. When i click the media file the windows media player automatically open and play the clicked file. How to invoke the media player programatically for playing the media files.. I search lot in the web.. pls give some ideas and samples for the above problem..

    Thanks in advance...
    Friday, October 24, 2008 7:21 AM

Answers

All replies

  •  

    check the DirectShow API for windows mobile
    Friday, October 24, 2008 12:44 PM
  • Hi, azad

    You may also use the ShellExecuteEx function or CreateProcess function to start the Media Player (“wmplayer.exe”), with the path to the media file as an argument.

    Sample code can be found from the following thread (It’s for desktop but still applies):

    http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/78910546-0863-45d4-83ad-8238743e1448/

     

    Regards,

    Chunsheng Tang

     

    Wednesday, October 29, 2008 2:08 AM
  • Hi,

           Thanks for ur reply.. I need to open the windows media player in windows mobile not in win32 application. The ShellExecuteEx API is not available under windows mobile platform. Is ther any API available for open the media file in windows media player?




    Wednesday, October 29, 2008 6:28 AM
  •  

    >>ShellExecuteEx API is not available under windows mobile platform

    ShellExecuteEx is available in the Windows Mobile platform. See this:

    http://msdn.microsoft.com/en-us/library/aa923541.aspx 

    Besides, you may also use CreateProcess:

    http://msdn.microsoft.com/en-us/library/ms885182.aspx

    Wednesday, October 29, 2008 9:59 AM
  • Hi,

                 thanks for ur reply.. i had follow the above link.. Its working for me..

    i use this code

    SHELLEXECUTEINFO sei;

    memset(&sei, 0, sizeof(sei));

    sei.cbSize = sizeof(sei);

    sei.fMask = SEE_MASK_NOCLOSEPROCESS;
    sei.hwnd = 0;
    sei.lpVerb = _T("Open");
    sei.lpFile = _T("wmplayer.exe");
    sei.lpParameters = _T("audio.wav");
    sei.lpDirectory = 0;
    sei.nShow = SW_SHOW;
    sei.hInstApp = 0;

    err = ShellExecuteEx(&sei);


    I have doubt in how to close the media player by progrmatically..

    After execution from shellExecuteEX() API i got the sei.process handle.. using this how to colse the windows media player or is any other way available to close?
    Thursday, October 30, 2008 5:53 AM
  • Pass the handle of the wmp process to the TerminateProcess function:

    http://msdn.microsoft.com/en-us/library/aa450927.aspx

    Thursday, October 30, 2008 10:46 AM
  • thank you tang..
    Thursday, October 30, 2008 11:59 AM