DShow Sample Code for playing video does not play the video MSDN C++ -


i referring example program provided here run video file, in case mp4 format using dshow.

refer complete code:

#include <dshow.h> #pragma comment (lib, "strmiids.lib") void main(void) {     igraphbuilder *pgraph = null;     imediacontrol *pcontrol = null;     imediaevent   *pevent = null;      // initialize com library.     hresult hr = coinitialize(null);     if (failed(hr))     {         printf("error - not initialize com library");         return;     }      // create filter graph manager , query interfaces.     hr = cocreateinstance(clsid_filtergraph, null, clsctx_inproc_server,                          iid_igraphbuilder, (void **)&pgraph);     if (failed(hr))     {         printf("error - not create filter graph manager.");         return;     }      hr = pgraph->queryinterface(iid_imediacontrol, (void **)&pcontrol);     hr = pgraph->queryinterface(iid_imediaevent, (void **)&pevent);      // build graph. important: change string file on system.     hr = pgraph->renderfile(l"c:\\example.avi", null);     if (succeeded(hr))     {         // run graph.         hr = pcontrol->run();         if (succeeded(hr))         {             // wait completion.             long evcode;             pevent->waitforcompletion(infinite, &evcode);              // note: not use infinite in real application, because             // can block indefinitely.         }     }     pcontrol->release();     pevent->release();     pgraph->release();     couninitialize(); } 

however when build program, build sucessful when run it, console window pops , disappears within second.

i referred comments on same page , many others faced same issue. few able run program.

what doing wrong?

is type of project selecting? selecting win32 console application. should select else? or there else doing wrong?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -