Thread: Attach Windows/Buttons To Diff DC's

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas

    Attach Windows/Buttons To Diff DC's

    Is it possible to attach several buttons to several HDC's?

    I've got it to work with text, as TextOut() outputs to an HDC, but I've no idea how to make that work with a window. I've tried several different hacks, but as they say, "no workie".

    For instance, I tried declaring a new HDC variable, with the intention of trying to cast it to an HWND in CreateWindow(), but of course that made little sense and didn't work.

    I tried earlier on to declare several separate HWND's, children to none, but the results were buggy at best. Anyway, if anyone knows if this can be done, it would enable me to more easily show-and-hide windows/buttons!


  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    I'm not sure what you're trying to do but if you just want to show/hide different windows, the you can call ShowWindow(), with the HWND and either SW_HIDE or SW_SHOW depending.

    If this isn't what you want to do, then you can have Windows allocate a seperate DC for each window by creating the WNDCLASS with the CS_OWNDC style. You can obtain this DC in the normal way, but Windows will maintain it so that any changes are saved for each window.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    Thanks, your second suggestion sounded close to my requirements. See, at present, I am grouping "families" of buttons as arrays, and use my function ShowWindowArray() to show/hide them with relative ease. The problem is, the more groups I add to a given "screen", the less automated the process is. Ultimately,I would like to just swap the "current" DC with the "prev" DC with a single pointer as I do now with text. Anyway, I will try that out, thanks.
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  4. #4
    train spotter
    Join Date
    Aug 2001
    near a computer
    I'm not sure I understand 100% but...

    If you have a dialog and want to put different groups of buttons on it depending on what function the user is performing. Say for a config screen.

    Try a TAB control. On to each seperate TAB draw the button groups. The user then can select the group they want.

    You can even paste dialogs onto the TAB's. Create a complicated button filled dlg in the resource editor.
    Create the TAB screen and button dlg's, hiding the button dlg's from view.
    When the TAB is changed hide the current button dlg and show the new one, setting its position over the TAB screen.
    "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. diff parser
    By ngloosh in forum C Programming
    Replies: 9
    Last Post: 06-19-2008, 12:19 PM
  2. why does this code do something diff on 2 diff boxes?
    By crypto_quixote in forum C Programming
    Replies: 3
    Last Post: 03-08-2005, 12:11 PM
  3. whats the diff?
    By Moffesto in forum C# Programming
    Replies: 2
    Last Post: 06-19-2002, 02:23 AM
  4. Diff compiler == diff program????
    By Imperito in forum C++ Programming
    Replies: 21
    Last Post: 04-25-2002, 12:50 PM