Thread: Movie Program?

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    7

    Movie Program?

    ok yes i am a n00b at C++, i am wondering how i would have a full screen movie to play in a exe file. Could anyone tell me please?

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    What? By fullscreen movie I am assuming you mean just run an exe in a fullscreen mode.
    http://cboard.cprogramming.com/showt...ght=fullscreen
    Woop?

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    like i wanna creat a .exe file that is in fullscreen and plays a movie. IM creating a game and im using this for a cinimatic. The files are a .wmv

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Good luck with that. No offense that is a pretty difficult task
    Woop?

  5. #5
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Since wmv files are Windows Media Videos, you will most likely have to use MFC or Win32, I personally hate MFC and really like Win32. Anyways, I found this tutorial here. Unfortunately the tutorial uses MFC, but oh well. If you are a noob to C++ then I think you are not nearly ready to do this. You should get comfortable with C++ and maybe move into Win32 or, heaven forbid, MFC. Then try to take this on.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  6. #6
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    Take these guys advice, its a ........... Fortunately, DirectX comes with a nice wrapper class to handle playing videos for you, but a strong knowledge of Win32 is required. Check out DirectShow when you're ready.
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  7. #7
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I believe the recommended API for playing a movie is DirectShow. However, we can cheat by using the simpler MCI API. Here is a simple example that plays a video in a maximized window.
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    #if defined(_MSC_VER)
    #  pragma comment(lib, "Winmm.lib")
    #endif
    
    /*
     * Plays an WMV, AVI or MPEG video file.
     */
    BOOL xPlayVideo(LPCTSTR szFile)
    {
    	TCHAR szCommandString[500];
    
    	wsprintf(szCommandString, TEXT("open \"%.260s\" type mpegvideo alias MediaFile"), szFile);
    
    	/* By default mci functions will return immediately and the task will be carried out
    	 * asynchronously. To have the function wait, place the word "wait" at the end of the
    	 * command string. ie. "play MediaFile wait" */	 
    	if (ERROR_SUCCESS == mciSendString(szCommandString, NULL, 0, NULL) &&
    	    ERROR_SUCCESS == mciSendString(TEXT("window MediaFile text \"Game Intro\""), NULL, 0, NULL) &&
    	    ERROR_SUCCESS == mciSendString(TEXT("window MediaFile state show maximized"), NULL, 0, NULL) &&
    	    ERROR_SUCCESS == mciSendString(TEXT("play MediaFile"), NULL, 0, NULL))
    	{
    		return TRUE;
    	}
    
    	return FALSE;
    }
    
    int main(void)
    {
    	MSG msg;
    
    	if (!xPlayVideo(TEXT("C:\\PathTo\\YourVideo.wmv")))
    		printf("Failed to play video!");
    
    	/* We must run a message loop while the video window is open. */
    	while (GetMessage(&msg, 0, 0, 0) > 0)
    	{
    		TranslateMessage(&msg);
    		DispatchMessage(&msg);
    	}
    
    	return 0;
    }

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    what are you using as a complier? im using Dev-C++ and im getting errors on this code so

  9. #9
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    May I ask how deep your knowledge of C++ goes? Something a little more detailed than "I'm a n00b", because if you're creating a console game and have no knowledge of windows or game programming, then I'd say you're years off from creating a "cinematic".
    Sent from my iPadŽ

  10. #10
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    im creating the program in another programming language. I am completly new at C++. All i need C++ for is to play the video file straight away thenonce its finished to continue back into the first language i was dealing with. The cinimatics are an avi or wmv format therefore if i can get something to run the video then im good. can't have play button ormenu or fast forwards or anything just needs to play
    Last edited by blindstone; 11-06-2005 at 05:11 PM.

  11. #11
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    what language is the game in? Have you thought about playing the video in that language? DirectX has support for almost all windows programming languages so you might want to look into some DirectShow tutorials.
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  12. #12
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >> what are you using as a complier? im using Dev-C++ and im getting errors on this code so <<

    For Dev-C++, you need to link with the winmm library. You do this by adding "-lwinmm" to the linker box under Project->Project Options->Parameters (you need to create a new project and add the code as a C file, if you haven't already).

  13. #13
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    ok now i am getting

    " cannot find -lobjc
    ld returned 1 exit status
    C:\Dev-Cpp\Makefile.win [Build Error] [Project1.exe] Error 1 "

  14. #14
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    It's not -lobjc it's -lwinmm.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  15. #15
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    i know, i placed the -lwinmm into the linker box, but the error i am reciving now is:
    cannot find -lobjc
    ld returned 1 exit status
    C:\Dev-Cpp\Makefile.win [Build Error] [Project1.exe] Error 1

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. Memento movie
    By WayTooHigh in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-07-2001, 01:00 PM