GExperts so far comes with a special stand alone executable GExpertsGrep that does nothing else but load the GExperts dll and call the entry point ShowGrep. Having this additional executable isn’t really necessary because Windows already comes with a tool that does exactly that: Load a DLL and call an entry point: rundll32.exe

rundll32 path\to\your.dll,EntryPoint additional parameters go here


In order for a dll to be called in this manner it needs to export an entry point with the following definition:

procedure EntryPoint(_HWnd: HWND; _HInstance: HINST; _CmdLine: PAnsiChar; CmdShow: integer); stdcall;


Note that the calling convention must be stdcall otherwise bad things happen.

Since Windows NT (so for all modern versions of Windows) there are two additional ways to declare the entry point:

procedure EntryPointA(_HWnd: HWND; _HInstance: HINST; _CmdLine: PAnsiChar; CmdShow: integer); stdcall;
procedure EntryPointW(_HWnd: HWND; _HInstance: HINST; _CmdLine: PWideChar; CmdShow: integer); stdcall;


Note that EntryPoint and EntryPointA are still assumed to have a PAnsiChar parameter, while EntryPointW is assumed to have a PWideChar parameter. A Dll only needs to export one of these entry points.

If RunDll32 is called with “EntryPoint”, it will look for “EntryPointW” first, “EntryPointA” second and “EntryPoint” last. Note that you don’t have to specify the “A” or “W” suffix, it is automatically added by RunDll32.

For a change, we even have an advantage when writing the DLL in Delphi rather than in MS Visual C++: Delphi does not do any name mangling, so the entry point will be called exactly what you write in the source code.

So, assuming the GExperts DLL exports the following procedure:

procedure ShowGrepEx(_HWnd: HWND; _HInstance: HINST; _CmdLine: PAnsiChar; CmdShow: integer); stdcall;


RunDll32 could be called like this:

rundll32 path\to\GExperts.dll,ShowGrepEx Some\Directory\here


The DLL would take the _CmdLine parameter, use it as the base directory for a directory search and show you the dialog as above. Pretty cool, eh?

We could even go a step further and write the following to the registry to add an entry to the context menu of each folder in Windows Explorer.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\GExpertsGrep]
"Icon"="path\\to\\GExperts.dll"
"MUIVerb"="GExperts Grep"

[HKEY_CLASSES_ROOT\Folder\shell\GExpertsGrep\Command]
@="\"c:\\windows\\system32\\rundll32.exe\" path\\to\\GExperts.dll,ShowGrepEx %1"


(Note: Don’t just copy that to a .reg file! You need to replace both instances of “path\\to\\GExperts.dll” with the actual absolute path to your GExperts DLL. And don’t forget that the current release does not even export the entry point ShowGrepEx at all.)

And this is what you’d get:

Unfortunately there is a drawback: RunDll32 must be given the correct path and file name of the DLL to load. That’s fine if you only have one GExperts version installed. The current GExpertsGrep stand alone executable searches for the first GExperts DLL in descending order, so it will always load the one for the latest Delphi version it can find. So I am not sure whether I want to drop the stand alone executable in favor of RunDLL32 right now.

Various people have reported an error message regarding rtl240.bpl not being found when calling the stand alone version of GExperts Grep. I could never reproduce it but my recent insight on SaveLoadLibrary now also solved that one:

The stand alone version of GExperts Grep tries to load any GExperts dll, regardless which version. The idea being that I don’t have to maintain multiple versions of the executable just to load the dll which does all the work anyway. So it tries to load the dlls in descending order, starting with the latest Delphi 10.1 (Berlin) one (I added 10.2 yesterday). But since GExperts is an IDE expert and therefore needs to use the rtl and various other packages, it of course requires them even if it is being used stand alone. And if you for whatever reason have GExperts installed for a Delphi version which you don’t have installed (or for which the packages are not in the search path), it fails to load and the error dialog described in the linked article was displayed.

It no longer does, thanks to David Heffernan’s hint.

There is no new release yet, not sure when I will have one ready.

