Apply Visual Styles on DLL Forms

Share your advanced PureBasic knowledge/code with the community.
PyroStrex
User
User
Posts: 61
Joined: Mon Mar 22, 2010 3:08 pm

Apply Visual Styles on DLL Forms

Post by PyroStrex »

It's been a while since I used PureBasic, suddenly I have the need to use it again. Directly I encountered this problem and having trouble to find the solution. I know the solution was from a very old post in this forum. So I thought, why not I put the solution in this section. Better to name it correctly so people will find it easily in the future.

You need a resource editor. I used Resource Hacker.

1. Open your compiled dll with Resource Hacker.
2. Rename the resource (mine was in 24:1:1033) to 24:2:1033 (Right Click "1033"->Rename Resource [...]->Type "2")
3. Export the whole resource from Resource Hacker. (Action->Save All Resources)
4. Add the exported resource to your project resource tab.
5. Recompile your DLL.
6. You can now inject.. umm I mean use your DLL with the uxtheme visual style enabled. 8)

Note: I don't have any resource other than the manifest, That is why I used Save all resources
Note: Only works when the main application's process has a manifest.

All Thanks to http://www.purebasic.fr/english/viewtop ... 16#p102716
Last edited by PyroStrex on Fri May 01, 2015 6:15 pm, edited 2 times in total.
User avatar
chi
Addict
Addict
Posts: 864
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Apply Visual Styles on DLL Forms

Post by chi »

Thanks a lot :D
Et cetera is my worst enemy
User avatar
Thunder93
Addict
Addict
Posts: 1773
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Apply Visual Styles on DLL Forms

Post by Thunder93 »

To apply visual styles on DLL forms, It doesn't always need to be this laborious.

If I'm creating PB DLL for my PB application, I simply set 'Enable modern theme support (for Windows XP and above)' in PB Compiler Options for the PB application. The DLL forms will inherit the visual styles support from the parent process.

The proposed procedures would be required if I'm using RUNDLL32 via PB RunProgram(), or wanting to use directly RUNDLL32 outside of my application, from commandline.

The proposed procedures won't work if the PB application doesn't have 'Enable modern theme support (for Windows XP and above)' set. Making DLL plugins for third-party software that doesn't use visual styles, causes my PB DLL plugin forms to inherit the same .. regardless that I have done the proposed procedures.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Post Reply