Results 1 to 10 of 10

Thread: Render WinXP Style

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Question Render WinXP Style

    I want to render the various Form controls in my app in WinXP style for which I used this code. Prior to adding the code showed in the above URL, the start-up object in my app was a Form named frmIntro. Since the code tells to use Sub Main as the start-up object, I made Sub Main as the start-up object by going to the project properties & modified Sub Main showed in the above URL as follows:

    Code:
    Public Sub Main()
        'Call the function before other codes
        InitCommonControlsVB
        frmIntro.Show
    End Sub
    But it doesn't render WinXP style in all the Forms. Only the controls in the parent Form in the app get rendered in WinXP style. Any idea what I could be missing?

    I went through other posts as well in this forum regarding WinXP & all of them suggested something as shown in the above URL.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: Render WinXP Style

    Quote Originally Posted by arpan_de
    I want to render the various Form controls in my app in WinXP style for which I used this code. Prior to adding the code showed in the above URL, the start-up object in my app was a Form named frmIntro. Since the code tells to use Sub Main as the start-up object, I made Sub Main as the start-up object by going to the project properties & modified Sub Main showed in the above URL as follows:

    Code:
    Public Sub Main()
        'Call the function before other codes
        InitCommonControlsVB
        frmIntro.Show
    End Sub

    [...]
    Hello Arpan,

    From what you post here, I would say there's nothing wrong with your code. Are you using a manifest file or a resource file with an XP manifest?

    Another question, where did you put the Sub main?
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  3. #3

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Render WinXP Style

    Are you using a manifest file or a resource file with an XP manifest?
    I am using a manifest named MyApp.exe.manifest.

    where did you put the Sub main?
    In a module....

    EDIT

    I tried using a resource file as well but the outcome remains the same i.e. only the controls in the parent Form get rendered in WinXP style. Controls in the other Forms don't.

    BTW, in case of a resource file, which file should the resource point to? To the manifest file??
    Last edited by arpan_de; Feb 1st, 2008 at 03:35 PM.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Render WinXP Style

    I'm attaching a template you can use that always works for me, and it uses a resource file manifest.

    You will need to go into the \res folder and change the names of the .manifest and .rc files. Where it says MyApp.manifest and MyApp.rc, change them to the name of your EXE file.

    This has always worked for me. Hope it helps.
    Attached Files Attached Files

  5. #5
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: Render WinXP Style

    Quote Originally Posted by arpan_de
    I am using a manifest named MyApp.exe.manifest.

    In a module....

    EDIT

    I tried using a resource file as well but the outcome remains the same i.e. only the controls in the parent Form get rendered in WinXP style. Controls in the other Forms don't.

    BTW, in case of a resource file, which file should the resource point to? To the manifest file??
    Not sure I understand the last question, you should load the resourcefile in the IDE.

    To do so, go to the Project menu, click Add File..., and load the resource file that contains the XP manifest. I'll attach a sample - that I made with XNResource Editor - which you can actually use, no matter what it's name says.

    Beware not to open the resource with the VB6 resource editor, it doesn't seem to like resources it doesn't know.

    HTH
    Attached Files Attached Files
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  6. #6
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Render WinXP Style

    Quote Originally Posted by Jottum
    which you can actually use, no matter what it's name says.
    Not sure what this means exactly, but just to state for the OP: You can keep the .manifest and .rc filenames how they are and it should still work, but it is best practice to change them to the names of your EXE.

    The result will be a single EXE file that does not need you to include a .manifest file with your application, as it will have been embedded into the actual EXE itself.

    It will also work if your program does not use the Microsoft Common Controls library (some other XP style code out there will crash if you do not use this library in your program).

  7. #7
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: Render WinXP Style

    Quote Originally Posted by DigiRev
    Not sure what this means exactly [...]
    Just that he can give it a try, if it works, he can give it a proper name. I don't know if he has another res file with his exe name, now he won't overwrite anything.
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  8. #8

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Render WinXP Style

    Digirev, I already tried what you have suggested from this post (thread #43) but again, it just renders the controls of the parent Form in WinXP style; not the controls on the other Forms.

    I will give your suggestion a try, Jottum but before that I guess I need to mention that I am already using a Resource file in my project & VB doesn't allow adding 2 Resource files in one project.

    Not sure I understand the last question, you should load the resourcefile in the IDE
    What I mean is in the Resource Editor, when you click the Add Custom Resource button, a dialog box opens up to select a resource. Should the manifest file be selected as the resource in this case? I believe yes.

    EDIT

    Anyway, Digirev, I will give your template another try. Do I need to do anything else apart from chaning the name of the RC file & the manifest file to my app name? But here again, you are using a RES file & I am already using a RES file
    Last edited by arpan_de; Feb 1st, 2008 at 04:48 PM.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  9. #9
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: Render WinXP Style

    Quote Originally Posted by arpan_de
    [...]

    I will give your suggestion a try, Jottum but before that I guess I need to mention that I am already using a Resource file in my project & VB doesn't allow adding 2 Resource files in one project.

    What I mean is in the Resource Editor, when you click the Add Custom Resource button, a dialog box opens up to select a resource. Should the manifest file be selected as the resource in this case? I believe yes.

    [...]
    No, the VB6 resource editor doesn't understand a manifest resource. As soon as you open a resource file holding a manifest you're bound to get into trouble.

    The best thing you can do, is to download XNResource Editor (freeware), install it, close your VB project, open your res file in XNResource (make a backup of the original first, just to be save), go to the Resource Menu, click Add Resource, click Xp Theme Manifest, click Ok, click the save button (or File->Save) and start your project in VB again.

    HTH
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  10. #10

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Render WinXP Style

    Hey guys I just now figured out why the controls (atleast the CommandButtons) in the other Forms weren't getting rendered in XP style. This is because I had set the Style property of all the CommandButtons to Graphical! When I changed it to Standard, they got rendered in XP style!

    But then this gives rise to another problem - my app is with skins. In other words, changing the skin changes the color of the CommandButtons as well which means the Style of the CommandButtons have to be set to Graphical else the CommandButtons won't change the color!

    To add to my woes, most of the controls in other Forms are grouped in Frames which leads to another problem i.e. the controls don't get rendered as they should. They have to be placed inside PictureBoxes to render the XP style!

    Problems galore.....I guess finally I have to drop the idea of rendering the controls in XP style!
    Last edited by arpan_de; Feb 1st, 2008 at 07:12 PM.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width