I'm rather new to OpenCV, and I have this simple code to play a video clip:

#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
	cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
	CvCapture* capture = cvCreateFileCapture( argv );
	IplImage* frame;
		frame = cvQueryFrame( capture );
		if( !frame ) break;
		cvShowImage( "Example2", frame );
		char c = cvWaitKey(33);
		if( c == 27 ) break;
	cvReleaseCapture( &capture );
	cvDestroyWindow( "Example2" );
But, it only plays SOME codecs and file extentions (such as MJPG and DivX codecs of .avi file). What should I do to be able to play other types of files. I've wasted many hours on it, and I couldn't find a way. I'll appreciate any type of help! (should I install some codecs, or use a *.dll or #include something? how?) (I can play them with media player but not with my code.)
p.s.: I need to open these filetypes: avi (DivX, Xvid, uncompressed), flv, wmv, mpg.