delphi _ the road to delphi - a blog about programming
Post on 30-Oct-2015
240 Views
Preview:
DESCRIPTION
TRANSCRIPT
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 1/22
THE ROAD TO DELPHI A BLOGABOUT PROGRAMMING
April 25, 2013
7 Comments
Added support for RAD Studio XE4
in the Delphi IDE Theme Editor.
This entry is just for announce which the Delphi IDE
Theme Editor now supports RAD Studio XE4.
CATEGORY ARCHI VES: DELPHI
Delphi Lazarus Delphi Prism
PROJECTS MISC CATEGORIES ABOUT
CONTRIBUTIONS
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 2/22
Installer of the Delphi IDE Theme Editor
Categories: Delphi, Tools | Tags: Delphi, tools | Permalink.
April 12, 2013
2 Comments
Added support to TSMBIOS for
SMBIOS 2.8 spec.
A few weeks ago (3 Apr 2013) a new update to the
System Management BIOS (SMBIOS) Reference
Specification was introduced by the DMTF. So the
TSMBIOS project was updated to support the
SMBIOS 2.8.
The following changes was added to the 2.8
version:
Processor Information (Type 4):
1. SMBIOSCR00106: processor family
name correction (48h)
2. SMBIOSCR00107: new processor
family types
3. SMBIOSCR00108: new processor
family type
.Net ADOApplications Bing APIC# COM
DelphiDelphi-News Delphi2010 Delphi Prism
Delphi XE DelphiXE2 Delphi XE3 DWMFreePascalGeolocation GoogleApi Google labs JEDIAPI json LazarusNetworking RTTISMBios StackOverflow
VCL Styles WinApi
WMI XML XPath
TRANSLATE
Translate this blog into
different languages...
Hrvatski
esky
Dansk
Nederlands
Suomi
Franais
Deutsch
Italiano
Norsk
Polski
Portugus
Romn
Espaol
Svenska
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 3/22
4. SMBIOSCR00110: correct typo in
table 24 (processor upgrade)
5. SMBIOSCR00118: new processor
family types
6. SMBIOSCR00121: new processor
family type
7. SMBIOSCR00122: new processor
upgrade type
8. SMBIOSCR00125: add new Intel
socket type
Memory Device (Type 17):
1. SMBIOSCR00109: add minimum,
maximum and configured voltages
2. SMBIOSCR00114: add LRDIMM to
memory device list
Other:
1. SMBIOSCR00116: correct/clarify
structure length fields
2. SMBIOSCR00120: add new
supported processor architectures
3. SMBIOSCR00123: update referenced
specifications
4. Wording updates for clarity and
consistency
Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC,
SMBIOS | Permalink.
March 27, 2013
Leave a comment
Getting Processor Info using
Object Pascal (Delphi / FPC) and
the TSMBIOS
ARCHI VES
April 2013 (2)
March 2013 (4)
February 2013 (3)
December 2012 (1)
November 2012 (1)
September 2012 (11)
August 2012 (3)
July 2012 (1)
June 2012 (2)
May 2012 (2)
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 4/22
The SMBIOS expose the info
about the installed processors in
the table type 4. Check the next
snippet that shows how obtain
such data using the TSMBIOS (remember, if you
are using FPC, you can use this library in Windows
and Linux).
{$IFDEF FPC}{$mode objfpc}{$H+}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
Classes,
TypInfo,
SysUtils,
uSMBIOS;
function SetToString(Info: PTypeInfo; const Value): String;
var
LTypeInfo : PTypeInfo;
LIntegerSet: TIntegerSet;
I: Integer;
begin
Result := '';
Integer(LIntegerSet) := 0;
case GetTypeData(Info)^.OrdType of
otSByte, otUByte: Integer(LIntegerSet) := Byte(Value);
otSWord, otUWord: Integer(LIntegerSet) := Word(Value);
otSLong, otULong: Integer(LIntegerSet) := Integer(Value);
end;
LTypeInfo := GetTypeData(Info)^.CompType{$IFNDEF FPC}^{$ENDIF};
for I := 0 to SizeOf(Integer) * 8 - 1 do
if I in LIntegerSet then
begin
if Result '' then Result := Result + ',';
Result := Result + GetEnumName(LTypeInfo, I);
end;
end;
procedure GetProcessorInfo;
Var
SMBios : TSMBios;
LProcessorInfo : TProcessorInformation;
April 2012 (3)
March 2012 (6)
February 2012 (3)
January 2012 (4)
December 2011 (2)
November 2011 (7)
October 2011 (11)
September 2011 (3)
August 2011 (1)
July 2011 (5)
June 2011 (5)
May 2011 (3)
April 2011 (3)
March 2011 (5)
February 2011 (6)
January 2011 (1)
December 2010 (6)
November 2010 (6)
October 2010 (9)
August 2010 (4)
June 2010 (1)
April 2010 (1)
March 2010 (2)
February 2010 (4)
January 2010 (1)
December 2009 (5)
November 2009 (3)
October 2009 (16)
September 2009 (17)
BLOGROLL
Andys Blog and Tools
Delphi Neftali
Delphi Haven Chris
Rolliston Blog
Delphi sorcery Stefan
Glienke's Blog
Delphifeeds.com
Felix J COLIBRI
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 5/22
LSRAMTypes : TCacheSRAMTypes;
begin
SMBios:=TSMBios.Create;
try
WriteLn('Processor Information');
if SMBios.HasProcessorInfo then
for LProcessorInfo in SMBios.ProcessorInfo do
begin
WriteLn('Manufacturer '+LProcessorInfo.ProcessorManufacturerStr);
WriteLn('Socket Designation '+LProcessorInfo.SocketDesignationStr);
WriteLn('Type '+LProcessorInfo.ProcessorTypeStr);
WriteLn('Familiy '+LProcessorInfo.ProcessorFamilyStr);
WriteLn('Version '+LProcessorInfo.ProcessorVersionStr);
WriteLn(Format('Processor ID %x',[LProcessorInfo.RAWProcessorInformation^.ProcessorID]));
WriteLn(Format('Voltaje %n',[LProcessorInfo.GetProcessorVoltaje]));
WriteLn(Format('External Clock %d Mhz',[LProcessorInfo.RAWProcessorInformation^.ExternalClock]));
WriteLn(Format('Maximum processor speed %d Mhz',[LProcessorInfo.RAWProcessorInformation^.MaxSpeed]));
WriteLn(Format('Current processor speed %d Mhz',[LProcessorInfo.RAWProcessorInformation^.CurrentSpeed]));
WriteLn('Processor Upgrade '+LProcessorInfo.ProcessorUpgradeStr);
WriteLn(Format('External Clock %d Mhz',[LProcessorInfo.RAWProcessorInformation^.ExternalClock]));
if SMBios.SmbiosVersion>='2.3' then
begin
WriteLn('Serial Number '+LProcessorInfo.SerialNumberStr);
WriteLn('Asset Tag '+LProcessorInfo.AssetTagStr);
WriteLn('Part Number '+LProcessorInfo.PartNumberStr);
if SMBios.SmbiosVersion>='2.5' then
begin
WriteLn(Format('Core Count %d',[LProcessorInfo.RAWProcessorInformation^.CoreCount]));
WriteLn(Format('Cores Enabled %d',[LProcessorInfo.RAWProcessorInformation^.CoreEnabled]));
WriteLn(Format('Threads Count %d',[LProcessorInfo.RAWProcessorInformation^.ThreadCount]));
WriteLn(Format('Processor Characteristics %.4x',[LProcessorInfo.RAWProcessorInformation^.ProcessorCharacteristics]));
end;
end;
Writeln;
if (LProcessorInfo.RAWProcessorInformation^.L1CacheHandle>0) and (LProcessorInfo.L2Chachenil) then
begin
WriteLn('L1 Cache Handle Info');
WriteLn('--------------------');
WriteLn(' Socket Designation '+LProcessorInfo.L1Chache.SocketDesignationStr);
WriteLn(Format(' Cache Configuration %.4x',[LProcessorInfo.L1Chache.RAWCacheInformation^.CacheConfiguration]));
WriteLn(Format(' Maximum Cache Size %d Kb',[LProcessorInfo.L1Chache.GetMaximumCacheSize]));
WriteLn(Format(' Installed Cache Size %d Kb',[LProcessorInfo.L1Chache.GetInstalledCacheSize]));
LSRAMTypes:=LProcessorInfo.L1Chache.GetSupportedSRAMType;
WriteLn(Format(' Supported SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
LSRAMTypes:=LProcessorInfo.L1Chache.GetCurrentSRAMType;
WriteLn(Format(' Current SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
WriteLn(Format(' Error Correction Type %s',[ErrorCorrectionTypeStr[LProcessorInfo.L1Chache.GetErrorCorrectionType]]));
WriteLn(Format(' System Cache Type %s',[SystemCacheTypeStr[LProcessorInfo.L1Chache.GetSystemCacheType]]));
Hallvard's Blog
Hey, Scripting Guy! Blog
JEDI Windows API
Peter Johnson's
DelphiDabbler.com
Reinvent The Wheel
RemObject Blog
Rudy's Delphi Corner
Scott Hanselman Blog
Sip from the Firehose
The Art of Delphi
Programming
The Delphi Geek
The Old New Thing
The Oracle at Delphi
YAPB Alex Ciobanu
Blog
RECENT POSTS
Added support for
RAD Studio XE4 in the
Delphi IDE
Theme Editor.
Added support to
TSMBIOS for SMBIOS
2.8 spec.
Getting Processor
Info using Object
Pascal (Delphi / FPC)
and the TSMBIOS
Vcl Styles Utils
updated to fix QC
#114040, #114032
(XE2 and XE3)
Getting Memory
Device Info using
Object Pascal (Delphi /
FPC) and
the TSMBIOS
CATEGORI ES
.Net (14)
ADO (2)
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 6/22
WriteLn(Format(' Associativity %s',[LProcessorInfo.L1Chache.AssociativityStr]));
end;
if (LProcessorInfo.RAWProcessorInformation^.L2CacheHandle>0) and (LProcessorInfo.L2Chachenil) then
begin
WriteLn('L2 Cache Handle Info');
WriteLn('--------------------');
WriteLn(' Socket Designation '+LProcessorInfo.L2Chache.SocketDesignationStr);
WriteLn(Format(' Cache Configuration %.4x',[LProcessorInfo.L2Chache.RAWCacheInformation^.CacheConfiguration]));
WriteLn(Format(' Maximum Cache Size %d Kb',[LProcessorInfo.L2Chache.GetMaximumCacheSize]));
WriteLn(Format(' Installed Cache Size %d Kb',[LProcessorInfo.L2Chache.GetInstalledCacheSize]));
LSRAMTypes:=LProcessorInfo.L2Chache.GetSupportedSRAMType;
WriteLn(Format(' Supported SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
LSRAMTypes:=LProcessorInfo.L2Chache.GetCurrentSRAMType;
WriteLn(Format(' Current SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
WriteLn(Format(' Error Correction Type %s',[ErrorCorrectionTypeStr[LProcessorInfo.L2Chache.GetErrorCorrectionType]]));
WriteLn(Format(' System Cache Type %s',[SystemCacheTypeStr[LProcessorInfo.L2Chache.GetSystemCacheType]]));
WriteLn(Format(' Associativity %s',[LProcessorInfo.L2Chache.AssociativityStr]));
end;
if (LProcessorInfo.RAWProcessorInformation^.L3CacheHandle>0) and (LProcessorInfo.L3Chachenil) then
begin
WriteLn('L3 Cache Handle Info');
WriteLn('--------------------');
WriteLn(' Socket Designation '+LProcessorInfo.L3Chache.SocketDesignationStr);
WriteLn(Format(' Cache Configuration %.4x',[LProcessorInfo.L3Chache.RAWCacheInformation^.CacheConfiguration]));
WriteLn(Format(' Maximum Cache Size %d Kb',[LProcessorInfo.L3Chache.GetMaximumCacheSize]));
WriteLn(Format(' Installed Cache Size %d Kb',[LProcessorInfo.L3Chache.GetInstalledCacheSize]));
LSRAMTypes:=LProcessorInfo.L3Chache.GetSupportedSRAMType;
WriteLn(Format(' Supported SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
LSRAMTypes:=LProcessorInfo.L3Chache.GetCurrentSRAMType;
WriteLn(Format(' Current SRAM Type [%s]',[SetToString(TypeInfo(TCacheSRAMTypes), LSRAMTypes)]));
WriteLn(Format(' Error Correction Type %s',[ErrorCorrectionTypeStr[LProcessorInfo.L3Chache.GetErrorCorrectionType]]));
WriteLn(Format(' System Cache Type %s',[SystemCacheTypeStr[LProcessorInfo.L3Chache.GetSystemCacheType]]));
WriteLn(Format(' Associativity %s',[LProcessorInfo.L3Chache.AssociativityStr]));
end;
Readln;
end
else
Writeln('No Processor Info was found');
finally
SMBios.Free;
end;
end;
ADSI (1)
Applications (13)
Bing API (3)
C# (2)
C++ Builder (1)
COM (8)
Cpp (1)
Delphi (154)
Delphi 2010 (7)
Delphi Prism (13)
Delphi XE (7)
Delphi XE2 (24)
Delphi XE3 (12)
Delphi-News (12)
DWM (3)
Firebird (1)
FireMonkey (1)
FreePascal (8)
Geolocation (3)
Google Api (8)
Google labs (2)
InnoSetup (1)
Javascript (1)
JEDI API (2)
json (2)
Lazarus (6)
Networking (11)
PreviewHandler (1)
Rest (1)
RTTI (4)
SMBios (6)
SQL CLR (1)
Sql Server (1)
StackOverflow (2)
Tools (2)
TWebBrowser (2)
Uncategorized (1)
VCL Styles (23)
WinApi (16)
WinInet (1)
WMI (36)
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 7/22
Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC,
SMBIOS | Permalink.
March 21, 2013
2 Comments
Vcl Styles Utils updated to fix QC
#114040, #114032 (XE2 and XE3)
I just commit in the Vcl Styles Project two new
fixes to patch the QC 114040 and QC 114032 (these
issues exist in Delphi XE2 and XE3), both reports
are related to the Highlight colors used to draw
the TColorBox and TComboBoxEx components
when the Vcl Styles are active.
WUA (1)
XML (2)
XPath (2)
TWI TTER UPDATES
RT @MacinCloud: #RAD
Studio #PAServer XE4 -
#Delphi Platform
Assistant Server now
available on all
MacinCloud Servers.
Develop... http://t.
1 day ago
Pascal still an advantage
for some iOS, Android
developers
zdnet.com/pascal-still-
a 1 day ago
RT @ttdummy: WebFMX
1.0 Released!
cybelesoft.com/blog/we
bfmx-1- 5 days ago
The TSMBIOS project
now supports older
#Delphi versions 5,6 7.
code.google.com/p/tsm
bios/ 1 week ago
WmiDelphCodeCreator
Revision 158: Improved
Vcl Styles support:
Changed Paths:
@Modify /trunk/Install
er.... bit.ly/13exprz
1 week ago
VI SI TORS TO THI SSI TE
DELPHI FEEDS
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 8/22
QC 114032
As you can see in the below image the TColorBox
component doesnt use the proper highlight color,
but the TColorListBox uses the highlight color of
the current Vcl Style.
The TColorBox control doesnt use a Style Hook,
so the fix was done using a interposer class. To
apply the path just add the Vcl.Styles.Fixes unit to
your uses list after of the Vcl.ExtCtrls unit. And the
result will be
QC 114040
The TComboBoxEx control have a similar issue.
Delphi XE4 IDE videos by
Jos Len May 14, 2013
Marco's Tech Blog
(marcocantu)
Be-Delphi Event 3.0 May
14, 2013 Behind the
connection (Franois
Piette)
iOS app dev with Delphi
XE4 and FireMonkey 3 is
a quantum leap beyond
XE2 May 14, 2013 Sip
from the Firehose (David
Intersimone)
My Delphi STOMP Client
is now compatibile with
iOS May 14, 2013 Daniele
Teti's programming blog
(Daniele Teti)
A few notes on Delphi,
WSDL and SOAP: passing
nil values,
Document/Literal versus
RPC Encoded May 14,
2013 The Wiert Corner
(jpluimers)
C++Builder XE4 use case:
(I need to) Build a Multi-
Device, Multi-Tier
Master/Detail database
application May 13, 2013
Sip from the Firehose
(David Intersimone)
How to get the latest
FireDAC update
8.0.3.3291 May 13, 2013
Delphi Insider (Tim Del
Chiaro)
Immutable strings in
Delphi? May 13, 2013
DelphiTools (Eric)
Internet Explorer
Automation Part 3 May
12, 2013 Behind the
connection (Franois
Piette)
Work in progress:
dwsLinq extension for
DWS May 11, 2013
TURBU Tech (Mason
Wheeler)
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 9/22
In this case fixing the Style Hook related to the
TComboBoxEx control was the key.
To apply this fix, just register the
TComboBoxExStyleHookFix style hook located in
the Vcl.Styles.Fixes unit.
Categories: Delphi, Delphi XE2, Delphi XE3, VCL Styles | Tags:
Delphi, Vcl Styles | Permalink.
STACKOVERFLOWDELPHI QUESTI ONS
How to get a single
Arabic letter in a string
with its Unicode
transformation value in
DELPHI? May 15, 2013
Hasan
How do I ignore the
response of a POST
request? May 15, 2013
Benjamin Weiss
trapping drag-and-drop
at design time in Delphi
for a TCustomGroupBox
descendant May 15,
2013 user2383818
When do I need
synchronize in TThread?
May 15, 2013 Benjamin
Weiss
Delphi 'private' clause
(directive) does not work
May 15, 2013 Yevgeniy
Afanasyev
Rad Studio XE4 vs Delphi
XE4 May 15, 2013 Cape
Cod Gunny
using windows key press
to break out of loop
(non keyPress event)
May 14, 2013 Jake Snake
How to pull a MDI child
window out of the main
form? May 14, 2013 EASI
Convert JSON String to
Image to send by SQL
May 14, 2013 Ricardo
Pascoal
Delphi 6 cursor not
changing May 14, 2013
GeoffM
THE NEW OLDTHI NG
Microspeak: booked
The secret lair of
Administrative Assistants
How can I display a live
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 10/22
March 18, 2013
6 Comments
Getting Memory Device Info using
Object Pascal (Delphi / FPC) and
the TSMBIOS
If you need to know what type of
RAM is installed in your system
or how is the manufacturer of
your memory device, you can try
reading the SPD (Serial presence detect) info
directly (but not all the memory devices exposes
the SPD info and reading the SPD require Kernel
Mode access) , use the Win32_PhysicalMemory
WMI class (but depending of the manufacturer the
WMI fails to get info about some memory
properties like the memory type) or using the
SMBIOS.
Using the SMBIOS you can get most of the info
related to the memory devices installed like
manufacturer, type, speed, serial number and so
on. The next snippet show how using the TSMBIOS
and Delphi (or FPC) you can retrieve such data.
{$IFDEF FPC}{$mode objfpc}{$H+}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
Classes,
SysUtils,
uSMBIOS;
procedure GetMemoryDeviceInfo;
Var
SMBios : TSMBios;
LMemoryDevice : TMemoryDeviceInformation;
begin
SMBios:=TSMBios.Create;
try
WriteLn('Memory Device Information');
WriteLn('-------------------------');
screenshot of a piece of
another application?
If you want to use a
name for your file
mapping, don't just use
the name of the file itself
Why am I getting
LNK2019 unresolved
external for my inline
function?
Mathematical formulas
are designed to be
pretty, not to be suitable
for computation
How to tell the poseurs
from the actual Windows
developers
Extending process
attribute inheritance
beyond its current
boundaries
Reading mouse input
from a console program,
and programmatically
turning off Quick Edit
mode
Creating a simple pidl:
For the times you care
enough to send the very
fake
REI NVENT THEWHEEL
An error has occurred;
the feed is probably
down. Try again later.
COMMUNI TY
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 11/22
if SMBios.HasMemoryDeviceInfo then
for LMemoryDevice in SMBios.MemoryDeviceInformation do
begin
WriteLn(Format('Total Width %d bits',[LMemoryDevice.RAWMemoryDeviceInfo^.TotalWidth]));
WriteLn(Format('Data Width %d bits',[LMemoryDevice.RAWMemoryDeviceInfo^.DataWidth]));
WriteLn(Format('Size %d Mbytes',[LMemoryDevice.GetSize]));
WriteLn(Format('Form Factor %s',[LMemoryDevice.GetFormFactor]));
WriteLn(Format('Device Locator %s',[LMemoryDevice.GetDeviceLocatorStr]));
WriteLn(Format('Bank Locator %s',[LMemoryDevice.GetBankLocatorStr]));
WriteLn(Format('Memory Type %s',[LMemoryDevice.GetMemoryTypeStr]));
WriteLn(Format('Speed %d MHz',[LMemoryDevice.RAWMemoryDeviceInfo^.Speed]));
WriteLn(Format('Manufacturer %s',[LMemoryDevice.ManufacturerStr]));
WriteLn(Format('Serial Number %s',[LMemoryDevice.SerialNumberStr]));
WriteLn(Format('Asset Tag %s',[LMemoryDevice.AssetTagStr]));
WriteLn(Format('Part Number %s',[LMemoryDevice.PartNumberStr]));
WriteLn;
if LMemoryDevice.RAWMemoryDeviceInfo^.PhysicalMemoryArrayHandle>0 then
begin
WriteLn(' Physical Memory Array');
WriteLn(' ---------------------');
WriteLn(' Location '+LMemoryDevice.PhysicalMemoryArray.GetLocationStr);
WriteLn(' Use '+LMemoryDevice.PhysicalMemoryArray.GetUseStr);
WriteLn(' Error Correction '+LMemoryDevice.PhysicalMemoryArray.GetErrorCorrectionStr);
if LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation^.MaximumCapacity$80000000 then
WriteLn(Format(' Maximum Capacity %d Kb',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation^.MaximumCapacity]))
else
WriteLn(Format(' Maximum Capacity %d bytes',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation^.ExtendedMaximumCapacity]));
WriteLn(Format(' Memory devices %d',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation^.NumberofMemoryDevices]));
end;
WriteLn;
end
else
Writeln('No Memory Device Info was found');
finally
SMBios.Free;
end;
end;
begin
try
GetMemoryDeviceInfo;
except
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;
Writeln('Press Enter to exit');
Readln;
TOP POSTS & PAGES
WMI Delphi Code
Creator
Using the Google Maps
API V3 from Delphi - Part
I Basic functionality
Exploring Delphi XE2 -
VCL Styles Part I
Changing the color of
Edit Controls with VCL
Styles Enabled
Delphi IDE Theme Editor
Compile, Debug and
Run your Pascal code
online.
Using the Google Maps
API V3 from Delphi Part
III Getting the latitude
and longitude of a
mouse click
Generating Qr Codes
with delphi
Generating a "unique"
hardware ID using
delphi and the WMI
Vcl Styles - Adding
background images and
colors to Delphi forms
Tweets by @RRUZ
!function(d,s,id){var
js,fjs=d.getElementsByTagName(s)
[0];if(!d.getElementById(id))
{js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}
(document,"script","twitter-
wjs");
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 12/22
end.
Note: Remember if you uses FPC, you can use this
library in linux as well :)
Categories: Delphi, SMBios | Tags: Delphi, FPC, SMBIOS |
Permalink.
March 12, 2013
2 Comments
Added new vcl style hook to the Vcl
Styles Utils to fix QC #108678,
#108875 (XE2 and XE3)
I just added a new vcl style hook
(TListViewStyleHookFix) for the TListView
component in the Vcl Styles Utils project to fix the
QC #108678, #108875 (XE2 and XE3)
The issue reported in both reports, is that the
images are not displayed in the TListView header
with the VCL Styles enabled.
When you uses the Windows Theme in a TListView
with images in the header will look like so
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 13/22
But if you enable the Vcl Styles, the images in the
header are lost.
The issue is located in the
TListViewStyleHook.DrawHeaderSection method,
this method must paint the image and text of each
section of the header of the ListView.
This is part of the code with the bug
...
...
ImageList := SendMessage(Handle, HDM_GETIMAGELIST, 0, 0);
Item.Mask := HDI_FORMAT or HDI_IMAGE;
InflateRect(R, -2, -2);
if (ImageList 0) and Header_GetItem(Handle, Index, Item) then
begin
if Item.fmt and HDF_IMAGE = HDF_IMAGE then
ImageList_Draw(ImageList, Item.iImage, Canvas.Handle, R.Left, R.Top, ILD_TRANSPARENT);
ImageList_GetIconSize(ImageList, IconWidth, IconHeight);
Inc(R.Left, IconWidth + 5);
end;
...
...
The problem with the above code is that the
SendMessage function with the
HDM_GETIMAGELIST message (which is used to
get the current imagelist) is not using the proper
Handle. The above code is passing the handle of
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 14/22
the ListView, but must pass the handle of the
Header control, the same applies to the call to the
Header_GetItem method.
The TListViewStyleHookFix introduces a new
DrawHeaderSection method which passes the
handle of the header control and fix the issue. You
can use this Stylehook adding Vcl.Styles.Fixes unit
to you uses clause and then register the hook on
this way.
initialization
TStyleManager.Engine.RegisterStyleHook(TListView, TListViewStyleHookFix);
Categories: Delphi, Delphi XE2, Delphi XE3, VCL Styles | Tags:
Delphi, Vcl Styles | Permalink.
February 19, 2013
Leave a comment
How distinguish when Windows
was installed in Legacy BIOS or
UEFI mode using Delphi?
As part of the TSMBIOS project, I needed a
method to distinguish when Windows was
installed in Legacy BIOS or UEFI mode. The
solution was provided by the
GetFirmwareEnvironmentVariable function.
The msdn documentation states
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 15/22
Firmware variables are not supported
on a legacy BIOS-based system. The
GetFirmwareEnvironmentVariable
function will always fail on a legacy
BIOS-based system, or if Windows was
installed using legacy BIOS on a system
that supports both legacy BIOS and
UEFI. To identify these conditions, call
the function with a dummy firmware
environment name such as an empty
string () for the lpName parameter
and a dummy GUID such as
{00000000-0000-0000-0000-
000000000000} for the lpGuid
parameter. On a legacy BIOS-based
system, or on a system that supports
both legacy BIOS and UEFI where
Windows was installed using legacy
BIOS, the function will fail with
ERROR_INVALID_FUNCTION. On a
UEFI-based system, the function will fail
with an error specific to the firmware,
such as ERROR_NOACCESS, to indicate
that the dummy GUID namespace does
not exist.
.
So the Delphi code to detect such condition will be
something like so
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils;
function GetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCSTR; pBuffer: Pointer;
nSize: DWORD): DWORD; stdcall; external kernel32 name 'GetFirmwareEnvironmentVariableA';
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 16/22
begin
try
GetFirmwareEnvironmentVariableA('','{00000000-0000-0000-0000-000000000000}', nil,0);
if (GetLastError = ERROR_INVALID_FUNCTION) then
Writeln('Legacy BIOS')
else
Writeln('UEFI Boot Mode');
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Readln;
end.
Categories: Delphi, WinApi | Tags: Delphi, UEFI, winapi |
Permalink.
February 18, 2013
Leave a comment
Added Linux support to the
TSMBIOS Project
Great news for the Free Pascal developers, I just
added Linux support to the TSMBIOS project.
Note : The TSMBIOS read the SMBIOS info using
the /dev/mem device file which provides access
to system physical memory, so the code must be
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 17/22
executed using a user with the proper
permissions.
Categories: Delphi, FreePascal, SMBios, Tools | Tags: Delphi,
FPC, SMBIOS | Permalink.
February 12, 2013
5 Comments
Introducing TSMBIOS
A few weeks ago I started a new
project called TSMBIOS, this is a library
which allows access the SMBIOS using
the Object Pascal language (Delphi or Free
Pascal).
What is the SMBIOS?
SMBIOS stands for System Management BIOS ,
this standard is tightly related and developed by
the DMTF (Desktop Management Task Force).
The SMBIOS contains a description of the systems
hardware components, the information stored in
the SMBIOS typically includes system
manufacturer, model name, serial numbers, BIOS
version, asset tag, processors, ports, device
memory installed and so on.
Note : The amount and accuracy of the
SMBIOS information depends on the
computer manufacturer.
Which are the advantages of use
the SMBIOS?
You can retrieve the information without
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 18/22
having to probe for the actual hardware. this
is a good point in terms of speed and
safeness.
The SMBIOS information is very well
documented.
You can avoid the use of undocumented
functions to get hardware info (for example
the RAM type and manufacturer).
Useful for create a Hardware ID (machine
fingerprint).
How it works?
The BIOS typically populates the SMBIOS
structures at system boot time, and is not in
control when the OS is running. Therefore,
dynamically changing data is rarely represented in
SMBIOS tables.
The SMBIOS Entry Point is located somewhere
between the addresses 0xF0000 and 0xFFFFF, in
early Windows systems (Win95, Win98) it was
possible access this space address directly, but
after with the introduction of the NT Systems and
the new security changes the BIOS was accessible
through section \Device\PhysicalMemory, but this
last method was disabled as well in Windows
Server 2003 Service Pack 1, and replaced with 2
new WinApi functions the
EnumSystemFirmwareTables and
GetSystemFirmwareTable, Additionally the WMI
supports reading the entire contents of SMBIOS
data i using the MSSMBios_RawSMBiosTables
class inside of the root\wmi namespace.
Note : you can find more information about
the SMBIOS Support in Windows on this link.
The TSMBIOS can be compiled using a WinApi
mode (uses the GetSystemFirmwareTable function)
or using the WMI Mode (uses the
MSSMBios_RawSMBiosTables class)
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 19/22
If you uses the WinApi Mode you dont need use
COM and the final size of the Application will be
smaller, but the WinAPI functions was introduced
in Windows Vista and Windows XP x64 (So in
Windows Xp x86 will fail). Otherwise using the
WMI mode you will need use COM (CoInitialize
and CoUninitialize), but also you will get two
additional advantages 1) The WMI will work even
in Windows Xp x86 systems, 2) You can read then
SMBIOS data of local and remote computers.
In order to use the TSMBIOS in your application
only you must add the uSMBIOS unit to your uses
clause, then create a instance for the TSMBios
class using the proper constructor
// Default constructor, used for populate the TSMBIOS class using the current mode selected (WMI or WinApi)
constructor Create; overload;
// Use this constructor to load the SMBIOS data from a previously saved file.
constructor Create(const FileName : string); overload;
{$IFDEF USEWMI}
// Use this constructor to read the SMBIOS from a remote machine.
constructor Create(const RemoteMachine, UserName, Password : string); overload;
{$ENDIF}
and finally use the property which expose the
SMBIOS info which you need. In this case as is
show in the sample code the BatteryInformation
property is used to get all the info of the batteries
installed on the system.
{$APPTYPE CONSOLE}
uses
Classes,
SysUtils,
uSMBIOS in '..\..\Common\uSMBIOS.pas';
procedure GetBatteryInfo;
Var
SMBios : TSMBios;
LBatteryInfo : TBatteryInformation;
begin
SMBios:=TSMBios.Create;
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 20/22
try
WriteLn('Battery Information');
WriteLn('-------------------');
if SMBios.HasBatteryInfo then
for LBatteryInfo in SMBios.BatteryInformation do
begin
WriteLn('Location '+LBatteryInfo.GetLocationStr);
WriteLn('Manufacturer '+LBatteryInfo.GetManufacturerStr);
WriteLn('Manufacturer Date '+LBatteryInfo.GetManufacturerDateStr);
WriteLn('Serial Number '+LBatteryInfo.GetSerialNumberStr);
WriteLn('Device Name '+LBatteryInfo.GetDeviceNameStr);
WriteLn('Device Chemistry '+LBatteryInfo.GetDeviceChemistry);
WriteLn(Format('Design Capacity %d mWatt/hours',[LBatteryInfo.RAWBatteryInfo.DesignCapacity*LBatteryInfo.RAWBatteryInfo.DesignCapacityMultiplier]));
WriteLn(Format('Design Voltage %d mVolts',[LBatteryInfo.RAWBatteryInfo.DesignVoltage]));
WriteLn('SBDS Version Number '+LBatteryInfo.GetSBDSVersionNumberStr);
WriteLn(Format('Maximum Error in Battery Data %d%%',[LBatteryInfo.RAWBatteryInfo.MaximumErrorInBatteryData]));
WriteLn(Format('SBDS Version Number %.4x',[LBatteryInfo.RAWBatteryInfo.SBDSSerialNumber]));
WriteLn('SBDS Manufacture Date '+LBatteryInfo.GetSBDSManufactureDateStr);
WriteLn('SBDS Device Chemistry '+LBatteryInfo.GetSBDSDeviceChemistryStr);
WriteLn(Format('OEM Specific %.8x',[LBatteryInfo.RAWBatteryInfo.OEM_Specific]));
WriteLn;
end
else
Writeln('No Battery Info was found');
finally
SMBios.Free;
end;
end;
begin
try
GetBatteryInfo;
except
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;
Writeln('Press Enter to exit');
Readln;
end.
TSMBIOS Features
Source Full documented compatible with the
help insight feature, available since Delphi
2005.
Supports SMBIOS Version from 2.1 to 2.7.1
Supports Delphi 5, 6, 7, 2005, BDS/Turbo 2006
and RAD Studio 2007, 2009, 2010, XE, XE2,
XE3, XE4.
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 21/22
Compatible with FPC 2.6.0 (Windows and
Linux)
SMBIOS Data can be obtained using WinApi,
WMI or loading a saved SMBIOS dump
SMBIOS Data can be saved and load to a file
SMBIOS Data can be obtained from remote
machines
SMBIOS Tables supported
BIOS Information (Type 0)
System Information (Type 1)
Baseboard (or Module) Information (Type 2)
System Enclosure or Chassis (Type 3)
Processor Information (Type 4)
Cache Information (Type 7)
Port Connector Information (Type 8)
System Slots (Type 9)
OEM Strings (Type 11)
System Configuration Options (Type 12)
BIOS Language Information (Type 13)
Physical Memory Array (Type 16)
Memory Device (Type 17)
Memory Array Mapped Address (Type 19)
Memory Device Mapped Address (Type 20)
Built-in Pointing Device (Type 21)
Portable Battery (Type 22)
Voltage Probe (Type 26)
Cooling Device (Type 27)
Temperature Probe (Type 28)
Electrical Current Probe (Type 29)
The TSMBIOS is a Open Source project
is hosted in the code google site.
Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC,
SMBIOS | Permalink.
December 17,
2012
-
5/15/13 Delphi | The Road to Delphi - a Blog about programming
theroadtodelphi.wordpress.com/category/delphi/ 22/22
Leave a comment
Delphi XE3 Vcl Styles Additions
Alexey Sharagin from Embarcadero just wrote a
blog article titled Tuning VCL Styles for Forms and
Controls, which shows some features related to the
VCL Styles introduced in Delphi XE3.
Categories: Delphi, Delphi XE3, VCL Styles | Tags: Delphi, Vcl
Styles | Permalink.
Older posts
Blog at WordPress.com. | Theme: Yoko by Elmastudio
Top
top related