[转]Delphi 8 Tips, Tricks and Speed Improvements

Speed is the Key

 

Delphi 8 has become a large product with a lot of features. For various reasons, some features are hidden, and only accessible via a registry modification. Other features are often not needed, and just make the IDE slower to start. Fortunately, with a few registry hacks, one can add a few new features, and disable others that they don’t use, making the IDE be exactly what the user wants.

 

Playing the Registry Game

 

First off, modifying the registry is dangerous, and can potentially cause problems on your system. I only recommend modifying the registry if you really understand what you are doing. Having said that, you should understand how Delphi 8 uses the registry. To start the Windows Registry Editor, run RegEdit.exe.

 

For Delphi 8, the IDE normally reads all of its registry settings from HKEY_CURRENT_USER/Software/Borland/ BDS /2.0. Previous versions of Delphi used  HKEY_CURRENT_USER/Software/Borland/Delphi/<Version>. C#Builder and Delphi 8 share the exact same IDE, so the executable was renamed to BDS .exe, standing for “Borland Developer Studio”. When the IDE starts, if the given registry key does not exist under HKEY_CURRENT_USER (HKCU), it will copy the contents of HKEY_LOCAL_MACHINE (HKLM) to the HKCU key. This allows the IDE to be used with multiple users. 

 

Now, the IDE has a little known option that allows it to start with a different registry key. By using the command line option –rSomeString, where SomeString is any given registry key, the IDE will start using SomeString as its registry. For example, I have a shortcut to BDS .exe on my desktop with a Target of: "C:/Program Files/Borland/ BDS /2.0/Bin/bds.exe" –rBareBones. When the IDE starts, it reads and writes to the registry key HKCU/Sofware/Borland/BareBones/2.0. The first time you start the IDE this way, it will copy its settings over from HKLM.

 

What is the advantage of this –r registry switch? Well, it allows you to use the same IDE in different ways. By loading different packages with different registry keys, you can have one IDE tailored for just text editing, and another tailored for all available features.

 

Find Your Keys

 

Now that you know where to find the registry keys, it is time to take a look at how the IDE uses them. The IDE itself is very modular. Virtually all product features are simply plugged into the IDE via packages or assemblies. Native packages are loaded from the “Known IDE Packages” key. . NET assemblies are loaded from the “Known IDE Assemblies” key. Installed VCL . NET components are loaded from the “Known Assemblies” key.

 

One can speed up the start time of the IDE by disabling items that they don’t use. Start the IDE with the –rBareBones option in order to leave the current settings untouched. The easiest way to do this is to create a shortcut to BDS .exe and modify the target to contain –rBareBones. Start the IDE once (so it copies the keys over), and exit.

 

Image1.tif: Modifying a shortcut to BDS .exe with the –r option.

 

Now, in the Registry Editor, you should see something similar to Image 2:

 

Image2.tif: Registry Editor displaying the BareBones registry key.

 

Select the “Known IDE Packages” key and delete it. Repeat with “Known IDE Assemblies” and “Known Assemblies”. Start the IDE again with the shortcut you created earlier. It should start very fast (it is almost instant on my laptop)! What you now have is a very fast text editor, with syntax highlighting.

 

Being More Selective

 

Now, you probably still want to use certain features of Delphi , such as the ability to compile applications and do some basic form designing. To do this, you will have to disable individual packages.

 

Start the IDE again with a different –r option, such as –rBareDelphi, and exit. Refresh the Registry Editor and select the “Known IDE Packages” key under HKCU/Software/Borland/BareDelphi/2.0. You should again see something similar to Image2. Each item in the list is a particular feature for the IDE. For example, “$( BDS )/Bin/delphidotnetide71.bpl” is the core Delphi for . NET IDE personality. Disabling this package would disable the ability to compile Delphi applications.

 

Some items in the list have a descriptive description telling you what they are for. Others simply say “(Untitled)”. To find out what a package is for, browse to it with Windows Explorer, right click on it and select Properties. On the Version tab, look at the Description to see what the package does. For example, the package asmview71.bpl has a Description of  “Assembly Viewer”. This package allows the IDE to open and browse assemblies inside of it.

 

