Author Topic: WinXP+ gui theme for oxygen apps  (Read 8862 times)

0 Members and 2 Guests are viewing this topic.

efgee

  • Guest
WinXP+ gui theme for oxygen apps
« on: January 05, 2012, 03:04:55 PM »
Hi,
one way of adding extended WinXP+ windowing theme to oxygen apps is to tweak oxygen itself.
(the other way would be to use resourcehacker or something...)

Instructions:
1.) open file "o2hdrs.bas" in the oxygen src directory
2.) add the code below at line 944 (oxygen version A38)
3.) recompile oxygen with freebasic using go2.bat
4.) replace current oxygen dll with newly generated one
5.) done

Charles, feel free to incorporate the code below into the main trunk.
(but don't feel obligated...)

The code below is for a 32 bit OS.

Code: OxygenBasic
  1. #if 1
  2.     'TEST STUB FOR MANIFEST ( FOR WINDOWS 32 BIT )
  3.    '    
  4.    w5=".resources"+cr+_
  5.       "hl0 hl0 hl1 hw0 hw1"+cr+_               '00 MAIN DIRECTORY  CHARACTERISTICS DATETIMESTAMP MAJORMINORVERSION NUMOFNAMES NUMOFIDS
  6.      "hl18 hl80000018"+cr+_                   '10   ENTRY RT_MANIFEST
  7.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '18   MANIFEST DIRECTORY
  8.      "hl1 hl80000030"+cr+_                    '28     ID 1 STRINGS
  9.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '30     ID1 LANGUAGE DIRECTORY MANIFEST
  10.      "nl0 hl48"+cr+_                          '40       ID1L MANIFEST ENGLISH
  11.      "ga data1 nl634 nl0 hl0"+cr+_            '48       DATA ENTRY: ADDRESS LENGTH CODEPAGE RESERVED
  12.      ".data1 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 "+cr+_   '.data1   RAWDATA OF RESOURCE
  13.      ".data1 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 55 54 "+cr+_  
  14.       ".data1 46 2D 38 22 20 73 74 61 6E 64 61 6C 6F 6E 65 3D "+cr+_  
  15.       ".data1 22 79 65 73 22 3F 3E 0D 0A 3C 61 73 73 65 6D 62 "+cr+_  
  16.       ".data1 6C 79 20 78 6D 6C 6E 73 3D 22 75 72 6E 3A 73 63 "+cr+_  
  17.       ".data1 68 65 6D 61 73 2D 6D 69 63 72 6F 73 6F 66 74 2D "+cr+_  
  18.       ".data1 63 6F 6D 3A 61 73 6D 2E 76 31 22 20 6D 61 6E 69 "+cr+_  
  19.       ".data1 66 65 73 74 56 65 72 73 69 6F 6E 3D 22 31 2E 30 "+cr+_  
  20.       ".data1 22 3E 0D 0A 09 3C 61 73 73 65 6D 62 6C 79 49 64 "+cr+_  
  21.       ".data1 65 6E 74 69 74 79 0D 0A 09 09 76 65 72 73 69 6F "+cr+_  
  22.       ".data1 6E 3D 22 31 2E 30 2E 30 2E 30 22 0D 0A 09 09 70 "+cr+_  
  23.       ".data1 72 6F 63 65 73 73 6F 72 41 72 63 68 69 74 65 63 "+cr+_  
  24.       ".data1 74 75 72 65 3D 22 58 38 36 22 0D 0A 09 09 6E 61 "+cr+_  
  25.       ".data1 6D 65 3D 22 43 6F 6D 70 61 6E 79 4E 61 6D 65 2E "+cr+_  
  26.       ".data1 50 72 6F 64 75 63 74 4E 61 6D 65 2E 59 6F 75 72 "+cr+_  
  27.       ".data1 41 70 70 22 0D 0A 09 09 74 79 70 65 3D 22 77 69 "+cr+_  
  28.       ".data1 6E 33 32 22 0D 0A 09 2F 3E 0D 0A 09 3C 64 65 73 "+cr+_  
  29.       ".data1 63 72 69 70 74 69 6F 6E 3E 0D 0A 09 09 59 6F 75 "+cr+_  
  30.       ".data1 72 20 61 70 70 6C 69 63 61 74 69 6F 6E 20 64 65 "+cr+_  
  31.       ".data1 73 63 72 69 70 74 69 6F 6E 20 68 65 72 65 2E 0D "+cr+_  
  32.       ".data1 0A 09 3C 2F 64 65 73 63 72 69 70 74 69 6F 6E 3E "+cr+_  
  33.       ".data1 0D 0A 09 3C 64 65 70 65 6E 64 65 6E 63 79 3E 0D "+cr+_  
  34.       ".data1 0A 09 09 3C 64 65 70 65 6E 64 65 6E 74 41 73 73 "+cr+_  
  35.       ".data1 65 6D 62 6C 79 3E 0D 0A 09 09 09 3C 61 73 73 65 "+cr+_  
  36.       ".data1 6D 62 6C 79 49 64 65 6E 74 69 74 79 0D 0A 09 09 "+cr+_  
  37.       ".data1 09 09 74 79 70 65 3D 22 77 69 6E 33 32 22 0D 0A "+cr+_  
  38.       ".data1 09 09 09 09 6E 61 6D 65 3D 22 4D 69 63 72 6F 73 "+cr+_  
  39.       ".data1 6F 66 74 2E 57 69 6E 64 6F 77 73 2E 43 6F 6D 6D "+cr+_  
  40.       ".data1 6F 6E 2D 43 6F 6E 74 72 6F 6C 73 22 0D 0A 09 09 "+cr+_  
  41.       ".data1 09 09 76 65 72 73 69 6F 6E 3D 22 36 2E 30 2E 30 "+cr+_  
  42.       ".data1 2E 30 22 0D 0A 09 09 09 09 70 72 6F 63 65 73 73 "+cr+_  
  43.       ".data1 6F 72 41 72 63 68 69 74 65 63 74 75 72 65 3D 22 "+cr+_  
  44.       ".data1 58 38 36 22 0D 0A 09 09 09 09 70 75 62 6C 69 63 "+cr+_  
  45.       ".data1 4B 65 79 54 6F 6B 65 6E 3D 22 36 35 39 35 62 36 "+cr+_  
  46.       ".data1 34 31 34 34 63 63 66 31 64 66 22 0D 0A 09 09 09 "+cr+_  
  47.       ".data1 09 6C 61 6E 67 75 61 67 65 3D 22 2A 22 0D 0A 09 "+cr+_  
  48.       ".data1 09 09 2F 3E 0D 0A 09 09 3C 2F 64 65 70 65 6E 64 "+cr+_  
  49.       ".data1 65 6E 74 41 73 73 65 6D 62 6C 79 3E 0D 0A 09 3C "+cr+_  
  50.       ".data1 2F 64 65 70 65 6E 64 65 6E 63 79 3E 0D 0A 3C 2F "+cr+_  
  51.       ".data1 61 73 73 65 6D 62 6C 79 3E 20  "+cr+_  
  52.       "/+200"+cr+"01 `end_of_resources` 01"+cr+"/+1000"+cr 'PADD TO NEAREST 512 BYTES
  53.    
  54.     rsrf=1
  55. #endif
  56.  

enjoy  ;D

EDIT: refactor data...
« Last Edit: January 05, 2012, 09:18:05 PM by efgee »

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #1 on: January 05, 2012, 05:18:30 PM »
This works as well and might be even better in the long run...

The code below is for a 32 bit OS.

Code: OxygenBasic
  1. #if 1
  2.     'TEST STUB FOR MANIFEST ( FOR WINDOWS 32 BIT )
  3.    '    
  4.    w5=".resources"+cr+_
  5.       "hl0 hl0 hl1 hw0 hw1"+cr+_               '00 MAIN DIRECTORY  CHARACTERISTICS DATETIMESTAMP MAJORMINORVERSION NUMOFNAMES NUMOFIDS
  6.      "hl18 hl80000018"+cr+_                   '10   ENTRY RT_MANIFEST
  7.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '18   MANIFEST DIRECTORY
  8.      "hl1 hl80000030"+cr+_                    '28     ID 1 STRINGS
  9.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '30     ID1 LANGUAGE DIRECTORY MANIFEST
  10.      "nl0 hl48"+cr+_                          '40       ID1L MANIFEST ENGLISH
  11.      "ga data1 nl547 nl0 hl0"+cr+_            '48       DATA ENTRY: ADDRESS LENGTH CODEPAGE RESERVED
  12.      ".data1 `<?xml version=` 22 `1.0` 22 ` encoding=` 22 `UTF-8` 22 ` standalone=` 22 `yes` 22 `?>` "+cr+_      '.data1   RAWDATA OF RESOURCE
  13.      ".data1 `<assembly xmlns=` 22 `urn:schemas-microsoft-com:asm.v1` 22 ` manifestVersion=` 22 `1.0` 22 `>` "+cr+_
  14.       ".data1 `<assemblyIdentity` "+cr+_
  15.       ".data1 ` version=` 22 `1.0.0.0` 22 "+cr+_
  16.       ".data1 ` processorArchitecture=` 22 `x86` 22 "+cr+_
  17.       ".data1 ` name=` 22 `CompanyName.ProductName.YourApp` 22 "+cr+_
  18.       ".data1 ` type=` 22 `win32` 22 "+cr+_
  19.       ".data1 `/>` "+cr+_
  20.       ".data1 `<description>` "+cr+_
  21.       ".data1 `Your application description here.` "+cr+_
  22.       ".data1 `</description>` "+cr+_
  23.       ".data1 `<dependency>` "+cr+_
  24.       ".data1 `<dependentAssembly>` "+cr+_
  25.       ".data1 `<assemblyIdentity` "+cr+_
  26.       ".data1 ` type=` 22 `win32` 22 "+cr+_
  27.       ".data1 ` name=` 22 `Microsoft.Windows.Common-Controls` 22 "+cr+_
  28.       ".data1 ` version=` 22 `6.0.0.0` 22 "+cr+_
  29.       ".data1 ` processorArchitecture=` 22 `x86` 22 "+cr+_
  30.       ".data1 ` publicKeyToken=` 22 `6595b64144ccf1df` 22 "+cr+_
  31.       ".data1 ` language=` 22 `*` 22 "+cr+_
  32.       ".data1 `/>` "+cr+_
  33.       ".data1 `</dependentAssembly>` "+cr+_
  34.       ".data1 `</dependency>` "+cr+_
  35.       ".data1 `</assembly>` "+cr+_
  36.       "/+200"+cr+"01 `end_of_resources` 01"+cr+"/+1000"+cr 'PADD TO NEAREST 512 BYTES
  37.    
  38.     rsrf=1
  39. #endif
  40.  

Keep in mind:
if the text is changed the total amount of chars need to be adjusted (it's the "nl547").

 ;)
« Last Edit: January 05, 2012, 09:24:33 PM by efgee »

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #2 on: January 05, 2012, 09:20:40 PM »
Here the code for a 64 bit application:

Code: OxygenBasic
  1. #if 1
  2.     'TEST STUB FOR MANIFEST ( FOR WINDOWS 64 BIT )
  3.    '    
  4.    w5=".resources"+cr+_
  5.       "hl0 hl0 hl1 hw0 hw1"+cr+_               '00 MAIN DIRECTORY  CHARACTERISTICS DATETIMESTAMP MAJORMINORVERSION NUMOFNAMES NUMOFIDS
  6.      "hl18 hl80000018"+cr+_                   '10   ENTRY RT_MANIFEST
  7.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '18   MANIFEST DIRECTORY
  8.      "hl1 hl80000030"+cr+_                    '28     ID 1 STRINGS
  9.      "hl0 hl0 hl1 hw0 hw1"+cr+_               '30     ID1 LANGUAGE DIRECTORY MANIFEST
  10.      "nl0 hl48"+cr+_                          '40       ID1L MANIFEST ENGLISH
  11.      "ga data1 nl551 nl0 hl0"+cr+_            '48       DATA ENTRY: ADDRESS LENGTH CODEPAGE RESERVED
  12.      ".data1 `<?xml version=` 22 `1.0` 22 ` encoding=` 22 `UTF-8` 22 ` standalone=` 22 `yes` 22 `?>` "+cr+_      '.data1   RAWDATA OF RESOURCE
  13.      ".data1 `<assembly xmlns=` 22 `urn:schemas-microsoft-com:asm.v1` 22 ` manifestVersion=` 22 `1.0` 22 `>` "+cr+_
  14.       ".data1 `<assemblyIdentity` "+cr+_
  15.       ".data1 ` version=` 22 `1.0.0.0` 22 "+cr+_
  16.       ".data1 ` processorArchitecture=` 22 `amd64` 22 "+cr+_
  17.       ".data1 ` name=` 22 `CompanyName.ProductName.YourApp` 22 "+cr+_
  18.       ".data1 ` type=` 22 `win32` 22 "+cr+_
  19.       ".data1 `/>` "+cr+_
  20.       ".data1 `<description>` "+cr+_
  21.       ".data1 `Your application description here.` "+cr+_
  22.       ".data1 `</description>` "+cr+_
  23.       ".data1 `<dependency>` "+cr+_
  24.       ".data1 `<dependentAssembly>` "+cr+_
  25.       ".data1 `<assemblyIdentity` "+cr+_
  26.       ".data1 ` type=` 22 `win32` 22 "+cr+_
  27.       ".data1 ` name=` 22 `Microsoft.Windows.Common-Controls` 22 "+cr+_
  28.       ".data1 ` version=` 22 `6.0.0.0` 22 "+cr+_
  29.       ".data1 ` processorArchitecture=` 22 `amd64` 22 "+cr+_
  30.       ".data1 ` publicKeyToken=` 22 `6595b64144ccf1df` 22 "+cr+_
  31.       ".data1 ` language=` 22 `*` 22 "+cr+_
  32.       ".data1 `/>` "+cr+_
  33.       ".data1 `</dependentAssembly>` "+cr+_
  34.       ".data1 `</dependency>` "+cr+_
  35.       ".data1 `</assembly>` "+cr+_
  36.       "/+200"+cr+"01 `end_of_resources` 01"+cr+"/+1000"+cr 'PADD TO NEAREST 512 BYTES
  37.    
  38.     rsrf=1
  39. #endif
  40.  

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #3 on: January 05, 2012, 09:39:35 PM »
Charles,
If you want to incorporate the manifest resource:

There need to be different settings for:

32 bit apps: processorArchitecture="x86"

or for

64 bit apps: processorArchitecture="amd64"

There are more settings for Vista and Win7 that could be taken care off as well.
(admin rights etc.)

Maybe later.

Charles Pegge

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #4 on: January 06, 2012, 10:18:28 AM »

Hi Frank,

Thanks! I hope to make a bit easier than that.

there are some useful OS calls for adding resources to an EXE.

Adding, Deleting, and Replacing Resources
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648004(v=VS.85).aspx

Resource-Hhacker is okay for 32-bit but does not support PE32+ (64 bit) EXEs when I last tried it

Charles

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #5 on: January 06, 2012, 10:39:34 AM »
Of course a build-in functionality that reads an external xml file would be best.

We have already $FileName so we could use a similar syntax in order to add resources to a file:

$AppIcon        "myIcon.ico"
$AppManifest "myManifest.xml"
etc.

Thanks

Aurel

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #6 on: January 07, 2012, 12:54:56 PM »
Is there any compiled example for win32 how manifested app work
including button click.
As you maybe know i still don't get it how to solve problem  ::)
with notify meassages and because of this buttons don't respond  >:(

Charles Pegge

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #7 on: January 08, 2012, 08:40:40 AM »
Frank,

Should the manifest be stored in the PE in wide-string format like most other resource strings?

What is the best way to test the manifest is working?

Charles
« Last Edit: January 08, 2012, 08:43:27 AM by Charles Pegge »

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #8 on: January 08, 2012, 11:04:35 AM »
Should the manifest be stored in the PE in wide-string format like most other resource strings?

Never tested wide-strings manifest resources.

What is the best way to test the manifest is working?

If the manifest resource is broken 2 things can happen:
1.) the app will not start and nothing will show up (no error message)
2.) the app will not start but the OS shows an error message

