I don't know how to really ask this but in short I am trying to make a Slide Show....

This is a discussion on I don't know how to really ask this but in short I am trying to make a Slide Show.... within the Windows Programming forums, part of the Platform Specific Boards category; I want to make a picture slide show that is going to be used as an .exe on an enhanced ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    131

    I don't know how to really ask this but in short I am trying to make a Slide Show....

    I want to make a picture slide show that is going to be used as an .exe on an enhanced CD. (FYI this is being done in Visual C++ 2003) My main goal is to have a form with two buttons on it i.e. Next and Back. Upon clicking on each button it will cycle foward or backwards through a list of pictures that are displayed in a picturebox control. The thing that is throwing me for a curve is the whole concept of a list of pictures. I have never done anything like that and I am not sure if I am even correct in thinking that this is how this should be done. Can anyone offer up some advice as far as if this is how I should attempt to do this, or better yet lead me to an example.

    Thanks,

    Chad

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Do you need the pictures to be in the .EXE ? Or are they loaded at run-time from a folder?

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    They are loaded at run-time from a folder........

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    How many different picture formats do you need to support?

    Anything else you want this application to do?

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Only one picture format (JPEG). Like I said i only want it to have two buttons controls. One that will advance through the list of pictures (Next) and one that will step back through the list of pictures (Back).

  6. #6
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    This could be done quite easily, although you'd need to specify Windows 98 as a minimum requirement (Windows 95 doesn't have the builtin JPEG functionality, at least not unless you wanna get into OLE pictures... ). Or did you have broader platform support in mind?

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    I was shooting for 98/xp requirment.....

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by SMurf
    This could be done quite easily,

    Can you please explain further or maybe give an example. I understand the idea but actually doing it is confusing. I know I want to setup a form with a picturebox control and two button controls. I then when to capture the click (event handler) of both buttons and have them call a function which will cycle through a list of pictures. Is this correct? Should there be two functions, one to cycle foward and one cycle back?

    I know how to build the form and capture the click for the buttons, but the actual function with the "list of pictures" is cofusing me. Anyone want lend a hand.....

    Thanks

    Chad
    Last edited by chadsxe; 08-11-2005 at 08:10 AM.

  9. #9
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Calm down, calm down. Let's get your design all worked out and in the open first before we touch code.

    About this list of pictures that you're taking from a folder, do you want to store the list in e.g. a text file along with the pics or do you want to use file system searching functions to find all the pics in the folder (This would mean that you could just throw pics into the folder and won't have to change anything else)?

  10. #10
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by SMurf
    About this list of pictures that you're taking from a folder, do you want to store the list in e.g. a text file along with the pics or do you want to use file system searching functions to find all the pics in the folder (This would mean that you could just throw pics into the folder and won't have to change anything else)?
    What would be the advantages of storing them in a text file?

    I would like to have a folder called images in my "program folder". The images are already decided upon and do not need to be changed, added, or deleted from this folder.

  11. #11
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Well in that case, it's probably easiest to just have a global array of strings, e.g.:-
    Code:
    char *g_szFilenames[3] = { "C:\\image1.jpg", "C:\\image2.jpg", "C:\\image3.jpg" };
    On top of that, have a global integer to store the index of the current filename to use...
    Code:
    int g_iCurrentFile = 0;
    Then in your back/next button handlers, decrement/increment this integer and then call a function to load the file.

    As for loading a JPEG, I've actually tried doing it myself and the easiest way to do it is using an OLE Picture (As you do in Visual Basic, I believe ). My function is 15 lines, although it was a lot longer before I read through MSDN and found OleLoadPicturePath!

    But see if you can do your program with bitmaps first, then we'll talk.

  12. #12
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    easiest would be GDI+. And i would make it 4 buttons not 2, as you will prolly want a faster,slower mechanism. for reading the files i would use FindFirstFileEx and FindNextFile and just filter out the .jpg's
    Last edited by Stoned_Coder; 08-11-2005 at 06:52 PM.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  13. #13
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by SMurf
    Well in that case, it's probably easiest to just have a global array of strings, e.g.:-
    Code:
    char *g_szFilenames[3] = { "C:\\image1.jpg", "C:\\image2.jpg", "C:\\image3.jpg" };
    I am guessing when you say C:\\image1.jpg you are talking about the directory the image is in correct? If so what happens the directory gets changed. Like I said the images will be stored in an image folder in side the project folder. Will it remain constant when the project foler is moved around.


    As for loading a JPEG, I've actually tried doing it myself and the easiest way to do it is using an OLE Picture (As you do in Visual Basic, I believe ). My function is 15 lines, although it was a lot longer before I read through MSDN and found OleLoadPicturePath!

    But see if you can do your program with bitmaps first, then we'll talk.
    I am going to try and do this with bitmaps before anything else. I am still a little confused about something. I have a form with two buttons and a picture box. How do I load diffrent images into that picture box. I understand storing the directory paths in the array and making a intger to store the index but the actuall loading part is now throwing me for a curve.

    By the way thanks to all that are helping....

    Chad

  14. #14
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Picture box...? You're using Visual Basic terminology here, which is distracting.

    Have you made a dialog in the dialog editor? If so, then you'll probably have a static control for displaying pictures. To load a bitmap into it in code:-
    Code:
    HBITMAP hbmp;
    
    hbmp = LoadImage(NULL, "C:\\image1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    SendDlgItemMessage(hDlg, IDC_PICTURE, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
    Where hDlg is the handle to the dialog and IDC_PICTURE is the identifier of the static control, if you check its properties it should be visible.

  15. #15
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    I am obviously completly lost and am on a totally diffrent page then you are. So with that said if you don't mind please have a look at what I have (which is basicly nothing).....
    Code:
    #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
     
    
    namespace SlideShow
    {
    	// I think this array is suppose to hold the the location of the three .bmp 
    	char *g_szFilenames[3] = { "C:\\image1.bmp", "C:\\image2.bmp", "C:\\image3.bmp" };
    	// This will store the index of the filename in use
    	int g_iCurrentFile = 0;
    
    
    	/// <summary> 
    	/// Summary for SlideShowMain
    	///
    	/// WARNING: If you change the name of this class, you will need to change the 
    	///          'Resource File Name' property for the managed resource compiler tool 
    	///          associated with all .resx files this class depends on.  Otherwise,
    	///          the designers will not be able to interact properly with localized
    	///          resources associated with this form.
    	/// </summary>
    	public __gc class SlideShowMain : public System::Windows::Forms::Form
    	{
    	public: 
    		SlideShowMain(void)
    		{
    			InitializeComponent();
    		}
            
    	protected: 
    		void Dispose(Boolean disposing)
    		{
    			if (disposing && components)
    			{
    				components->Dispose();
    			}
    			__super::Dispose(disposing);
    		}
    	private: System::Windows::Forms::PictureBox *  pictureBox1;
    	private: System::Windows::Forms::Button *  button1;
    	private: System::Windows::Forms::Button *  button2;
    
    	private:
    		/// <summary>
    		/// Required designer variable.
    		/// </summary>
    		System::ComponentModel::Container* components;
    
    		/// <summary>
    		/// Required method for Designer support - do not modify
    		/// the contents of this method with the code editor.
    		/// </summary>
    		void InitializeComponent(void)
    		{
    			System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(SlideShow::SlideShowMain));
    			this->pictureBox1 = new System::Windows::Forms::PictureBox();
    			this->button1 = new System::Windows::Forms::Button();
    			this->button2 = new System::Windows::Forms::Button();
    			this->SuspendLayout();
    			// 
    			// pictureBox1
    			// 
    			this->pictureBox1->Image = (__try_cast<System::Drawing::Image *  >(resources->GetObject(S"pictureBox1.Image")));
    			this->pictureBox1->Location = System::Drawing::Point(104, 40);
    			this->pictureBox1->Name = S"pictureBox1";
    			this->pictureBox1->TabIndex = 0;
    			this->pictureBox1->TabStop = false;
    			// 
    			// button1
    			// 
    			this->button1->Location = System::Drawing::Point(32, 168);
    			this->button1->Name = S"button1";
    			this->button1->TabIndex = 1;
    			this->button1->Text = S"button1";
    			this->button1->Click += new System::EventHandler(this, backButton);
    			// 
    			// button2
    			// 
    			this->button2->Location = System::Drawing::Point(184, 168);
    			this->button2->Name = S"button2";
    			this->button2->TabIndex = 2;
    			this->button2->Text = S"button2";
    			this->button2->Click += new System::EventHandler(this, nextButton);
    			// 
    			// SlideShowMain
    			// 
    			this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
    			this->ClientSize = System::Drawing::Size(292, 273);
    			this->Controls->Add(this->button2);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->pictureBox1);
    			this->Name = S"SlideShowMain";
    			this->Text = S"SlideShowMain";
    			this->ResumeLayout(false);
    
    		}		
    	private: System::Void backButton(System::Object *  sender, System::EventArgs *  e)
    			 {//This will be used to cycle back 
    			 }
    
    	private: System::Void nextButton(System::Object *  sender, System::EventArgs *  e)
    			 {//This will be used to cycle foward
    			 }
    
    	};
    }
    This is obviously my .h file. My .cpp file is set up to initalize this and it works perfect so no worries there. Along with a folder that holds three .bmp, these files are stored together in one "program folder".

    At this point with what I have gathered I need to increment or decrement using my int through the array in each the backButton Event Handler or the nextButton Event Handler. Is this correct?

    As far as loading the .bmp into the "pictureBox" (sorry for thermonolgy) I still am lost.

    Am I on the correct track....

    This is a lot harder then I thought it was going to be and I am sorry for being so retarded. I really appreciate all the help you have given me.

    Thanks

    Chad

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Make a dialog show up
    By guitarist809 in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2008, 01:08 AM
  2. unable to recieve UDP packet
    By caroundw5h in forum Networking/Device Communication
    Replies: 15
    Last Post: 09-19-2007, 11:11 AM
  3. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  4. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  5. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21