<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7497031730574139923</atom:id><lastBuildDate>Sat, 28 Mar 2026 11:13:52 +0000</lastBuildDate><category>database</category><category>system</category><category>API</category><category>Application</category><category>setting</category><category>installation</category><category>file</category><category>hide</category><category>kill</category><category>network</category><category>overview</category><category>text</category><category>pictures</category><category>registry</category><category>time</category><category>clipboard</category><category>desktop</category><category>keyboard</category><category>multimedia</category><category>path</category><category>recycle bin</category><category>taskbar</category><category>CD ROM</category><category>email</category><category>hard disk</category><category>mouse</category><category>screen saver</category><category>Assembler</category><category>RGP4FGFRB5YK</category><category>internet</category><category>monitor</category><category>printer</category><title>Delphi</title><description>Borland, Delphi, Pascal, Programming, Free Codes, Free Examples, Free Downloads, Source Codes, Free Component</description><link>http://greatdelphi.blogspot.com/</link><managingEditor>noreply@blogger.com (Delphi)</managingEditor><generator>Blogger</generator><openSearch:totalResults>180</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><copyright>great delphi made this, please do not publish wighout permit.</copyright><itunes:keywords>Borland,Delphi,Pascal,Programming,Free,Codes,Free,Examples,Free,Downloads,Source,Codes,Free,Component</itunes:keywords><itunes:summary>Borland, Delphi, Pascal, Programming, Free Codes, Free Examples, Free Downloads, Source Codes, Free Component</itunes:summary><itunes:subtitle>Delphi - The Greatest Programming Language</itunes:subtitle><itunes:category text="Education"><itunes:category text="Educational Technology"/></itunes:category><itunes:category text="Technology"><itunes:category text="Software How-To"/></itunes:category><itunes:author>great delphi</itunes:author><itunes:owner><itunes:email>greatdelphi.blogspot.com</itunes:email><itunes:name>great delphi</itunes:name></itunes:owner><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-3348421919516445173</guid><pubDate>Fri, 25 Nov 2011 15:00:00 +0000</pubDate><atom:updated>2011-11-25T07:00:15.905-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">RGP4FGFRB5YK</category><title>RGP4FGFRB5YK</title><description>RGP4FGFRB5YK&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2011/11/rgp4fgfrb5yk.html</link><thr:total>4</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-4865373151884782124</guid><pubDate>Sun, 22 Aug 2010 09:03:00 +0000</pubDate><atom:updated>2010-08-22T02:03:00.253-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">email</category><title>Send Email from Delphi</title><description>It can be so easy to have your application pop up an email window. &lt;br /&gt;
Assuming that an a mail reader is installed.&lt;br /&gt;
&lt;br /&gt;
Uses ShellAPI;&lt;br /&gt;
&lt;br /&gt;
ShellExecute(0,'open','mailto:DePaasHaas@DePaasHaas.com?subject=nice job', NIL, NIL, SW_SHOWNORMAL);&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/send-email-from-delphi.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-4956802058347707242</guid><pubDate>Fri, 20 Aug 2010 09:02:00 +0000</pubDate><atom:updated>2010-08-20T02:02:00.597-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">email</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>send e-mail 1</title><description>You must have the component TNMSMTP from FastNet tools. This component is included in Delphi 4-5 Professional and Enterprise &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.Button1Click(Sender:Object); &lt;br /&gt;
Begin     &lt;br /&gt;
NMSMTP1.Host  := 'mail.host.com'; &lt;br /&gt;
NMSMTP1.UserID:= 'username'; &lt;br /&gt;
NMSMTP1.Connect;&lt;br /&gt;
NMSMTP1.PostMessage.FromAddress:='webmaster@swissdelphicenter.ch';&lt;br /&gt;
NMSMTP1.PostMessage.ToAddress.Text := 'user@host.com'; &lt;br /&gt;
NMSMTP1.PostMessage.Body.Text := 'This is the message'; &lt;br /&gt;
NMSMTP1.PostMessage.Subject:='Mailsubject; &lt;br /&gt;
NMSMTP1.SendMail; &lt;br /&gt;
showmessage('Mail sent !'); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/send-e-mail-1.html</link><thr:total>7</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-4334102090123974474</guid><pubDate>Wed, 18 Aug 2010 09:00:00 +0000</pubDate><atom:updated>2010-08-18T02:00:03.103-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">system</category><title>How to get list of font available from system,  and it's info / properties ?</title><description>To get a list of fonts available we have to use EnumFontFamilies or EnumFonts Win32 API functions. For a description of the differences between those two functions please refer to Win32 SDK documentation. I'll use the first one (EnumFontFalimiles) for this example. &lt;br /&gt;
&lt;br /&gt;
Win32 API provides several enumeration functions for various tasks. There are functions capable of enumerating installed fonts, printers and so on. All those enumerating functions require you to pass a callback function, actually the function pointer, as one of its parameters. &lt;br /&gt;
&lt;br /&gt;
A callback function is one function coded and provided to the system by the programmer. The system uses the function, the programmer passes as a parameter to an EnumXXXX function, to pass the requested information back. &lt;br /&gt;
&lt;br /&gt;
Here is how you might code a call to EnumFontFamilies function: &lt;br /&gt;
&lt;br /&gt;
var &lt;br /&gt;
DC: HDC; &lt;br /&gt;
begin &lt;br /&gt;
DC := GetDC(0); { get screen's device context } &lt;br /&gt;
try &lt;br /&gt;
EnumFontFamilies(DC, nil, @EnumFontsProc, LongInt(ComboBox1)); &lt;br /&gt;
finally &lt;br /&gt;
ReleaseDC(0, DC); { release device context } &lt;br /&gt;
end; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
The first parameter, DC, is a device context. Check "Device Contexts" topic of the Win32 SDK for more info on device contexts. We are passing screen's device context here since we are interested for screen fonts. &lt;br /&gt;
&lt;br /&gt;
The second parameter is a PChar specifying the family name of the desired fonts. Since we want all the available information we pass nil. &lt;br /&gt;
&lt;br /&gt;
The third parameter is the pointer to the callback function we provide. We didn't actually code it yet. We'll do that in a minute. As you know the "@ operator returns the address of a variable, or of a function, procedure, or method; that is, @ constructs a pointer to its operand" as Delphi's online help states. &lt;br /&gt;
&lt;br /&gt;
The last parameter is a Longint. Anything that could be typecasted as a LongInt could be passed here. It's up to us to decide what to pass. &lt;br /&gt;
Remember, an object could be typecasted to a LongInt as &lt;br /&gt;
Longint(MyObject) &lt;br /&gt;
and then pass it to the function. &lt;br /&gt;
&lt;br /&gt;
Here is how the EnumFontsProc, the callback function provided by the programmer, might look like: &lt;br /&gt;
&lt;br /&gt;
function EnumFontsProc(var EnumLogFont: TEnumLogFont; var TextMetric: TNewTextMetric; FontType: Integer; Data: LPARAM): Integer; stdcall; &lt;br /&gt;
var &lt;br /&gt;
FontName: string; &lt;br /&gt;
CB : TComboBox; &lt;br /&gt;
begin &lt;br /&gt;
CB := TComboBox(Data); &lt;br /&gt;
FontName := StrPas(EnumLogFont.elfLogFont.lfFaceName); &lt;br /&gt;
if (CB.Items.IndexOf(FontName) &lt; 0) then 
if (FontType = TRUETYPE_FONTTYPE) then 
CB.Items.Add(FontName); 
Result := 1; 
end; 

For a complete description of the TEnumLogFont and TNewTextMetric please refer to Win32 SDK. I think it's enough to say that they hold all the info the system could provide us regarding a font. They are declared in Windows.pas. 

The FontType could be one of the following integer constants declared in Windows.pas too 

RASTER_FONTTYPE = 1; 
DEVICE_FONTTYPE = 2; 
TRUETYPE_FONTTYPE = 4; 


Here is how this mechanism works: 
Windows randomly selects one font of each available type family, since we have passed nil as the second parameter to EnumFontFamilies, and passes the available information for that font to your callback function, EnumFontsProc in this case. 

The enumeration will continue until either the callback return 0 (we constantly retrun 1) or there are no more fonts to enumerate. 

Inside the EnumFontsProc we might examine each font passed and do what we want to do with the available information. In the above code I just add the FontNames to a ComboBox items. 

Following is a class I've coded to make the task easier: 


type 
TFontType = (ftRaster, ftDevice, ftTrueType); 
(*----------------------------------------------------------------------------------*) 
TFontInfo = class 
private 
FShortName : string; 
FFullName : string; 
FStyle : string; 
FLF : TLogFont; 
FFontType : TFontType; 
FTM : TNewTextMetric; 
public 
property FullName : string read FFullName ; 
property ShortName : string read FShortName; 
property Style : string read FStyle ; 
property FontType : TFontType read FFontType ; 
property TM : TNewTextMetric read FTM ; 
property LF : TLogFont read FLF ; 
end; 
(*----------------------------------------------------------------------------------*) 
TFontList = class 
private 
procedure ClearList; 
procedure AddFont(EnumLogFont: TEnumLogFont; TextMetric: TNewTextMetric; FontType: Integer); 
public 
List : TStringList; 
constructor Create; 
destructor Destroy; override; 
procedure RefreshFontInfo; 
end; 


{ TFontList } 
(*----------------------------------------------------------------------------------*) 
constructor TFontList.Create; 
begin 
inherited Create; 
List := TStringList.Create; 
List.Sorted := True; 
end; 
(*----------------------------------------------------------------------------------*) 
destructor TFontList.Destroy; 
begin 
ClearList; 
inherited Destroy; 
end; 
(*----------------------------------------------------------------------------------*) 
procedure TFontList.ClearList; 
begin 
while List.Count &gt; 0 do &lt;br /&gt;
begin &lt;br /&gt;
TFontInfo(List.Objects[0]).Free; &lt;br /&gt;
List.Delete(0); &lt;br /&gt;
end; &lt;br /&gt;
end; &lt;br /&gt;
(*----------------------------------------------------------------------------------*) &lt;br /&gt;
function EnumFontsProc(var EnumLogFont: TEnumLogFont; var TextMetric: TNewTextMetric; FontType: Integer; Data: LPARAM): Integer; stdcall; &lt;br /&gt;
var &lt;br /&gt;
FontList : TFontList; &lt;br /&gt;
begin &lt;br /&gt;
FontList := TFontList(Data); &lt;br /&gt;
FontList.AddFont(EnumLogFont, TextMetric, FontType); &lt;br /&gt;
Result := 1; &lt;br /&gt;
end; &lt;br /&gt;
(*----------------------------------------------------------------------------------*) &lt;br /&gt;
procedure TFontList.AddFont(EnumLogFont: TEnumLogFont; TextMetric: TNewTextMetric; FontType: Integer); &lt;br /&gt;
var &lt;br /&gt;
FI : TFontInfo; &lt;br /&gt;
begin &lt;br /&gt;
FI := TFontInfo.Create; &lt;br /&gt;
&lt;br /&gt;
FI.FShortName := StrPas(EnumLogFont.elfLogFont.lfFaceName); &lt;br /&gt;
FI.FFullName := StrPas(EnumLogFont.elfFullName); &lt;br /&gt;
FI.FStyle := StrPas(EnumLogFont.elfStyle); &lt;br /&gt;
FI.FLF := EnumLogFont.elfLogFont; &lt;br /&gt;
&lt;br /&gt;
case FontType of &lt;br /&gt;
RASTER_FONTTYPE : FI.FFontType := ftRaster; &lt;br /&gt;
DEVICE_FONTTYPE : FI.FFontType := ftDevice; &lt;br /&gt;
TRUETYPE_FONTTYPE : FI.FFontType := ftTrueType; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
FI.FTM := TextMetric; &lt;br /&gt;
&lt;br /&gt;
List.AddObject(FI.FShortName, FI); &lt;br /&gt;
end; &lt;br /&gt;
(*----------------------------------------------------------------------------------*) &lt;br /&gt;
procedure TFontList.RefreshFontInfo; &lt;br /&gt;
var &lt;br /&gt;
DC: HDC; &lt;br /&gt;
begin &lt;br /&gt;
ClearList; &lt;br /&gt;
DC := GetDC(0); &lt;br /&gt;
try &lt;br /&gt;
EnumFontFamilies(DC, nil, @EnumFontsProc, Longint(Self)); &lt;br /&gt;
finally &lt;br /&gt;
ReleaseDC(0, DC); &lt;br /&gt;
end; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here is an example use: &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
var &lt;br /&gt;
FontList : TFontList; &lt;br /&gt;
begin &lt;br /&gt;
ListBox1.Clear; &lt;br /&gt;
FontList := TFontList.Create; &lt;br /&gt;
try &lt;br /&gt;
FontList.RefreshFontInfo; &lt;br /&gt;
ListBox1.Items.AddStrings(FontList.List); &lt;br /&gt;
finally &lt;br /&gt;
FontList.Free; &lt;br /&gt;
end; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/how-to-get-list-of-font-available-from.html</link><thr:total>47</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-2447429529923297554</guid><pubDate>Mon, 16 Aug 2010 08:59:00 +0000</pubDate><atom:updated>2010-08-16T01:59:00.295-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>How do I accept files that are dropped on my application?</title><description>You must interface with the Windows Shell API module to let &lt;br /&gt;
Windows know that your application accepts dropped files (this &lt;br /&gt;
can be done in your main form's create event), and then you must &lt;br /&gt;
respond to the drag events as they happen by creating an event &lt;br /&gt;
handler. &lt;br /&gt;
&lt;br /&gt;
The following is an example of a Delphi form that accepts dropped &lt;br /&gt;
files and adds the names of the files to a memo component: &lt;br /&gt;
&lt;br /&gt;
unit Unit1; &lt;br /&gt;
&lt;br /&gt;
interface &lt;br /&gt;
&lt;br /&gt;
uses &lt;br /&gt;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, &lt;br /&gt;
Dialogs, StdCtrls; &lt;br /&gt;
&lt;br /&gt;
type &lt;br /&gt;
TForm1 = class(TForm) &lt;br /&gt;
Memo1: TMemo; &lt;br /&gt;
procedure FormCreate(Sender: TObject); &lt;br /&gt;
private &lt;br /&gt;
procedure WMDROPFILES(var Message: TWMDROPFILES); &lt;br /&gt;
message WM_DROPFILES; &lt;br /&gt;
{ Private declarations } &lt;br /&gt;
public &lt;br /&gt;
{ Public declarations } &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
var &lt;br /&gt;
Form1: TForm1; &lt;br /&gt;
&lt;br /&gt;
implementation &lt;br /&gt;
&lt;br /&gt;
{$R *.DFM} &lt;br /&gt;
&lt;br /&gt;
uses ShellApi; &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.FormCreate(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
{Let Windows know we accept dropped files} &lt;br /&gt;
DragAcceptFiles(Form1.Handle, True); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.WMDROPFILES(var Message: TWMDROPFILES); &lt;br /&gt;
var &lt;br /&gt;
NumFiles : longint; &lt;br /&gt;
i : longint; &lt;br /&gt;
buffer : array[0..255] of char; &lt;br /&gt;
begin &lt;br /&gt;
{How many files are being dropped} &lt;br /&gt;
NumFiles := DragQueryFile(Message.Drop, &lt;br /&gt;
-1, &lt;br /&gt;
nil, &lt;br /&gt;
0); &lt;br /&gt;
{Accept the dropped files} &lt;br /&gt;
for i := 0 to (NumFiles - 1) do begin &lt;br /&gt;
DragQueryFile(Message.Drop, &lt;br /&gt;
i, &lt;br /&gt;
@buffer, &lt;br /&gt;
sizeof(buffer)); &lt;br /&gt;
Form1.Memo1.Lines.Add(buffer); &lt;br /&gt;
end; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
end.&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/how-do-i-accept-files-that-are-dropped.html</link><thr:total>6</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-4422832915315154590</guid><pubDate>Sat, 14 Aug 2010 08:57:00 +0000</pubDate><atom:updated>2010-08-14T01:57:00.164-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">kill</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Logout, or restart NT</title><description>function SetPrivilege(aPrivilegeName : string; &lt;br /&gt;
aEnabled : boolean ): boolean; &lt;br /&gt;
var &lt;br /&gt;
TPPrev, &lt;br /&gt;
TP : TTokenPrivileges; &lt;br /&gt;
Token : THandle; &lt;br /&gt;
dwRetLen : DWord; &lt;br /&gt;
begin &lt;br /&gt;
Result := False; &lt;br /&gt;
OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES &lt;br /&gt;
or TOKEN_QUERY, @Token ); &lt;br /&gt;
&lt;br /&gt;
TP.PrivilegeCount := 1; &lt;br /&gt;
if( LookupPrivilegeValue(nil, PChar( aPrivilegeName ), &lt;br /&gt;
TP.Privileges[ 0 ].LUID ) ) then &lt;br /&gt;
begin &lt;br /&gt;
if( aEnabled )then &lt;br /&gt;
TP.Privileges[0].Attributes:= SE_PRIVILEGE_ENABLED; &lt;br /&gt;
else &lt;br /&gt;
TP.Privileges[0].Attributes:= 0; &lt;br /&gt;
&lt;br /&gt;
dwRetLen := 0; &lt;br /&gt;
Result := AdjustTokenPrivileges(Token,False,TP, &lt;br /&gt;
SizeOf( TPPrev ), &lt;br /&gt;
TPPrev,dwRetLen ); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
CloseHandle( Token ); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function WinExit( iFlags : integer ) : boolean; &lt;br /&gt;
// possible Flags: &lt;br /&gt;
// EWX_LOGOFF &lt;br /&gt;
// EWX_REBOOT &lt;br /&gt;
// EWX_SHUTDOWN &lt;br /&gt;
begin &lt;br /&gt;
Result := True; &lt;br /&gt;
if( SetPrivilege( 'SeShutdownPrivilege', true ) ) then &lt;br /&gt;
begin &lt;br /&gt;
if( not ExitWindowsEx( iFlags, 0 ) )then &lt;br /&gt;
begin &lt;br /&gt;
Result := False; &lt;br /&gt;
end; &lt;br /&gt;
SetPrivilege( 'SeShutdownPrivilege', False ) &lt;br /&gt;
end &lt;br /&gt;
else &lt;br /&gt;
begin &lt;br /&gt;
Result := False; &lt;br /&gt;
end; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/logout-or-restart-nt.html</link><thr:total>4</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-6135183429289723807</guid><pubDate>Thu, 12 Aug 2010 08:55:00 +0000</pubDate><atom:updated>2010-08-12T01:55:00.472-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">system</category><category domain="http://www.blogger.com/atom/ns#">taskbar</category><title>How to change windows start button bitmap</title><description>{ define Global vars } &lt;br /&gt;
&lt;br /&gt;
var &lt;br /&gt;
Form1: TForm1; &lt;br /&gt;
StartButton: hWnd; &lt;br /&gt;
OldBitmap: THandle; &lt;br /&gt;
NewImage: TPicture; &lt;br /&gt;
&lt;br /&gt;
{ put the Code in the OnCreate event of your form } &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.FormCreate(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
NewImage := TPicture.create; &lt;br /&gt;
NewImage.LoadFromFile('C:\Windows\Circles.BMP'); &lt;br /&gt;
StartButton := FindWindowEx &lt;br /&gt;
(FindWindow( &lt;br /&gt;
'Shell_TrayWnd', nil), &lt;br /&gt;
0,'Button', nil); &lt;br /&gt;
OldBitmap := SendMessage(StartButton, &lt;br /&gt;
BM_SetImage, 0, &lt;br /&gt;
NewImage.Bitmap.Handle); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
{ OnDestroy-Event } &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.FormDestroy(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
SendMessage(StartButton,BM_SetImage,0,OldBitmap); &lt;br /&gt;
NewImage.Free; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/how-to-change-windows-start-button.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-1518164183167285487</guid><pubDate>Tue, 10 Aug 2010 08:52:00 +0000</pubDate><atom:updated>2010-08-10T01:52:00.239-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">overview</category><category domain="http://www.blogger.com/atom/ns#">registry</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Windows Registry</title><description>This code demonstrates use of windows registery and function overloading to read from registery: &lt;br /&gt;
if key doesnt exist it's created and Default passed to key value  ReadReg(KeyToRead,DefaultValue) &lt;br /&gt;
to write to registery: &lt;br /&gt;
writereg(KeyToWrite,ValueToKey) &lt;br /&gt;
Supports integer,string and boolean types, other type can be similary added.} &lt;br /&gt;
&lt;br /&gt;
unit module1; &lt;br /&gt;
&lt;br /&gt;
interface &lt;br /&gt;
&lt;br /&gt;
uses Windows, registry; &lt;br /&gt;
&lt;br /&gt;
function WriteReg(Key:string;value:integer)   :boolean; overload; &lt;br /&gt;
function WriteReg(Key:string;value:boolean)  :boolean; overload; &lt;br /&gt;
function WriteReg(Key:string;value:String)    :boolean; overload; &lt;br /&gt;
function ReadReg(Key:string;default:String='')  :string;   overload; &lt;br /&gt;
function ReadReg(Key:string;default:integer=0) :integer;  overload; &lt;br /&gt;
function ReadReg(Key:string;default:boolean=false):boolean;overload; &lt;br /&gt;
&lt;br /&gt;
const &lt;br /&gt;
ApplicationName:string ='MyProgram'; //Your Programname &lt;br /&gt;
&lt;br /&gt;
implementation &lt;br /&gt;
&lt;br /&gt;
function ReadReg(Key:string;default:integer=0):integer; &lt;br /&gt;
var &lt;br /&gt;
Registry: TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry :=TRegistry.Create; &lt;br /&gt;
Registry.RootKey :=HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ ApplicationName,True); &lt;br /&gt;
if registry.ValueExists(key) =true then &lt;br /&gt;
result:=Registry.readinteger(key) &lt;br /&gt;
else &lt;br /&gt;
begin &lt;br /&gt;
Registry.Writeinteger(key,default); &lt;br /&gt;
result:=Registry.readinteger(key); &lt;br /&gt;
end; &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
function ReadReg(Key:string;default:string=''):string; &lt;br /&gt;
var &lt;br /&gt;
Registry : TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry := TRegistry.Create; &lt;br /&gt;
Registry.RootKey :=HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ApplicationName,True); &lt;br /&gt;
if registry.ValueExists(key) then &lt;br /&gt;
readreg := Registry.readstring(key) &lt;br /&gt;
else &lt;br /&gt;
begin &lt;br /&gt;
Registry.Writestring(key,default); &lt;br /&gt;
Readreg := Registry.readstring(key); &lt;br /&gt;
end; &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function ReadReg(Key:string;default:boolean=false):boolean; &lt;br /&gt;
var &lt;br /&gt;
Registry: TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry := TRegistry.Create; &lt;br /&gt;
Registry.RootKey := HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ApplicationName,True); &lt;br /&gt;
if registry.ValueExists(key) then &lt;br /&gt;
readreg:=Registry.readbool(key) &lt;br /&gt;
else &lt;br /&gt;
begin &lt;br /&gt;
Registry.Writebool(key,default); &lt;br /&gt;
readreg:=Registry.readbool(key); &lt;br /&gt;
end; &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
function WriteReg(Key:string;value:boolean):boolean; &lt;br /&gt;
var Registry: TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry:=TRegistry.Create; &lt;br /&gt;
Registry.RootKey:=HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ApplicationName,True); &lt;br /&gt;
registry.WriteBool(key,value); &lt;br /&gt;
result:= registry.KeyExists(key); &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
function WriteReg(Key:string;value:string):boolean; &lt;br /&gt;
var &lt;br /&gt;
Registry: TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry := TRegistry.Create; &lt;br /&gt;
Registry.RootKey := HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ApplicationName,True);&lt;br /&gt;
registry.Writestring(key,value); &lt;br /&gt;
result:= registry.KeyExists(key); &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
function WriteReg(Key:string;value:integer):boolean; &lt;br /&gt;
var &lt;br /&gt;
Registry: TRegistry; &lt;br /&gt;
begin &lt;br /&gt;
Registry := TRegistry.Create; &lt;br /&gt;
Registry.RootKey := HKEY_CURRENT_USER; &lt;br /&gt;
Registry.OpenKey('\software\'+ApplicationName,True); &lt;br /&gt;
registry.Writeinteger(key,value); &lt;br /&gt;
writereg:= registry.KeyExists(key); &lt;br /&gt;
Registry.Free; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
Compare dates&lt;br /&gt;
&lt;br /&gt;
Uses SysUtils;&lt;br /&gt;
...&lt;br /&gt;
if(Date &lt; EncodeDate( 2000, 1, 1 )) then&lt;br /&gt;
Showmessage(' The date is ' + DateToStr(Date));&lt;br /&gt;
…&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/windows-registry.html</link><thr:total>20</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-8281888118863590729</guid><pubDate>Sun, 08 Aug 2010 08:50:00 +0000</pubDate><atom:updated>2010-08-08T01:50:00.320-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>DragDrop with the windows explorer</title><description>unit Unit1; &lt;br /&gt;
&lt;br /&gt;
interface &lt;br /&gt;
uses &lt;br /&gt;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, &lt;br /&gt;
StdCtrls; &lt;br /&gt;
&lt;br /&gt;
type &lt;br /&gt;
TForm1 = class(TForm) &lt;br /&gt;
ListBox1: TListBox; &lt;br /&gt;
procedure FormCreate(Sender: TObject); protected &lt;br /&gt;
procedure WMDROPFILES (var Msg: TMessage); message WM_DROPFILES; &lt;br /&gt;
&lt;br /&gt;
private &lt;br /&gt;
{ Private-Deklarationen } &lt;br /&gt;
public &lt;br /&gt;
{ Public-Deklarationen } &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
var &lt;br /&gt;
Form1: TForm1; &lt;br /&gt;
&lt;br /&gt;
implementation &lt;br /&gt;
uses shellapi; &lt;br /&gt;
&lt;br /&gt;
{$R *.DFM} &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.WMDROPFILES (var Msg: TMessage); &lt;br /&gt;
var i,anzahl, size : integer; &lt;br /&gt;
Dateiname : PChar; &lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
inherited; &lt;br /&gt;
anzahl := DragQueryFile(Msg.WParam, $FFFFFFFF,Dateiname,255); &lt;br /&gt;
for i := 0 to (anzahl - 1) do &lt;br /&gt;
begin &lt;br /&gt;
size := DragQueryFile(Msg.WParam, i , nil, 0) + 1; &lt;br /&gt;
Dateiname:= StrAlloc(size); &lt;br /&gt;
DragQueryFile(Msg.WParam,i , Dateiname, size);&lt;br /&gt;
listbox1.items.add(StrPas(Dateiname)); StrDispose(Dateiname); &lt;br /&gt;
end; &lt;br /&gt;
DragFinish(Msg.WParam); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
procedure TForm1.FormCreate(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
DragAcceptFiles(Form1.Handle, true); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
end.&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/dragdrop-with-windows-explorer.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-7085520807354047713</guid><pubDate>Fri, 06 Aug 2010 08:47:00 +0000</pubDate><atom:updated>2010-08-06T01:47:00.314-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Get the current Domain and Username</title><description>Found in the Win32.hlp &lt;br /&gt;
&lt;br /&gt;
type &lt;br /&gt;
PTokenUser = ^TTokenUser; &lt;br /&gt;
_TOKEN_USER = record &lt;br /&gt;
User: TSIDAndAttributes; &lt;br /&gt;
end; &lt;br /&gt;
TTokenUser = _TOKEN_USER; &lt;br /&gt;
&lt;br /&gt;
procedure getCurrentUserAndDomain(var User, Domain: String); &lt;br /&gt;
var &lt;br /&gt;
hProcess, hAccessToken: THandle; &lt;br /&gt;
InfoBuffer: array[0..1000] of Char; &lt;br /&gt;
szAccountName, szDomainName: array [0..200] of Char; &lt;br /&gt;
dwInfoBufferSize, dwAccountSize, dwDomainSize: DWORD; &lt;br /&gt;
pUser: PTokenUser; &lt;br /&gt;
snu: SID_NAME_USE; &lt;br /&gt;
begin &lt;br /&gt;
dwAccountSize:=200; &lt;br /&gt;
dwDomainSize:=200; &lt;br /&gt;
hProcess:=GetCurrentProcess; &lt;br /&gt;
OpenProcessToken(hProcess,TOKEN_READ,hAccessToken); &lt;br /&gt;
GetTokenInformation(hAccessToken,TokenUser,@InfoBuffer[0],1000, &lt;br /&gt;
dwInfoBufferSize); &lt;br /&gt;
pUser:=PTokenUser(@InfoBuffer[0]); &lt;br /&gt;
LookupAccountSid(nil, pUser.User.Sid, szAccountName, dwAccountSize, szDomainName, dwDomainSize, snu); &lt;br /&gt;
User:=szAccountName; &lt;br /&gt;
Domain:=szDomainName; &lt;br /&gt;
CloseHandle(hAccessToken); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/get-current-domain-and-username.html</link><thr:total>73</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-633108454400140408</guid><pubDate>Wed, 04 Aug 2010 08:45:00 +0000</pubDate><atom:updated>2010-08-04T01:45:00.206-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">system</category><title>Get the username and computer name from a Win95</title><description>computer For Win95, you can find it in the registry - but this is not portable to NT. A safer way (and one which is portable to NT) would be to use the Win32 calls GetComputerName and GetUserName, both of which are defined in the Windows unit. Each of these functions takes a buffer as its first parameter and the length of the buffer as its second.&lt;br /&gt;
The function definitions are shown below:&lt;br /&gt;
&lt;br /&gt;
function GetComputerName(lpBuffer:PChar;&lt;br /&gt;
var nSize:DWORD): BOOL; stdcall;&lt;br /&gt;
function GetUserName(lpBuffer :PChar; &lt;br /&gt;
var nSize: DWORD): BOOL; stdcall; &lt;br /&gt;
Use them like this: &lt;br /&gt;
&lt;br /&gt;
function GetWindowsUserName : string; &lt;br /&gt;
const &lt;br /&gt;
cnMaxLen = 254; &lt;br /&gt;
var  &lt;br /&gt;
sUserName     : string; &lt;br /&gt;
dwUserNameLen  : DWord; &lt;br /&gt;
begin&lt;br /&gt;
dwUserNameLen:=cnMaxLen-1;&lt;br /&gt;
SetLength(sUserName,cnMaxLen);&lt;br /&gt;
GetUserName(Pchar(sUserName),dwUserNameLen);&lt;br /&gt;
SetLength(sUserName,dwUserNameLen);&lt;br /&gt;
result:=sUserName; &lt;br /&gt;
if dwUserNameLen=cnMaxLen-1 then result:=''; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/get-username-and-computer-name-from.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-5252333903567543697</guid><pubDate>Mon, 02 Aug 2010 08:43:00 +0000</pubDate><atom:updated>2010-08-02T01:43:00.134-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">desktop</category><category domain="http://www.blogger.com/atom/ns#">pictures</category><category domain="http://www.blogger.com/atom/ns#">registry</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Set the Wallpaper on Windows98/2000 when ActiveDesktop is turned on</title><description>You may have noticed that using SystemParametersInfo to change the wallpaper when ActiveDesktop is turned on doesn't work. The reason is because you need to use the IActiveDesktop COM interface. Using SystemParametersInfo still works, but it doesn't update the wallpaper. &lt;br /&gt;
&lt;br /&gt;
Note that the IActiveDesktop interface requires a Shell32.dll version &gt;= 4.71. The document titled "Get a File Version" demonstrates how to check the file version and uses the shell32.dll as an example. &lt;br /&gt;
&lt;br /&gt;
Here is an example of using IActiveDesktop to work with &lt;br /&gt;
the wallpaper. It assumes that you have 3 labels on a form &lt;br /&gt;
and two buttons with the default names. &lt;br /&gt;
&lt;br /&gt;
uses &lt;br /&gt;
ComObj, // For CreateComObject and Initialization/Finalization of COM &lt;br /&gt;
ShlObj;  // For IActiveDesktop &lt;br /&gt;
&lt;br /&gt;
{ The CLASS ID for ActiveDesktop is not defined in  ShlObj, while the IID is so we define it here. } &lt;br /&gt;
const &lt;br /&gt;
CLSID_ActiveDesktop : TGUID = '{75048700-EF1F11D0-9888-06097DEACF9}'; &lt;br /&gt;
&lt;br /&gt;
{ Demonstrate getting the Wallpaper } &lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
var &lt;br /&gt;
ActiveDesktop    : IActiveDesktop; &lt;br /&gt;
CurrentWallpaper  : string; &lt;br /&gt;
CurrentPattern   : string; &lt;br /&gt;
WallpaperOptions  : TWallpaperOpt; &lt;br /&gt;
TmpBuffer      : PWideChar; &lt;br /&gt;
begin &lt;br /&gt;
// Create the ActiveDesktop COM Object &lt;br /&gt;
ActiveDesktop:=CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop; &lt;br /&gt;
// We now need to allocate some memory to get the current Wallpaper. &lt;br /&gt;
// However, tmpBuffer is a PWideChar which means 2 bytes make &lt;br /&gt;
// up one Char. In order to compenstate for the WideChar, we &lt;br /&gt;
// allocate enough memory for MAX_PATH*2 &lt;br /&gt;
tmpBuffer := AllocMem(MAX_PATH*2); &lt;br /&gt;
try &lt;br /&gt;
ActiveDesktop.GetWallpaper(tmpBuffer, MAX_PATH*2, 0);  &lt;br /&gt;
CurrentWallpaper := tmpBuffer; &lt;br /&gt;
finally &lt;br /&gt;
FreeMem(tmpBuffer); &lt;br /&gt;
end; &lt;br /&gt;
if CurrentWallpaper &lt;&gt; '' then &lt;br /&gt;
Label1.Caption := 'Current Wallpaper: ' + CurrentWallpaper &lt;br /&gt;
else &lt;br /&gt;
Label1.Caption := 'No Wallpaper set'; &lt;br /&gt;
&lt;br /&gt;
// Now get the current Wallpaper options. &lt;br /&gt;
// The second parameter is reserved and must be 0. &lt;br /&gt;
WallpaperOptions.dwSize := SizeOf(WallpaperOptions); &lt;br /&gt;
ActiveDesktop.GetWallpaperOptions(WallpaperOptions, 0); &lt;br /&gt;
case WallpaperOptions.dwStyle of &lt;br /&gt;
WPSTYLE_CENTER  : Label2.Caption  := 'Centered'; &lt;br /&gt;
WPSTYLE_TILE    : Label2.Caption  := 'Tiled'; &lt;br /&gt;
WPSTYLE_STRETCH : Label2.Caption  := 'Stretched'; &lt;br /&gt;
WPSTYLE_MAX    : Label2.Caption  := 'Maxed'; &lt;br /&gt;
end; &lt;br /&gt;
{Now get the desktop pattern.  The pattern is a string of decimals whose bit pattern  represents a picture. Each decimal represents the on/off state  of the 8 pixels in that row. }&lt;br /&gt;
tmpBuffer := AllocMem(256); &lt;br /&gt;
try &lt;br /&gt;
ActiveDesktop.GetPattern(tmpBuffer, 256, 0); &lt;br /&gt;
CurrentPattern := tmpBuffer; &lt;br /&gt;
finally &lt;br /&gt;
FreeMem(tmpBuffer); &lt;br /&gt;
end; &lt;br /&gt;
if CurrentPattern &lt;&gt; '' then &lt;br /&gt;
Label3.Caption := CurrentPattern &lt;br /&gt;
else &lt;br /&gt;
Label3.Caption := 'No Pattern set'; &lt;br /&gt;
end; &lt;br /&gt;
{ Demonstrate setting the wallpaper } &lt;br /&gt;
procedure TForm1.Button2Click(Sender: TObject); &lt;br /&gt;
var &lt;br /&gt;
ActiveDesktop: IActiveDesktop; &lt;br /&gt;
begin &lt;br /&gt;
ActiveDesktop := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop; &lt;br /&gt;
ActiveDesktop.SetWallpaper('c:\downloads\images\test.bmp', 0); &lt;br /&gt;
ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);&lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
Responds:&lt;br /&gt;
Good programming. But I just calling &lt;br /&gt;
&lt;br /&gt;
SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, @WallpaperBMPFileAndPath[1], 3);&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/08/set-wallpaper-on-windows982000-when.html</link><thr:total>4</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-1118607469743814757</guid><pubDate>Sat, 31 Jul 2010 08:41:00 +0000</pubDate><atom:updated>2010-07-31T01:41:00.260-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Shutdown windows</title><description>Parameters: &lt;br /&gt;
EWX_SHUTDOWN : shut down windows(Power off) &lt;br /&gt;
EWX_REBOOT : reboot windows &lt;br /&gt;
EWX_POWEROFF  : Standby mode &lt;br /&gt;
EWX_LOGOFF  : Log Off  &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
ExitWindowsEx(EWX_SHUTDOWN,0);  &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
or use rundll32.exe &lt;br /&gt;
&lt;br /&gt;
uses ShellAPI; &lt;br /&gt;
&lt;br /&gt;
function ExecuteFile(const FileName, Params,DefaultDir : string; &lt;br /&gt;
ShowCmd: Integer) : THandle;&lt;br /&gt;
var &lt;br /&gt;
zFileName, zParams, zDir : array[0..79] of Char; &lt;br /&gt;
begin &lt;br /&gt;
Result :=ShellExecute(Application.MainForm.Handle, nil, &lt;br /&gt;
StrPCopy(zFileName, FileName),StrPCopy(zParams,Params), StrPCopy(zDir, DefaultDir), ShowCmd);&lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
begin&lt;br /&gt;
ExecuteFile('Rundll.exe','user,exitwindows','',SW_SHOW); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/shutdown-windows.html</link><thr:total>5</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-6923552358835395139</guid><pubDate>Thu, 29 Jul 2010 08:38:00 +0000</pubDate><atom:updated>2010-07-29T01:38:00.581-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Get windows and system directory</title><description>function GetWinDir: String; &lt;br /&gt;
var &lt;br /&gt;
dir : array [0..max_path] of char; &lt;br /&gt;
begin &lt;br /&gt;
GetWindowsDirectory(dir, max_path); &lt;br /&gt;
result:=StrPas(dir); &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
function GetSysDir: String; &lt;br /&gt;
var &lt;br /&gt;
dir : array [0..max_path] of char; &lt;br /&gt;
begin &lt;br /&gt;
GetSystemDirectory(dir, max_path); &lt;br /&gt;
result:=StrPas(dir); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/get-windows-and-system-directory.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-3563199196457407564</guid><pubDate>Tue, 27 Jul 2010 08:32:00 +0000</pubDate><atom:updated>2010-07-27T01:32:00.321-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">pictures</category><title>Tile an image</title><description>procedure TForm1.Button1Click(Sender:TObject); &lt;br /&gt;
var  &lt;br /&gt;
x,y : Integer;&lt;br /&gt;
Bmp : TBitmap; &lt;br /&gt;
begin &lt;br /&gt;
bmp:=TBitmap.Create; &lt;br /&gt;
bmp.LoadFromFile('c:\windows\streifen.bmp'); &lt;br /&gt;
for x:=0 to (image1.width div bmp.width) do &lt;br /&gt;
for y:=0 to (image1.height div bmp.height) do&lt;br /&gt;
Image1.Canvas.Draw(x*bmp.width,y*bmp.height,bmp); &lt;br /&gt;
bmp.Free; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/tile-image.html</link><thr:total>1</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-2394798941951213383</guid><pubDate>Sun, 25 Jul 2010 08:30:00 +0000</pubDate><atom:updated>2010-07-25T01:30:00.591-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">pictures</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Convert BMP to JPG</title><description>uses jpeg; &lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
var&lt;br /&gt;
bmp : TImage; &lt;br /&gt;
jpg : TJpegImage; &lt;br /&gt;
begin &lt;br /&gt;
bmp := TImage.Create(nil); &lt;br /&gt;
jpg := TJpegImage.Create; &lt;br /&gt;
 bmp.picture.bitmap.LoadFromFile('c:\picture.bmp'); &lt;br /&gt;
 jpg.Assign( bmp.picture.bitmap ); &lt;br /&gt;