Now the trick is to learn how to disable packages. It is actually quite simple; make the string value empty, and the package won’t load. Make the string value not empty, and it will load.

 

So, to make a “Bare Bones” version of Delphi , set all values to have a blank string except the following:

 

Registry Entry

Package Description

$( BDS )/Bin/delphidotnetide71.bpl

Core Delphi for . NET IDE Personality

$( BDS )/Bin/dotnetcoreide71.bpl

Core . NET IDE Personality

$( BDS )/Bin/dotnetdebugide71.bpl

. NET Debugging Features

$( BDS )/Bin/idefilefilters71.bpl

IDE File Filters – (Required)

$( BDS )/Bin/vcldotnetdesignide71.bpl

VCL for . NET Personality Features

 

In addition, if you want “Pro” Delphi features, don’t disable the packages with the word “pro” in them.

 

Now, when you start the IDE it should load a lot faster.

 

Making the IDE even faster

 

I also mentioned the “Known IDE Assemblies” registry key. This key is the . NET counterpart to “Known IDE Packages”. You can selectively disable assemblies in this list the same was as “Known IDE Packages”. I don’t recommend disabling $( BDS )/Bin/Borland.Studio.Delphi.dll, as it adds core Delphi features to the product. 

 

The last key to take a look at is “Known Assemblies”. Items in this list register components and/or component designers. If you don’t use a certain set of components, you can disable them by setting their string values to a blank string. If you don’t do VCL for . NET development, you can remove all items in the list.

 

Hidden features

Now for some cool hidden features in Delphi 8. You should have a registry key named HKCU/Software/Borland/ BDS /2.0/Globals. If you add a new String Value named PaletteNewItems containing a value of 1, the IDE will have the Palette Wizards feature in the Tool Palette, as seen in Image3. Palette Wizards are a quick and easy way to create any item found in the New Items Gallery.

 

Image 3: Palette Wizards in the Tool Palette

 

Another really cool hidden feature is Error Insight. In the Globals key, add another String Value named ShowMeProblemsCorbin containing a value of 1. When you type in the code editor, it will constantly update to show you small red squiggles when there is a syntax error. Holding the mouse over the squiggle will show why the error occurred.

 

Image 4: Error Insight in action

 

If for some reason Error Insight doesn’t show up, you may have to register the ToolsAPI type library. Do this with a command such as:

 

C:/Program Files/Borland/ BDS /2.0/Bin>tregsvr -t -s Borland.Studio.ToolsAPI.tlb

 

Bringing It All Together

 

Now you should have the understanding on how to create a highly customized version of the IDE. I commonly find myself disabling features that I don’t often use. It is easiest to create multiple shortcuts to BDS .exe, each containing a different –r option to start the IDE with or without certain features. This gives me the greatest flexibility with one of the greatest products.

 

 

posted @ 9/29/2004 1:27 PM by Corbin Dunn

Sprechen Sie Deutsch?

There is a cool interview of me in German at: Interview mit Corbin Dunn über die Delphi-IDE - Delphi-Source.de.

Check it out! The english translation (my original interview) will be posted soon.

posted @ 9/29/2004 1:24 PM by Corbin Dunn

Leaving on a Jet Plane, Don't know when I'll be back again...

My home for the next month or two is going to be somewhere in Qantas Economy Class. Starting next week we're kicking off a whole bunch of Diamondback Sneak Peeks around Asia Pacific. I'm both excited about it (After the buzz at Borcon, I'm really looking forward to seeing the reaction we get out here) and dreading it at the same time (I'm a fairly grumpy traveller at the best of times, and this schedule is ridiculous).

So the next two weeks I'm doing the rounds of Australia, covering Sydney, Canberra, Melbourne, Brisbane, Adelaide and Perth, in conjunction with the Australian Delphi User Group (ADUG). More details here

After that it's Japan, Malaysia, Singapore, Thailand, Korea and beyond that it gets kinda blurry. China and Taiwan will be handled by the extraordinary Gordon Li, and New Zealand has already been covered by the equally extraordinary Richard Vowles. I'll try and post photos as I go around.

I think I get home before Christmas.

Upside is I write most of my ECO blog articles on flights, so no excuses over the next couple of months.

by Malcolm Groves

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值