LMD VCL - Vista Support
This topic describes Vista specific features of LMD VCL shared runtime.
- 1 Themes support in VCL
- 2 Additional Vista support (Delphi 2007 and better)
- 3 LMD helpers
Themes support in VCL
Delphi / C++ Builder 5 and 6
No special support by VCL. To enable themes in your app, you can either add yourself a Manifest resource or add LMDXPRes unit somewhere in your application.
Delphi 7 to Delphi 2007
To enable themes support in Delphi/C++ Builder applications simply add TXPManifest control to your app (alternatively you can still use the LMDXPRes unit).
Delphi 2007 and better
Themes support is now enabled by default for all NEW projects. To enable feature for existing applications: From the Project menu, select Options, navigate to the Application page and check "Enable runtime themes".
Additional Vista support (Delphi 2007 and better)
Besides default theme support Delphi 2007 provides additional features to make your application more vista like.
When Aero theme is active, you need to display the application's main form on the taskbar rather than the application window (for Flip3D and transition effects). This behaviour is provided by TApplication.MainFormOnTaskBar property. This property is enabled by default for all NEW projects. To enable this feature for existing applications: From the Project menu, select View Source. Search for the line <delphi>Application.Initialize;</delphi> and add the following on the next line <delphi>Application.MainFormOnTaskbar:=True;</delphi>
To support latest new Vista FileOpen/FileSave dialogs you can use the new TFileOpenDialog/TFileSaveDialog controls in the VCL. The major drawback for these control is, that they will not work in environments before Windows Vista. To make sure that your app works on all Windows systems (using the latest possible dialogs), you should use following approaches:
- Set the global variable UseLatestCommonDialogs to true somewhere in your code (default setting). Now Open/Save dialogs use latest available common dialogs (but you can not use advanced features TFileOpenDialog/TFileSaveDialog provide).
- Use the TLMDFileOpenDialog/TLMDFileSaveDialog controls. They offer flexibility of TFileOpenDialog/TFileSaveDialog components, but you can assign standard TOpenDialog/TSaveDialog references with their corresponding settings for non-Vista environments.
A similar feature is available for the new TLMDTaskDialog component. On Windows Vista the system taskdialog is used, on all other environments the features of the TaskDialog are emulated (so the features of this nice extended message dialog can be used on non-Vista systems as well).
LMD SysIn unit provides several system information services. To detect whether current operating system is Windows Vista:
- Check LMDSIWindowsVista variable whether current operating system is exactly Windows Vista.
- Check LMDSIWindowsVistaUp variable whether current operating system is Windows Vista or better.
Aero Glass detection
To check whether Aero Glass is currently enabled and active, use functions and variables of LMDDwmAPI unit. The global LMDDwmEnabled variable reports whether Aero Glass is enabled. In addition the state of each window can be tested and modified:
<delphi>function LMDWndIsDwmEnabled(Handle:THandle):Boolean;</delphi> Returns true when Dwm is enabled for a specific window (specified by Handle parameter).
<delphi>function LMDWndDwmDisable(Handle:THandle):Boolean;</delphi> Disables Aero Glass feature for the window specified by Handle parameter.
<delphi>function LMDWndDwmEnable(Handle:THandle):Boolean;</delphi> Enables Aero Glass feature for a window specified by Handle parameter. Certainly only applicable, when LMDDwmEnabled returns true.
Other Vista Extensions