Visit site The Road to Delphi
January 2012
2
votes
Exploring Delphi XE2 – VCL Styles Part III
The Road to Delphi
– Introduction The VCL Styles are great but it seems that was designed to hide (and protect?) a lot of useful properties and classes. Because that I wrote a small (for the moment) library that using class helpers (and another tricks) can access to hidden properties and classes of the VCL Styles. Today ...
3
votes
Determine Genuine Windows Installation using Delphi
The Road to Delphi
– Starting with Windows Vista , Microsoft introduces the The Software Licensing API (SLAPI), this API can be used to determine a genuine Microsoft Windows installation. So using the SLIsGenuineLocal function you can check if your app is running in a genuine Windows installation. This is the ...
December 2011
8
votes
Exploring Delphi XE2 – VCL Styles Part II
The Road to Delphi
– The TStyleHook Class The VCL Styles uses the TStyleHook class to intercept the paint methods and the Windows messages related to the Vcl Styles operations, If you have a custom control or need change the way how a control like a TEdit, TMemo, TListView, etc. is painted you must create a new Style ...
4
votes
Adding a Standard Context Popup Menu to a SynEdit
The Road to Delphi
– When you uses an Edit control like a TMemo or TEdit component a context menu pops up with options to undo, copy, paste, select all, etc. Unfortunally the TSynEdit component doesn’t include a menu like this, so you must write you own. You can fix this in a few lines of code using a interposer ...
November 2011
9
votes
Fixing a VCL Style bug in the TPageControl and TTabControl components
The Road to Delphi
– The BUG Yesterday while I’ve working migrating a personal project to Delphi XE2, I found a bug(QC #101346) in the TPageControl and TTabControl components. The issue is related to the images (icons) which are drawn in the tab controls when an ImageList is associated to the component. check the ...
1
vote
WMI Tasks using Delphi – Services
The Road to Delphi
– How do I determine which services are running and which ones are not? Use the Win32_Service class to check the state of all of the services. The state property lets you know if a service is stopped or running. const wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService ...
0
votes
WMI Tasks using Delphi – Registry
The Road to Delphi
– How do I read registry key values using WMI? Use the StdRegProv class, located in root\default (for Windows Server 2003, Windows XP, Windows 2000, Windows NT 4.0) and root\cimv2 namespace for newers versions of Windows . You cannot get any instances of this class because the System Registry ...
1
vote
WMI Tasks using Delphi – Processes
The Road to Delphi
– How do I run an application in a hidden window? Call the application from an app that uses the Win32_Process and Win32_ProcessStartup classes. const wbemFlagForwardOnly = $00000020; HIDDEN_WINDOW = 0; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObject : ...
1
vote
WMI Tasks using Delphi – Printers and Printing
The Road to Delphi
– How do I add a new printer connection to a remote computer? Use the Win32_Printer class and the AddPrinterConnection method. var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObject : OLEVariant; begin; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); ...
14
votes
Implementing a Delphi for..in loop on COM collections and Variant Arrays
The Road to Delphi
– Enumerating a collection of Variants Many times when you are working with COM objects you need iterate over a collection, and usually the way to do this is using the _NewEnum function (which return a IUnknown interface) implemented by the COM class and then assign that value to a IEnumVariant ...
0
votes
WMI Tasks using Delphi – Operating Systems
The Road to Delphi
– How do I determine if a service pack has been installed on a computer? Use the Win32_OperatingSystem class and check the value of the ServicePackMajorVersion and ServicePackMinorVersion properties. const wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : ...
October 2011
2
votes
The WMI Delphi Code Creator now can create C++ Code compatible with Borland/Embarcadero compilers
The Road to Delphi
– After a lots of tests, I can officially announce which the WMI Delphi Code Creator now can create C++ Code compatible with the Borland/Embarcadero compilers. This new feature will be very helpful for developers using Borland/Embarcadero C++ compilers because exist very few documentation about ...
2
votes
WMI Tasks using Delphi – Networking
The Road to Delphi
– How do I disable a network connection using WMI? If you are using DHCP, use the Win32_NetworkAdapterConfiguration and the ReleaseDHCPLease method to release the IP address. If you are not using DHCP, you cannot use WMI to disable a network connection. To re-enable the network connection, use ...
2
votes
WMI Tasks using Delphi – Files and Folders
The Road to Delphi
– How do I rename a local or remote file? Use the CIM_DataFile class. Ensure that you pass the entire path name when calling the Rename method, for example, “C:\Foo\Test.txt” instead of “Text.txt”. const wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; ...
0
votes
WMI Tasks using Delphi – Event Logs
The Road to Delphi
– How do I retrieve information about the Security event log? Use the Win32_NTEventlogFile class. const wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; ...




