Copy link to clipboard
Copied
Hello,
Looking at some very old plugins, I was wondering why some plugins had Visual Themes enabled (i.e. their dialogs have normal WinXP/Vista/Win7/... buttons) while others have not (i.e. Windows 9x buttons).
Let's say there are two filter plugins :
So I did some experiments:
1. NewFilter.8bf has an XP Manifest ressource, while OldFilter.8bf does not. So, my first idea was to simply add a Manifest ressource to OldFilter.8bf using a Resource Editor. But that did not work: The controls are still in Windows 9x style. I double checked that the manifest is valid and correctly added to the 8BF DLL.
2. I checked the PE header flags of the 8BF files. Both have the fields MajorOperatingSystemVersion/MinorOperatingSystemVersion set to 4.00 (i.e. they are Win95 compatible plugins, not Win3.11 plugins)
3. In the MSDN​ I have read that an application can disable Visual Themes by calling SetWindowTheme(hWnd, L" ", L" ")
As a small test, I have edited Photoshop.exe with an hex editor and replaced the string "SetWindowTheme" with something else, e.g. "XXXWindowTheme", so that the WinAPI call will fail. Et voilà : OldFilter.8bf has now Visual Themes enabled (or better to say: It has its themes not disabled)
Of course, this is not an acceptable solution, since I don't want to have a modified Photoshop.exe, and invalidate this WinAPI function call might cause thousand other side effects, and it affects all plugins.
My understanding of what is going on is: When Photoshop.exe calls the filter plugin, it somehow checks if this plugin is able to handle Visual Themes. If Photoshop.exe does not think that the plugin is able to, it will call SetWindowTheme to disable Visual Themes, in order to reach a good backwards compatibility.
Now the question is, how does Photoshop.exe detect it? Are there some compatibility flags inside the 8BF file, or is there a special callback function to query compatibility flags?
I can answer my own question.
It turns out that Photoshop 7 disabled the Themes for all filter plugins if they are called in "filter" mode (but not if called in "about window" mode). So, even a HelloWorld plugin will have Win9x style buttons, even if a manifest is present in the 8BF. There is no way to get visual themes, except if you do explicitly perform WinAPI calls yourself.
Newer versions of Photoshop don't do that. So, the plugins will look okay in newer versions, having visual theme buttons
...For sake of completeness, I want to give an updated answer to this problem.
If you are the plugin author, then you CAN implement visual themes for older versions of Photoshop! The windows "Activation Context" API let you enforce a manifest to be used. So the plugin manifest is enforced to the plugin dialog, and so you have visual style buttons. And to improve compatibility with older versions of Windows, you can even call this API with delayed loading. (see my code below)
Unfortunately, this is
...Copy link to clipboard
Copied
I can answer my own question.
It turns out that Photoshop 7 disabled the Themes for all filter plugins if they are called in "filter" mode (but not if called in "about window" mode). So, even a HelloWorld plugin will have Win9x style buttons, even if a manifest is present in the 8BF. There is no way to get visual themes, except if you do explicitly perform WinAPI calls yourself.
Newer versions of Photoshop don't do that. So, the plugins will look okay in newer versions, having visual theme buttons. (But also there, the manifest is ignored).
Copy link to clipboard
Copied
For sake of completeness, I want to give an updated answer to this problem.
If you are the plugin author, then you CAN implement visual themes for older versions of Photoshop! The windows "Activation Context" API let you enforce a manifest to be used. So the plugin manifest is enforced to the plugin dialog, and so you have visual style buttons. And to improve compatibility with older versions of Windows, you can even call this API with delayed loading. (see my code below)
Unfortunately, this is only possible if you are the author. You cannot add this functionality to other filters, as it requires change in the code rather than changes to the resources.
---
// ... your code ...
if (activationContextUsed) DeactivateManifest(&manifestVars);
Definition of ActivateManifest() and DeactivateManifest() are here: https://github.com/danielmarschall/filter_foundry/blob/master/manifest.c
Find more inspiration, events, and resources on the new Adobe Community
Explore Now