infrequent grumblings of a software engineer and then some… (also some Delphi programming)

Posts Tagged ‘Delphi’

Interface unit for sending debug messages to SysInternals ProcessMonitor

Posted by tier777 on 2010-04-15

The latest version of SysInternals‘ excellent ProcessMonitor is now able to receive custom debug log messages and display them right in between the I/O logs.

Even though I still don’t quite get the rationale for the need to create a new API for this (in contrast to simply merging in the functionality of DebugView) I went straight ahead and converted the API to Delphi.

This should work with Delphi 6 and later. I successfully tested with Delphi 2007, 2009 and 2010.

(Update: the originally posted version did actually not work with Delphi 2007 or earlier because I had inexplicably overlooked “that Unicode thing”… Thanks to GunSmoker for pointing that out! Using $ifdef UNICODE and WideString is a cheap cop-out, I know – but it works)


unit ProcMonDebugOutput;



  TProcessMonitorLogger = class
//      FILE_WRITE_ACCESS           = $00000002;
//      METHOD_BUFFERED             = $00000000;
//      FILE_DEVICE_PROCMON_LOG     = $00009535;
//                                             $81,
//                                             METHOD_BUFFERED,
//                                             FILE_WRITE_ACCESS);
    class var
      FDevice: THandle; // = INVALID_HANDLE_VALUE
    class function Open(): THandle;
    class procedure Close();
    {$IF CompilerVersion >= 21}
    class constructor Create;
    class destructor Destroy;
    class function Output(const AOutputString: {$ifdef UNICODE}String{$else}WideString{$endif}): Boolean;
  PML = TProcessMonitorLogger;


{ TProcessMonitorLogger }

//function CTL_CODE(const ADevType, AFunc, AMethod, AAccess: Cardinal): Cardinal; inline;
//  Result := (ADevType shl 16) or (AAccess shl 14) or (AFunc shl 2) or AMethod;

{$IF CompilerVersion >= 21}
class constructor TProcessMonitorLogger.Create;

class destructor TProcessMonitorLogger.Destroy;

class procedure TProcessMonitorLogger.Close;
  if INVALID_HANDLE_VALUE <> FDevice then