//Here you can set the jpg object's &lt;br /&gt;
//properties as compression, size and more &lt;br /&gt;
 jpg.SaveToFile('c:\picture.jpg'); &lt;br /&gt;
 jpg.Free; &lt;br /&gt;
 bmp.Free; &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/convert-bmp-to-jpg.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-2897295828411531713</guid><pubDate>Fri, 23 Jul 2010 08:29:00 +0000</pubDate><atom:updated>2010-07-23T01:29:00.223-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>change the graphic mode</title><description>procedure TForm1.FormCreate(Sender: TObject); &lt;br /&gt;
var  devmode : TDEVMODE; &lt;br /&gt;
d : INTEGER; &lt;br /&gt;
litem : TListItem; &lt;br /&gt;
p : ^TDevmode; &lt;br /&gt;
begin &lt;br /&gt;
devmode.dmSize := SizeOf(TDEVMODE);&lt;br /&gt;
devmode.dmDriverExtra := 0; d := 0; &lt;br /&gt;
listview1.Columns[0].Width := 400; &lt;br /&gt;
While EnumDisplaySettings(nil, d, devmode) do &lt;br /&gt;
with devmode do &lt;br /&gt;
begin &lt;br /&gt;
Inc(d); &lt;br /&gt;
litem := listview1.Items.Add;&lt;br /&gt;
litem.Caption:=Format('Modus %3d : %dx%d, %d Farben(%d Hz)', [d,dmPelsWidth,dmPelsHeight,1 shl(dmBitsPerPel),dmDisplayFrequency]); &lt;br /&gt;
new(p); &lt;br /&gt;
p^ := Devmode; &lt;br /&gt;
litem.Data := p; &lt;br /&gt;
end; &lt;br /&gt;
end; &lt;br /&gt;
&lt;br /&gt;
procedure TForm1.BitBtn1Click(Sender: TObject); &lt;br /&gt;
begin&lt;br /&gt;
ChangeDisplaySettings(TDevmode(listview1.Selected.data^),0); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/change-graphic-mode.html</link><thr:total>2</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-1256865541878107812</guid><pubDate>Wed, 21 Jul 2010 08:27:00 +0000</pubDate><atom:updated>2010-07-21T01:27:00.285-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">hard disk</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Detect Disk Free</title><description>DiskFree(n) //where n = number. &lt;br /&gt;
&lt;br /&gt;
0 = the current drive you are working in. 1 = A, 2 = B, 3 = C, 4 = D etc. &lt;br /&gt;
DiskFree(3);// C drive. &lt;br /&gt;
DiskFree returns the number of free bytes on the specified drive number.&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/detect-disk-free.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-8222667427508272800</guid><pubDate>Mon, 19 Jul 2010 08:26:00 +0000</pubDate><atom:updated>2010-07-19T01:26:00.957-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">CD ROM</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Open and close CD</title><description>Procedure Opendoor;&lt;br /&gt;
Begin&lt;br /&gt;
mciSendString('Set cdaudio door open', nil, 0, 0);&lt;br /&gt;
End;&lt;br /&gt;
&lt;br /&gt;
Procedure CloseDoor;&lt;br /&gt;
Begin&lt;br /&gt;
mciSendString('Set cdaudio door closed', nil, 0, 0);&lt;br /&gt;
End;&lt;br /&gt;
&lt;br /&gt;
note : Remember to include the unit MMSYSTEM&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/open-and-close-cd.html</link><thr:total>4</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-1103856520722289970</guid><pubDate>Sat, 17 Jul 2010 08:24:00 +0000</pubDate><atom:updated>2010-07-17T01:24:00.441-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Detect SoundCard</title><description>Uses MMSystem;&lt;br /&gt;
Function IsSoundCardInstalled:Boolean;&lt;br /&gt;
Begin&lt;br /&gt;
 Result:=(waveOutGetNumDevs&gt;0);&lt;br /&gt;
