Thread: In need of a synopsis...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    In need of a synopsis...

    Hi guys.

    I have a few questions, comments.

    Comment #1: Programming Windows Sucks!(Sorry, had to say it)

    Anyway, here is my current pradicament:

    I decided that in order to have a program with many different screens, I should take this approach:

    1) As usual, in WinMain, register and create a window called "hwnd".

    2) In "hwnd"s window procedure, create as many "screens" as needed, deriving them from "hwnd" as the parent. Hide all of them except for the Starting Screen.

    3) Derive button and other controls from these respective sub-parents.

    3) In say, the Starting Screens window procedure, depending on the users whim, (for the sake of illustration, let's say they pushed a button labeled "Next Screen"), and then:

    a) intercept the buttons message
    b) send a SendMessage() to the interested window (a WM_CREATE? a WM_PAINT? not sure which is better.)
    and hide the current window.
    c) The message is intercepted in the chosen screens window procedure and a ShowWindow() is called

    4) The process continues like this.





    In theory it sounds o.k., but my attempt is not functioning this way!

    It won't let me create the windows ahead of time and show them later.

    Anyway, Just some theory will do just fine. thanks
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Look up MDI (multiple document interface) in the help for creating multi screen win32 apps.

    Or just create all the windows at start and hide the ones you don't need. When the user selects to change windows hide the current ans show the new. Use ShowWindow().
    Don't send WM_CREATE or WM_PAINT, Create is closer but the code contained in the callback under create should execute when the dlg is created and your CreateWindows[Ex]() is called. WM_PAINT is right out of the question, will only draw to the screen.

    Do all your windows share the same CALLBACK. (probably do if you created them from the same class, I would change this). As you are going to have problems you will have to switch/case in each msg switch/case for the child window that sent the msg

    ie
    A window needs repainting
    in the WM_PAINT you will have to find WHICH window needs the paint from the HWND returned. So you will need a global/static array of all the windows HWNDs. Only then can you sent the right HDC to be drawn on to the paint function

    Remember KISS (keep it simple stupid)
    Last edited by novacain; 11-04-2001 at 11:44 PM.
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Database assignment is Killing me!
    By Boltrig in forum C Programming
    Replies: 2
    Last Post: 11-29-2007, 03:56 AM