class function TProcessMonitorLogger.Open(): THandle;
  if INVALID_HANDLE_VALUE = FDevice then
    FDevice := CreateFile('\\.\Global\ProcmonDebugLogger',
                            GENERIC_READ or GENERIC_WRITE,
                            FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE,
  Result := FDevice;

class function TProcessMonitorLogger.Output(const AOutputString: {$ifdef UNICODE}String{$else}WideString{$endif}): Boolean;
  lProcMonHwnd: THandle;
  lInputLength: Cardinal;
  lOutputLength: Cardinal;
  lLastError: Cardinal;
  Result := False;
  if AOutputString = '' then
      lProcMonHwnd := Open();
      if lProcMonHwnd <> INVALID_HANDLE_VALUE then
          lInputLength := Length(AOutputString) * SizeOf(WideChar);
          lOutputLength := 0;
          Result := DeviceIoControl(lProcMonHwnd,
          if not Result then
              lLastError := GetLastError();
              if lLastError = ERROR_INVALID_PARAMETER then

{$IF CompilerVersion < 21}
  TProcessMonitorLogger.FDevice := INVALID_HANDLE_VALUE;


  PML.Output('How hard could it be?');

Posted in Delphi, Tips and Tricks | Tagged: , , , , , , , | 11 Comments »

So that was Lucky 13 for me…

Posted by tier777 on 2009-10-07

Marco has already blogged about it and now here is my report from this year’s Entwicklerkonferenz, aka Delphi Live Germany in Darmstadt.

First off, I was pleased to see that attendance was definitely better than last year (where David I’s opening keynote was seen by about 30 people tops), though that might in part have been caused by the unfortunate hotel situation back then. I haven’t heard of any definite numbers yet but my personal estimation would be that there were slightly more than a hundred people this year (which is of course still way below the numbers of a few years back). During the opening’s obligatory hand-raising segment only two or three people indicated they were there for the very first time. A harsh contrast to the results of the Delphi Tage event earlier this year where about a third of the audience outed themselves as first-timers.

A welcome gimmick (for me at least) was an offer for returning attendees of the conference to get a “free” netbook. Though I have to strongly object to the “free” part of the campaign (you had to waive the usual “early bird” rebates when claiming it, so effectively you paid more than you otherwise would have), this worked out really well for me as I did not own such a thing so far and it worked fine right out of the box.

Another small thing that I found very nice compared to previous years was that in all conference rooms you were able to sit at an actual table (well, except for when they underestimated the attendance and had to bring in extra chairs which happened to me two or three times), which is not only more comfortable because of the additional leg space but also makes taking notes so much easier.


As in most years I got to see some exceptional talks. Here are some of the ones that stood out for me:

Hadi on Test Driven Design

This was a real eye-opener on many levels while being at the same time very entertaining and thorough. I especially appreciated how Hadi took the time to present the entire thought process behind the concept but doing so in a very subtle way that made it feel very natural how all the bits fell into place.

Another very memorable bit of this talk was something that Hadi essentially tacked on at the end in response to a question from the audience: It was a one-liner for a .NET mocking framework that essentially returned a dynamically created (mock) object that implemented a given interface… it took a couple of seconds to sink in for me… this is just a little bit mind-bending if you really think about it. I want this in Delphi Win32! Now with the revived RTTI support in Delphi 2010 I think we’re already heading in the right direction that will eventually lead towards such functionality.

Ray‘s keynote on Effective UI Design

I think every developer should go see this talk at least once (I think I’ve seen it three times now in various incarnations and it just keeps getting better). This time Ray also included some (IMHO) very valid concerns about recent changes in the Delphi IDE, especially the Options dialogs. I couldn’t agree more.

Daniel (M) on advanced Debugging techniques

Even though this was already a highly informative and entertaining talk in its own right this would already have been worth it just for showing SafeMM alone! You should check it out, too: It’s a special-purpose memory manager created used by the CodeGear debugger team (thanks Chris for the clarification) to catch improper memory access directly where it happens rather than having to wait for the symptoms of such mistakes. If I understood Daniel correctly it’s a branch of FastMM.

Olaf on the new RTTI system

Can’t wait to get my hands on Delphi 2010 after this talk even though I had seen some of the new stuff at CodeRage already. This is a major milestone!

Jim and Sebastian on AOP using Delphi Prism (actually two individual talks)

This is a really new and intriguing concept and a great approach for separating concerns and getting rid of repetitive code without actually hiding it. The whole “Unquote” thing remains a bit of a mystery, though even after having seen both talks. I guess it’ll probably become clearer as you actually write aspects yourself.
Can’t wait to have aspects in Win32 even though I can well imagine that it will be some time before we see this as it will need really deep compiler support and I know what I would like the CodeGear compiler guys to focus on first instead (hint: there will be a 64-bit edition of Office 2010).

Marco and Daniel (W) on developing for Windows 7 (two individual talks)

Not really a lot of new things if one has been following the blogosphere and played around with Seven oneself already but still very informative and well-presented. I can also now say that I was there as it happened… 😉


A couple of last things I’m afraid I will have to get off my chest:

I was a bit underwhelmed if not even a little disappointed with the presence and (perceived) involvement of Embarcadero Germany as compared to past conferences(!), especially considering that they were again the Gold Sponsor of this conference: Their booth (which was pretty much hidden away behind a pillar) in the expo area was empty whenever I checked. They also didn’t advertise any conference rebates or raffle prizes as was customary in past years (though this post (in German) seems to suggest that a rebate offer might still be forthcoming by email).

Another slightly unnerving thing for me was that the conference IMHO missed a proper sense of closure: The agenda did not contain a closing session to boot. After the last session the conference was simply over. I could do without the endless raffle drawing of past years (even though one is of course always secretly hoping against hope to win something worthwhile) but I would have preferred at least to see the conference end with a speaker panel and a closing statement from representatives of CodeGear and Software&Support like there always was in past years. I might only be projecting my own feelings at others but I was under the impression that I was not the only one who felt a little bit “ordered but uncollected” (as we say in German) while we were standing in the lobby realizing that this was it and we could go home now.
Before anyone mentions it: there actually was a spontaneously(!) held raffle drawing but it started the very minute that the last sessions were scheduled to end (and we all know that speakers never exceed their time slots, don’t we) and lasted for about 15 minutes. By the time that I came out of the last session it was already over.

Anyway, I am very much looking forward to EKON 14 and other community events that will hopefully be happening during the next 12 months. See you there!

Posted in Delphi, Events | Tagged: , , , , | 7 Comments »

10 clicks…

Posted by tier777 on 2009-08-25

In the best case scenario it takes me at least ten clicks, 5 of which are redundant, and quite a bit of lucky guessing, to get from the “immediate purchase” link in the Delphi 2010 press release to a page where I see even so much as a price tag… and still left wondering whether this is even the best offer… isn’t that a bit… erm, how do I put this… ridiculous?

  1. Click “immediate purchase”
  2. Click “Europe”
  3. In the “Germany” section, click “Find an International Distribution Partner”
  4. In the “By country” section, drop down the selection list
  5. scroll down
  6. select “Germany” (again! – see 3.)
  7. Click “Submit”
  8. Select one out of 32 arbitrary vendors from the Partner Directory (and be sure to click the link in the right hand column as otherwise you will have to click once more to actually get to the vendor’s page), many of which do not even appear to have an online shop at all as far as I can tell… Most do not even mention Delphi or RAD Studio on the front page.
  9. If you took a lucky guess in the previous step the vendor will have a direct link to the Delphi product page on its front page. If so, click it. Otherwise take however many clicks it takes you on that vendor’s page to select Delphi (again! – see 1.) from the product catalog.
  10. Click through to the page with the pricing information only to find out that, as usual, there is a whopping 43% premium for European customers on the Pro upgrade ESD!

So much for “immediate purchase”…

In the words of Donna Noble: You’ve got to be kidding me!

That said, Delphi 2010 does still look like a worthwhile point upgrade from a technical POV… My sincerest kudos to the R&D team!

here’s my calculation, in case you were wondering:

  • Delphi Pro UPG ESD in US online shop:   399 USD ~ 279 EUR (as of the time of this writing)
  • Delphi Pro UPG ESD in EU online shop: ~399 EUR excl. VAT
  • 120 EUR difference! (~43% of 279 EUR)

Posted in Delphi, Rants | Tagged: , , , , , , | 4 Comments »

Discount coupon for Add-in Express

Posted by tier777 on 2009-06-10

This was originally only intended for the attendees of my talk at the Delphi-Tage, but I now got permission to post it here on the blog, especially as the code had only arrived in my Inbox a mere 30 minutes after I had already left for Hamburg and so I wasn’t able to show it during the talk at all (it will be included in the slides that should be made available for the participants within the week via the page, though):

Using the code ADX-VCLSTD30 you can order Add-in Express 2009 for Office and VCL Standard at a 30% discount. The code is valid until 10 July 2009. Note that you can upgrade from this discounted Standard version to Professional or Premium for the respective price difference between Standard and Professional or Standard and Premium. Also note that even if you make use of the discount you will still have an unconditional 30 day money-back guarantee.

For the differences between Standard, Pro and Premium please refer to the Feature Matrix.

If 30% on the Standard version is not enough for you, I’d like to direct your eyes in the general direction of their discounts and special offers page. There should be something for anyone there, really.

And so the circle closes… 😉 a similar offering was also how I first heard about Add-in-Express almost exactly two years ago.

In case you’re wondering: Add-in Express is a VCL framework for true RAD-development of all kinds of Office addins (besides advanced Outlook addins you can also create addins for all other Office products as well as SmartTags and Excel RTD Servers) with special focus on seamless integration with the Office GUI. This allows you to really concentrate on the essential functionality of your addin right from the get-go rather than wasting days or weeks on tasks like trying to get a simple commandbar button to work across all Office versions.

P.S. : As I continue producing flash videos about Outlook addin-development I will eventually cover Add-in Express as well. In the meantime, you can take a look at their own Screencasts.

Posted in Delphi | Tagged: , , , , , | Leave a Comment »

Resources for Developing Outlook-Addins with Delphi

Posted by tier777 on 2009-06-09

[deutsche Fassung dieses Artikels: siehe voriger Eintrag]

Here’s a commented list of links that accumulated during the preparation for my talk on developing Outlook-addins with Delphi at last weekend’s Delphi-Tage event in Hamburg (also containing some information that I did not end up covering for various reasons):

Official API-References and related Information:

Source code, Tutorials and Example-Addins:

  • Extended MAPI-Headers for Delphi:
    (indispensable for any kind of Extended MAPI development, also when combined with Redemption – see below)
  • BabelFish for Outlook:
    (the required target WebService is no longer online but the source code of this addin works very well as a starting point for new addins)
  • Trust Filter for MS Outlook:
    (a non-trivial Outlook-Addin with freely available source code, written in Delphi)
  • – Developer Learning Center for Microsoft Outlook
    (Heaps of examples, articles, tutorials, links, etc. – mostly VB(A/S) or C# rather than Delphi, though)
  • – Outlook & Exchange Solutions Center
    (the definitive information portal for all things Outlook and Exchange)

Products presented or used:


(Attention! Time for a quick commercial break. 😉 )

  • Lucatec GmbH:
    (my “hand that feeds”, without whom this talk wouldn’t have happened)
  • Lucatec® Mask:
    (our addin for automating several tasks related to the use of shared mailboxes or Public Folders in a team, Shareware)

(end of commercial break)

    (extensive articles and tutorials all about COM programming with Delphi and C++-Builder by Binh Ly – a real eye-opener for anyone that has been struggling with this topic so far)
  • You can use the following .reg-file to perform registration and unregistration of COM-DLLs directly from the Explorer context menu:
Windows Registry Editor Version 5.00



@="regsvr32.exe \"%1\""


@="regsvr32.exe /u \"%1\""

Posted in Delphi, Outlook | Tagged: , , , | Leave a Comment »

Delphi Tage 2009 – Recap

Posted by tier777 on 2009-06-07

[deutsche Fassung dieses Artikels: siehe voriger Eintrag]

So, I am back from this year’s Delphi-Tage (“Delphi Days”) in Hamburg and had a little time to let the impressions sink in a little. As has been mentioned by many participants, the uniqueness of the venue will be hard to top for future events (but then, why should it have to? – after all, it’s the overall-experience, the people, the sessions and of course Delphi that should be the main attraction, shouldn’t it?)

Der Veranstaltungsort - Die Cap San Diego

This year's venue - The Cap San Diego

Publikum bei David's Keynote

Audience at David I's Keynote

(more pictures can be found in the coresponding  album on the DelphiPraxis forum, as well as on the Delphi-Treff site)

A big praise to Daniel Wolf for organizing the “pre-con” barbecue at “cult” football club FC St. Pauli’s where we met in a nice setting with great food and a couple of nice cold beers where you could also chat pleasantly about non-programming, non-Delphi-related topics for a change, all in the middle of the vibrant (German part of the) Delphi community.

The main event started on Saturday morning. Attendance was pretty high (over 250 people, including speakers and exhibitors, if I overheard that correctly). I was especially pleased to see so many “out” themselves as first-timers during the hand-raising section at the conclusion of the event. And the average age of the audience was also way lower than I have seen at similar events in the past which can only be a good sign, right?

David I’s keynote offered little new to anyone who had been following the coverage of last month’s  Delphi Live! conference in San Jose. It’s nevertheless always a joy to see and hear David talking. You just totally get that there is someone who’s truly got his heart in what he’s saying.

After a quick break started the first round of sessions, whereas I myself unfortunately wasn’t able to see a lot of it as I had to leave during the coffee break to find a less pricey parking space for my car and only returned (quite out of breath and sweating) for the second half of Jeroen Pluimers‘ very hands-on talk about IDE-addins and other useful tips for increasing developer productivity. Though, as at that point the room was so full that I had to stand in the doorway to the adjoining second session room, where Bernd Ott was doing an equally interesting talk about Subversion I was only able to watch and listen with half an ear and eye.

Bernd Ua - Softwaretests

Bernd Ua - Softwaretests

After that I went to see Bernd Ua’s talk about software testing and DUnit which I watched from quite an unusual viewpoint (see picture to the left). In the meantime the time for my own talk was rapidly approaching and as this was going to be the first of its kind since almost exactly 9 years to the day (minus a month), my tension was rising considerably. As a result I could unfortunately only watch the first half of Daniel Wischnewski’s entertaining talk about the  Windows 7 Taskbar as at that point I had to step out for a quick breath of fresh air.

My own talk then was a bit of a mixed bag: While I did manage to shed most of the nervousness and was able to answer all questions from the audience, I feel that in hindsight I probably made some less than ideal decisions about weighting the individual parts of the talk in an effort to get everything in there that I had announced I would cover. Sadly, time ran out on me even before I got to the concluding segment about Extended MAPI and Redemption so I could only hasten through the slides about those topics rather than actually show some practical examples.

Well, one should learn from one’s mistakes. I will try to cover the bits that got a bit of a short end here on the blog in the form of more videos and also to do better at the next live talk. I hope everyone was still able to take away something interesting for him or herself. Please feel free to post any unasked questions here on the comment thread.

One note to the organization team regarding breaks: Please make sure that next time there will always be at least 10 minutes between sessions. That way people will actually have some time to get from one session to the next if it is in a different room than the previous one and also to step out to catch some fresh air or for taking last break’s coffee to the pottery department and so on. Furthermore, as a speaker you typically also need a couple of moments before you have got all the wiring in place and your notebook booted up properly. As most speakers (including my predecessor and me) made use of their time slot to the very last second that set-up time had to count against the regular session time while all the while the audience was already champing at the bit. 😉

The day’s finale in the Gröninger Brauhaus was quite pleasant and fun. In my mind the pub/restaurant visit at the end has really become a stock item of the Delphi Tage events in its own right.

The first thing I found in my inbox when I turned on my computer for the first time since my return was a belated (actually, it had arrived a mere 30 minutes after I had left for Hamburg) email from the Add-in-Express team, containing a 30% rebate coupon for the attendees of my talk. I will make sure to include that in my slides before I send them off. Speaking of which, the slides of the entire event (including mine) will shortly be made available  via the DelphiPraxis forum as one big downloadable ZIP-archive. I will post the link here once it is available.

Posted in Delphi | Tagged: , , | Leave a Comment »

Creating Outlook-Addins with Delphi – Part 2 (Option Pages)

Posted by tier777 on 2009-06-04

Creating Outlook-addins with Delphi - Part 2

So, here’s the second example on creating Outlook-Addins with Delphi which will likely not be included in my talk at the German Delphi-Tage due to time constraints.

In this one I show how to add an option page to your addin, which is typically used for letting the user configure your addin or for displaying version and contact information.

Again, raw and unedited (I’m probably talking too fast in this one). Recorded at 1024×768 in English, 9 minutes and 28 seconds.


[Part 1]

Posted in Delphi, Outlook | Tagged: , , , , , , , | Leave a Comment »

Creating Outlook-Addins with Delphi – Part 1

Posted by tier777 on 2009-06-04

Creating COM-Addins with Delphi - Part 1
I have now uploaded a screen video of the first example from my upcoming talk about creating COM-addins with Delphi at the German Delphi Tage event.

This is raw and unedited and I assume prior knowledge of some COM-basics and terminology like CoClasses, ProgIDs and type libraries and how to create and register COM-DLLs.

This was recorded at 1024×768 in English language (while the live talk will be in German) and is 7 minutes 29 seconds long.


[Part 2] Option Pages

Posted in Delphi, Outlook | Tagged: , , , , , , , | 3 Comments »

Moving on…

Posted by tier777 on 2009-06-03

I have now moved this blog from to which offers me some more flexibility. It is however quite likely that this will also not be its final location as I intend to move on to a self-hosted WordPress installation in the short to mid term but there are a couple of things yet to sort out before I do that. In the meantime you may bookmark the following address:

The preferred method to subscribe to the new blog is via FeedBurner from the following link:

Subscribe in a reader

Hopefully there’ll also be a slew of new content coming “really soon now” (keeping fingers crossed) as I get ready for my talk about Outlook Addin Development at the Delphi Tage event this weekend in Hamburg.

Signing out… (from LiveJournal)

Posted in Delphi, Meta | Tagged: , , , , , , | Leave a Comment »

Delphi 2009 Installation Experience

Posted by tier777 on 2008-12-16

This was a mixed bag so far. On the plus side it indeed was faster and less convoluted than the Delphi 2007 install. Also, it appears to have produced a working installation eventually. But…

I have installed Delphi 2009 Professional myself on two different machines now. A co-worker did the same on his own machine. On all three machines the main install was not successful initially, failing to install the "dbpack" component for some unexplained reason. Also, after the main installer was finished all three machines rebooted without warning or a prompt to delay the reboot. All open apps were simply terminated hard as soon as I hit the Finish button and Windows went into shutdown.

After the reboot I manually installed the dbpack as recommended in the preceding error message. This worked flawlessly. On my home machine I had to reboot again after this was done. At least this time it gave me a chance to first save my work and reboot when I was ready.

Help installation took a while longer than the main installer but otherwise also worked flawlessly. Online registration also was no problem on all three machines using existing CDN account data.

Checking for and installing the updates did not work out of the box on the two machines here at work, both failing with exactly the same symptoms. Strangely enough after having correctly identified the available Update 1 and downloading it the update installer aborted with an error from the 16-bit MS-DOS subsystem (huh?) and then hung itself. After I terminated it any attempt to check for updates always resulted in the message that no updates were available. Running the downloadable Update 1 installer from the registered users page however worked flawlessly again.

I don’t remember having had any such problems when I installed the trial version a month ago – well, except that I couldn’t install the Update 1 – but I think that was by design as it only appears to be available to registered users.

Posted in Delphi | Tagged: , , | Leave a Comment »