Page 1 of 1

Apply Visual Styles on DLL Forms

Posted: Mon Apr 20, 2015 5:12 am
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

Re: Apply Visual Styles on DLL Forms

Posted: Tue Apr 21, 2015 4:30 pm
by chi
Thanks a lot :D

Re: Apply Visual Styles on DLL Forms

Posted: Tue Apr 21, 2015 7:25 pm
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.