Thread: Embedding a window within a dialog window

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    1

    Embedding a window within a dialog window

    Hi,

    I want to create an application that has one main window, and within it I would like to be able to embed two windows, that will be a fixed size, this is so i can display camera feed to it.

    Is it possible to achieve this?

    Thank you

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Create your two other windows as children of your main window.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Do you want the camera feeds to be moveable or just remain where they are on screen?

    You can create a control (as a child of the main window) like a frame or rectangle, create it a memory DC and draw to it.

    or

    create a seperate dialog (as a child if required) and process the size and move messages of the main window to keep it in place. ie if the main window moves you move the video feed window. Create it a memory DC and draw to it.

    or

    just draw the cameras image directly to the main windows DC, no other controls required. Double buffering will probably be required to prevent flickering. See the recent thread about bitmaps not redrawing for a link to code or search here for many examples.


    *DC == device context
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    On a similar topic, how would one go about creating a window that acts and behaves like a dialogue box (pops up and is modal) but is *not* actually a dialogue box ?

  5. #5
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Quote Originally Posted by @nthony
    how would one go about creating a window that acts and behaves like a dialogue box (pops up and is modal) but is *not* actually a dialogue box ?
    Disable the parent window when you show the "fake" dialog window.

    Code:
    EnableWindow( parentWindow, FALSE );
    Then run the following message loop to handle tabbing.

    Code:
    while ( GetMessage( &msg, NULL, 0, 0 ) > 0 ) {
      if ( !IsDialogMessage( hwndFakeDialog, &msg ) ) {
        TranslateMessage( &msg ) ;
        DispatchMessage( &msg );
      }
    }

  6. #6
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    excellent thanks!
    also, will both fake-dialog and parent window maximizie/minimize/restore together and share the same taskbar icon?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM