Attach Windows/Buttons To Diff DC's

This is a discussion on Attach Windows/Buttons To Diff DC's within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to attach several buttons to several HDC's? I've got it to work with text, as TextOut() outputs ...

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

    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!

    thanks

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    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.
    zen

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    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.
    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;
    }

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    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, 11:11 AM
  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

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