End;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/detect-soundcard.html</link><thr:total>2</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-2683909023644186602</guid><pubDate>Thu, 15 Jul 2010 08:23:00 +0000</pubDate><atom:updated>2010-07-15T01:23:00.232-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">hide</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Hide the application from tasklist (Ctrl+Alt+Del)</title><description>implementation &lt;br /&gt;
&lt;br /&gt;
function RegisterServiceProcess(dwProcessID, dwType: DWord) : DWord; stdcall;&lt;br /&gt;
external 'KERNEL32.DLL'; &lt;br /&gt;
&lt;br /&gt;
{$R *.DFM} &lt;br /&gt;
procedure TForm1.Button1Click(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
RegisterServiceProcess(GetCurrentProcessID,1); &lt;br /&gt;
end; &lt;br /&gt;
procedure TForm1.Button2Click(Sender: TObject); &lt;br /&gt;
begin &lt;br /&gt;
RegisterServiceProcess(GetCurrentProcessID,0); &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/hide-application-from-tasklist_15.html</link><thr:total>4</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-1762528600999964425</guid><pubDate>Tue, 13 Jul 2010 08:21:00 +0000</pubDate><atom:updated>2010-07-13T01:21:00.306-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">Application</category><title>Make the whole form behave like the title bar</title><description>Uses Messages;&lt;br /&gt;
...&lt;br /&gt;
public&lt;br /&gt;
procedure WMNCHitTest(var Message: TWMNCHitTest); message; &lt;br /&gt;
WM_NCHITTEST;&lt;br /&gt;
end;&lt;br /&gt;
...&lt;br /&gt;
procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);&lt;br /&gt;
var&lt;br /&gt;
 P : TPoint;&lt;br /&gt;