Note to self: Do not call SafeLoadLibrary simply as a replacement for LoadLibrary. It has a second parameter witch is used to call SetErrorMode. That parameter is optional and defaults to SEM_NOOPENFILEERRORBOX which is NOT always what you want. E.g. if the DLL you are loading depends on other DLLs which cannot be loaded, you will get a system error dialog like this one:

This might not be what you want if you are loading a DLL dynamically and want to show your own error message if it fails.

So you might want to pass a second parameter, e.g.

  Res := SafeLoadLibrary('dllname.dll', SEM_FAILCRITICALERRORS);


There might, however be a reason to call SafeLoadLibrary instead of LoadLibrary. It safes and restores the FPU Control Word. Some DLLs change it in DllMain which might cause your program to misbehave if it isn’t restored.

I remember spending days tracking down such a problem in the late 1990ies so I made it a habit calling SafeLoadLibrary rather than LoadLibrary.

On the other hand that could also happen in any other call into the DLL. So maybe it is time to revise that habit.

The Delphi Open Tools API introduced Debug Visualizers with Delphi 2010, so people stuck with a pre-Unicode Delphi IDE can not use them. Until now that is.

An answer on StackOverflow by MartynA provided me with a starting point, but I used a different approach because I didn’t like how getting the value overwrote the clipboard.

Here is what it looks like

Please note that these experts are not very well tested. You use them at your own risk. As any IDE expert they are quite capable of crashing the IDE and making you lose your work.

Also, for now, I won’t provide source code for them. I haven’t yet decided whether I want to make them yet another open source project or maybe a commercial product.

This ZIP file contains three experts, one for Delphi 2005, 2006 and 2007 respectively that allow you display a watch window entry formatted as Date/Time inline or as multi line text in a separate window.

Just so I can look it up later, if I need it:

The following are some interesting addons for Firefox:

• FireGestures is a Firefox extension which enables you to execute various commands with six types of gestures.
• Speed Start Speed Dial & Start Page with flexible layout for fast access to sites via visual bookmarks
• uBlock an open source ad blocker. You can’t use the web without one nowadays (Anybody still remember Webwasher?)

I particularly like Speed Start. It allows me to configure the start page just the way I want it.

Jeroen Wiert Pluimers has notified me in his comment on Google+ that the RSS feed for GExperts related posts doesn’t work. I apparently forgot a forward slash in the url:

correct:

http://blog.dummzeuch.de/category/gexperts/feed/

wrong:
http://blog.dummzeuch.de/category/gexpertsfeed/

It’s fixed now, sorry about that.

I have been asked to provide GExperts for Delphi 10.2 Tokyo, multiple times, via various channels.

Apparently not everybody subscribed to the GExperts Community on Google+, where I posted this on 2017-04-01:

No April fools’ joke: GExperts 1.38 experimental 2017-04-01 for Delphi 10.2.

This version should solve several bugs that resulted in Access Violations in the IDE or made the IDE hang.

Again: This is not for the faint of heart. It is barely tested. Download only if you promise not to blame me for the work you lost.

Please report any bugs on sourceforge https://sourceforge.net/p/gexperts/bugs/

There seem to be multiple download links on the web for GExperts for Delphi 10.2 Tokyo that want to charge for a “VIP membership”. These have not been authorized by me at all.

To those who already downloaded it back then: This is still the same version. I have started working on a major change in the way dialog changes and bugfixes are handled internally, which currently is a mess. That change is far from finished, so it doesn’t make much sense to build a new installer right now.

So I don’t forget:

Adding a comment to an existing IXMLNode is simple, once you find out how:

var
CommentNode: IXMLNode;
begin
CommentNode := ParentNode.OwnerDocument.CreateNode('comment text', ntComment);


This is documented in the DocWiki

Many months ago I used Yahoo Pipes to create a RSS feed aggregator of Delphi related blogs which I called The Delphi Pipe. Unfortunately shortly after that Yahoo shut down their Pipes service so The Delphi Pipe was rather short lived.

Today I revived it using a different technique. You can find all about it on The Delphi Pipe page.

Two weeks ago I added the Donations for GExperts page. A few days later I received the first money through PayPal. Thanks for that!

I have now used that credit for donations to other open source software that I use daily:

I had always wanted to donate to those projects but never came around actually doing that. So, having some ready to use credits on PayPal made me finally do it.