Apply style to multiple windows

This is a discussion on Apply style to multiple windows within the Windows Programming forums, part of the Platform Specific Boards category; I am making a small application using Winapi in which there are several windows and I need to apply customized ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59

    Smile Apply style to multiple windows

    I am making a small application using Winapi in which there are several windows and I need to apply customized styles(fonts,window size etc) to all of them. Any ideas on how should I proceed without doing this for each window separately?
    Thanks in advance..

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You do each window separately.

    What I do is keep a global array of all my window handles. Then if I need to make a change --like switching fonts-- I can manipulate them all in a very simple loop.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59
    Ok.. btw I got to know that there is something called "Framework" that can be used for this.. but being a beginner I can't create it now,, so I will do it separately for all windows as you suggested..

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by gaurav_13191 View Post
    Ok.. btw I got to know that there is something called "Framework" that can be used for this.
    Not at the winapi level there isn't...

    To get access to such higher level muppingsnarf you need to be running one of way too many 3rd party libraries.

    And, in their guts, these libraries are probably doing exactly what you're doing... using loops, switches, etc...

  5. #5
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59
    Ok.. I don't know anything about Frameworks, just heard it from my colleague, I will not be using them,

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    GetWindowLongPtr() with GWL_STYLE and GWL_EXSTYLE to 'copy' the window style out of one window.

    SetWindowLongPtr() can be used to 'push' this style into another window.

    I use C++ and create an app Dialog/Window class (which I derive all other windows from) to ensure all the apps screens look similar (it also handles skinning, fonts, icons etc).
    "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. Replies: 6
    Last Post: 10-29-2010, 10:39 AM
  2. How to apply selection sort in a two-dimensional array
    By yigster in forum C++ Programming
    Replies: 16
    Last Post: 04-28-2010, 11:56 AM
  3. multiple windows
    By Dark_Phoenix in forum Windows Programming
    Replies: 4
    Last Post: 12-08-2008, 02:11 AM
  4. Windows XP visual themes and style changing
    By bennyandthejets in forum Windows Programming
    Replies: 15
    Last Post: 10-03-2003, 10:49 AM
  5. How to change Windows Style
    By sean345 in forum Windows Programming
    Replies: 8
    Last Post: 07-30-2002, 03:06 PM

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