Thread: Good Looks?

  1. #1
    A source of questions... Benji Wiebe's Avatar
    Join Date
    Mar 2011
    Location
    Durham, Kansas
    Posts
    69

    Cool Good Looks?

    I am making a simple GUI program. I would like it to look like it belongs to Windows 7.
    Instead, it looks like it belongs to Windows 98.
    This is what it looks like:
    Good Looks?-what-jpg
    This is what it is supposed to look like:
    Good Looks?-what-should-jpg
    I would like the buttons to be nicely rounded and the combobox filled in and solid-looking.
    Is there any way I can change that?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    To get the visual styles you need to add a manifest to the program's resources...
    The usual form for the manifest is this...
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity type="win32"
                        name="Put Your Program Name Here"
                        version="1.0.0.0"
                        processorArchitecture="X86" />
      <description>
        Brief Program Description Here 
      </description>
      <dependency>
        <dependentAssembly>
          <assemblyIdentity type="win32"
                            name="Microsoft.Windows.Common-Controls"
                            version="6.0.0.0"
                            processorArchitecture="X86"
                            publicKeyToken="6595b64144ccf1df"
                            language="*" />
        </dependentAssembly>
      </dependency>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel  level="asInvoker" 
                                      uiAccess="false" /> 
          </requestedPrivileges>
        </security>
      </trustInfo>
    </assembly>
    Note that I've marked the parts you will need to edit for your particular program.
    The first line name= is the program's name without extencion.... MyProgram.exe becomes "MyProgram"
    The description is limited to 64 Characters ... eg. "Punch Clock"
    The version stuff is obvious... your program's current version.

    EDIT... almost forgot... you also need to use InitCommonControls() at the top of your program... before creating any dialogs or windows.
    Last edited by CommonTater; 05-05-2011 at 04:20 PM. Reason: add link...

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    EDIT: See CommonTater's, it's better.
    Devoted my life to programming...

  4. #4
    A source of questions... Benji Wiebe's Avatar
    Join Date
    Mar 2011
    Location
    Durham, Kansas
    Posts
    69
    Thanks a lot! This is wonderful! That has been bugging me for quite a while!
    P.S. I did a sort of war-dance when I tried it out and it worked.

  5. #5
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    One thing to bear in mind with the manifest is that, if you have one, on Win7 (probably Vista too) when your program crashes, the description part of it is used in the message box the user sees instead of your program name. So think of your poor users and don't make it too obtuse nor too general so they have some idea of what's just happened.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by adeyblue View Post
    One thing to bear in mind with the manifest is that, if you have one, on Win7 (probably Vista too) when your program crashes, the description part of it is used in the message box the user sees instead of your program name. So think of your poor users and don't make it too obtuse nor too general so they have some idea of what's just happened.
    So I guess "Freshly deployed unreliable code" wouldn't be a good idea???

  7. #7
    Registered User
    Join Date
    Mar 2007
    Posts
    142
    OMG,

    just checked in one of my applications and this is what I found:

    <description>XP ........</description>

    Luckily, less then 1000 people use it.

    EDIT - OK, the forum censored the word. The word in question has 4 letters, starts with an S, ends with a T.
    Last edited by idelovski; 05-06-2011 at 03:15 AM.

  8. #8
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Quote Originally Posted by idelovski View Post
    OMG,

    just checked in one of my applications and this is what I found:

    <description>XP ........</description>

    Luckily, less then 1000 people use it.

    EDIT - OK, the forum censored the word. The word in question has 4 letters, starts with an S, ends with a T.
    Hahaha

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by idelovski View Post
    OMG,

    just checked in one of my applications and this is what I found:

    <description>XP ........</description>

    Luckily, less then 1000 people use it.

    EDIT - OK, the forum censored the word. The word in question has 4 letters, starts with an S, ends with a T.
    The more interesting question is... How did that get in there without you knowing?

  10. #10
    Registered User
    Join Date
    Mar 2007
    Posts
    142
    Oh, I typed it, that is for sure. I remember that day quite good. Somewhere in 2003 when I found out about the manifest file and Common Controls 6.0. For some reason it didn't work at first, so it took a while. I was changing almost everything, just to see what happens. When I got new style controls displayed in my app I left the manifest file as it was.
    Last edited by idelovski; 05-06-2011 at 09:37 AM.

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by idelovski View Post
    Oh, I typed it, that is for sure. I remember that day quite good. Somewhere in 2003 when I found out about the manifest file and Common Controls 6.0. For some reason it didn't work at first, so it took a while. I was changing almost everything, just to see what happens. When I got new style controls displayed in my app I left the manifest file as it was.
    ... ain't that the way it goes... "If it ain't broke...."

    Actually one of the things I constantly bemoan with Windows is it's ever increasing complexity... Manifests, Code Signing, UAC mupping snarf, Side By Side, and on and on... The only interpretation I can apply to this is that Microsoft is trying to destroy the freeware and shareware markets by making coding so horrendously complicated that no one person can possibly handle it all. Win2000 was totally awesome to code for. You could do amazing things with relative ease... These days I spend half my time trying to get my code past virus scanners, the UAC, installer restrictions ... and worse. It totally kills the new car smell of Win7 in a real big hurry.

    The one that just kills me is that half the time it thinks my executables are ok, but barfs on the installers... go figure.
    Last edited by CommonTater; 05-06-2011 at 09:54 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How good...
    By RNH in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 12-14-2007, 04:55 AM
  2. Do you have to be good at math to be good at C/C++?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-07-2007, 05:15 AM
  3. do you have to be good at math to be good at C++?
    By orion- in forum C++ Programming
    Replies: 6
    Last Post: 09-04-2005, 10:29 AM
  4. Getting good with C?
    By rtunez33 in forum C Programming
    Replies: 6
    Last Post: 08-29-2004, 02:15 PM
  5. SDL? 3d? 2d? good?
    By elfjuice in forum C++ Programming
    Replies: 5
    Last Post: 06-28-2002, 12:55 PM