Either way you will know  ;D

That's why I dislike external manifest files: if they are corrupt the app will not start.

efgee

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #9 on: January 08, 2012, 11:11:55 AM »
Is there any compiled example for win32 how manifested app work
including button click.
As you maybe know i still don't get it how to solve problem  ::)
with notify meassages and because of this buttons don't respond  >:(

Sorry but I don't understand what kind of problems you have.

If there are event problems with buttons in your app then there is a general issue.
Manifest resources (or external manifest files) don't change an apps behavior; only the look of an app.

Do you have a general event/notification problem with buttons?
« Last Edit: January 08, 2012, 11:14:28 AM by efgee »

Charles Pegge

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #10 on: January 08, 2012, 11:52:51 AM »
Ideally, I should provide built-in resource compilation. I quite like the resource scripting language. The only problem is that information about the internals is scattered across space and time on the web, and takes a lot of research to pull it all together.

Charles

My Research trail so far:


Resources
=========
Adding, Deleting, and Replacing Resources
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648004(v=VS.85).aspx
Winbase.h
Kernel32.dll
winuser.h
---
Using Resources
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648008(v=VS.85).aspx#_win32_Updating_Resources
Resource File Formats
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648007(v=VS.85).aspx
--->
TestCode:
Empty resource header
Add icon
--->
RESOURCEHEADER structure
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648027(v=VS.85).aspx
LocaleIds
http://msdn.microsoft.com/en-us/goglobal/bb964664
--->
ico format
----------
http://en.wikipedia.org/wiki/ICO_(file_format)
Replacing ICON resources in EXE and DLL files
http://www.codeproject.com/KB/DLL/ICON_Resources.aspx?q=updateresource+rt_icon+c
Change Icon of EXE file through code extracting it from other EXE file
http://www.go4expert.com/forums/showthread.php?t=643
ResourceLib: C# File Resource Management Library
http://resourcelib.codeplex.com/
--->
Binary Resource Formats
http://www.skynet.ie/~caolan/pub/winresdump/winresdump/doc/resfmt.txt
--->
Resource Script Reference
include
http://en.wikibooks.org/wiki/Windows_Programming/Resource_Script_Reference
--->
ICONS **
http://msdn.microsoft.com/en-us/library/ms997538.aspx
--->
Manifests
Enabling Visual Styles
http://msdn.microsoft.com/fr-fr/library/bb773175%28en-us,VS.85%29.aspx

jcfuller

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #11 on: January 08, 2012, 12:25:08 PM »
Charles,
  I believe we discussed this app before?
It has worked fine for adding compiled resources (res) to a 32bit exe.
It includes source so maybe there is some info you can use.

http://basic-compiler.com/download/index.php?dir=&file=LinkRes2Exe.zip

James

Charles Pegge

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #12 on: January 08, 2012, 01:32:12 PM »
Yes I remember. Thanks James. Will this work for icons and bitmaps? I got the impression that the icon image bitmap pointer would have to be remapped (from RVA to absolute) before updating.

Charles
« Last Edit: January 08, 2012, 01:42:51 PM by Charles Pegge »

jcfuller

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #13 on: January 08, 2012, 03:17:36 PM »
Charles,
  I just did I test with   LinkRes2exe and it added a res file with a bitmap and an icon (compiled with gorc).
 Bcx "c"
James

Charles Pegge

  • Guest
Re: WinXP+ gui theme for oxygen apps
« Reply #14 on: January 08, 2012, 03:37:36 PM »
Thanks James,

My understanding of res files and icons is clearer now. I would like to bypass rc compiler and go directly from script. But I am not sure that time is on my side to go that far. :-\

Charles