begin&lt;br /&gt;
 inherited;&lt;br /&gt;
 P := ScreenToClient(SmallPointToPoint(Message.Pos));&lt;br /&gt;
 with imgTitle do&lt;br /&gt;
  if (P.X &gt;= Left) and (P.X &lt; Left + Width) and (P.Y &gt;= Top)&lt;br /&gt;
   and (P.Y &lt; Top + Height) then&lt;br /&gt;
 Message.Result := htCaption;&lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/make-whole-form-behave-like-title-bar.html</link><thr:total>1</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-8831414413325831570</guid><pubDate>Sun, 11 Jul 2010 08:20:00 +0000</pubDate><atom:updated>2010-07-11T01:20:00.582-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">Application</category><title>Make a form always on top</title><description>with Form1 do &lt;br /&gt;
SetWindowPos(Handle, &lt;br /&gt;
HWND_TOPMOST, Left, Top,Width, Height,SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/make-form-always-on-top.html</link><thr:total>10</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-103252814529226411</guid><pubDate>Fri, 09 Jul 2010 08:19:00 +0000</pubDate><atom:updated>2010-07-09T01:19:00.381-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">hide</category><title>Hide the main form</title><description>Application.ShowMainForm := false;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/hide-main-form.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7497031730574139923.post-6818561653968585115</guid><pubDate>Wed, 07 Jul 2010 08:17:00 +0000</pubDate><atom:updated>2010-07-07T01:17:00.148-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">API</category><category domain="http://www.blogger.com/atom/ns#">Application</category><category domain="http://www.blogger.com/atom/ns#">file</category><category domain="http://www.blogger.com/atom/ns#">recycle bin</category><category domain="http://www.blogger.com/atom/ns#">system</category><title>Send files to the recycle bin</title><description>procedure RecycleFile(s : string); &lt;br /&gt;
var &lt;br /&gt;
  SHFileOpStruct : TSHFileOpStruct; &lt;br /&gt;
begin&lt;br /&gt;
  with SHFileOpStruct do &lt;br /&gt;
  begin&lt;br /&gt;
   Wnd := Handle; &lt;br /&gt;
   wFunc := FO_DELETE; // we want to delete a file... &lt;br /&gt;
   pFrom := PChar(s); //... this file ... &lt;br /&gt;
   pTo  := nil; &lt;br /&gt;
   fFlags := FOF_ALLOWUNDO; //... able to "Undo" (recycle) &lt;br /&gt;
   hNameMappings  := nil; &lt;br /&gt;
   lpszProgressTitle  := nil; &lt;br /&gt;
  end; &lt;br /&gt;
  SHFileOperation(SHFileOpStruct); // to the Recycle Bin &lt;br /&gt;
end;&lt;div class="blogger-post-footer"&gt;Get more information at http://greatdelphi.blogspot.com&lt;/div&gt;</description><link>http://greatdelphi.blogspot.com/2010/07/send-files-to-recycle-bin.html</link><thr:total>3</thr:total><author>greatdelphi.blogspot.com (great delphi)</author></item></channel></rss>