Reading Version Information from your EXE

Very often, you have to check some information contained in the VERSIONINFO section of your application and most of the examples you can find on the InterWebz are doing it by using this WinAPI routine: GetFileVersionInfo. Continue reading

Posted in Delphi, Resources, Windows | Tagged , , | 4 Comments

A little bit of zis, etc. #4

  • It’s been almost a year… I’ve been pretty busy and I have had some posts in the works for a long time that still needed some attention. I’ve decided it was time to clean the closet and get them out now even if they are more or less in draft mode, provided they can be useful to someone.
  • The 1st one, about playing sounds from resources is already out here.
  • It’s even a good example of why they should be out there, because it can start a dialogue with the readers and the feedback is indeed very valuable. Chris Rolliston, of Delphi Haven and Delphi Foundations fame, made an excellent point in his comment which had me to update my post.
  • So if you read it before seeing any comment, I suggest you go back to see the update.
  • Another post is coming about Debug Visualizers for StringLists and Strings, to extend somehow the defaults ones. (enhancements from my DelphiLive session of last year; far from perfect, but I’ve found them useful anyway)
  • XE3 seems almost there although nobody appears to know for sure what’s in store…
  • If XE3 supports Win 8 well enough, gestures might at last get some 1st class exposure.
Posted in Delphi, General, Personal, Uncategorized | Tagged , | 1 Comment

Embedding and playing Sound/Music in a Delphi Application

Or

The new old stuff…

We had to make the application play specific sounds as a status indicator that doesn’t require the user to look at the screen. To avoid external dependencies, the idea is to embed some WAV files as resources in the executable.

Now if you go and search online for some example, you’ll fine plenty of very similar recipes (and duplicates).

Unfortunately most of those are quite outdated and whilst still workable are not as simple as you can get it with the modern Delphi versions and require some command-line invoking the resource compiler BRCC32 manually… (just Google the title and you’ll see)

So let’s try to make the IDE work for us. Continue reading

Posted in Delphi, Resources, User Interface, Windows | Tagged , , , , , , | 9 Comments

A little bit of zis, etc. #3

Back from the DelphiLive conference…

  • A big thank you to Frank and Michael who made this a very nice event.
  • There was a lot of excitement about the new XE2, from the attendees to the speakers to the Delphi team.
  • The crowd was not huge, but there was a lot of energy and good vibes.
  • Mason Wheeler has a very good report of the Keynote on his blog.
  • My thanks to those who attended my sessions. I will clean a bit my material and have it available online… But not before next week.
  • Simon Stuart ( of TKinect et al. fame) was not at the conference in San Jose, but I bet he’ll have very interesting sessions at the coming online CodeRage.
  • You can help him help the Delphi community here .
  • Interestingly, Nick Hodges was there not only as a speaker, but also to recruit for his company Gateway Ticketing.
  • And he was in competition with my former company WideOrbit who were there sponsoring the “Meet the Team” event and getting contacts and resumes to fill a lot of jobs openings.
Posted in Conference, Delphi, Jobs | Tagged , , , | 2 Comments

A little bit of zis, etc. #2

I know, I’ve been not very much of a blogger lately…

  • Delphi XE2 is announced and it surely looks like a very interesting release (and probably with some nasty bugs as well, we’ll see)…
  • I take the bet it will up Delphi a bit in the TIOBE index if it creates the buzz I think it will.
  • I will speak at the DelphiLive 2011 in San Jose, which I hope will be a good edition with a lot of XE2 goodies….
  • Something really cool made with HTML5 (better try it with Chrome).
    You’ll arrive at the top of Lombard street in SF, but when it’s finished you can try with any point having a street view in Google maps.
  • Internet is good because it keeps a trace of a lot of code snippets.
    Internet is bad because it keeps a trace of a lot of code snippets. 😉
    My next post should explain…
  • We have implemented some panning and zooming features in our Adura System Design application: it’s still cool what you can do with plain old Winapi and Delphi.
    I guess it would be totally sick with FireMonkey (if we do it, but it’s probably a huge rewrite).
  • The Silicon Valley Code Camp is back! Saturday and Sunday, October 8th and 9th, 2011. As I said in a previous post, it’s not very Delphi but totally cool.
  • Lately I’ve been back into motorcycling (thanks to my lovely and adventurous wife) and I got my first cruiser ever.
    Absolutely gorgeous design but bad UI nevertheless: The control panel is not on the handlebar but on top of the tank with the turn signals indicators at the very bottom, which means you cannot just see them if you have a full face helmet, they are hidden by the chin bar and you have to bow your head and freakin’ look at them.
    And because those turn signals do not go off automatically, I ride quite often with them on for a while and that p..sses me off.
Posted in Conference, Delphi, Uncategorized, User Interface, Windows | Tagged , , , , , , , | 2 Comments

The Unfortunate Effect of WM_SETREDRAW

… or why simply replacing LockWindowUpdate by WM_SETREDRAW is not that straightforward.

As you know, when you want to avoid flickering or multiple partial redraws of your Forms, during a flurry of updates for instance, even though it is very tempting, you must not use LockWindowUpdate. The Windows documentation has been updated from the days when it practically enticed people into using this API call for this wrong purpose and Raymond Chen has explained in detail why:
What does LockWindowUpdate do?
With what operations is LockWindowUpdate meant to be used?
With what operations is LockWindowUpdate not meant to be used?
Final remarks on LockWindowUpdate

Now, just replacing LockWindowUpdate(MyForm.Handle) by SendMessage(MyForm.Handle, WM_SETREDRAW, 0, 0) on the whole Form is not the solution either. Continue reading

Posted in Delphi, User Interface, Windows | Tagged , , , , | 2 Comments

When The Debugger Leaks…

… you may end up chasing memory leaks that don’t exist.

I was at work investigating some bizarre behavior of our application when dealing with a big customer file and I had ReportMemoryLeaksOnShutdown turned on as it was very likely there was some memory leaked.
So, I donned my LeakBuster suit, armed my LeakBlaster and started hunting the leaks, Continue reading

Posted in Debugger, Delphi, Quality | Tagged , , , , , | 22 Comments

A little bit of zis, etc.

I haven’t blogged in quite a while… I have been busy at work and at home. And now I’m with the family for an extended week-end in the mountains.

So, this post will be more like a pot-pourri of little tidbits a la Nick Hodges.

  • It’s kind of irritating when in Delphi’s editor the parenthesis matching goofs and counts those embedded in strings:
  • Format('I have %d closing )', [n])
  • You don’t appreciate the comfort of doing software in a software realm, with pretty stable APIs, some sort of object model and a stuff called specifications, until you begin to deal with hardware devices that can make darwinism look like immobilism.
  • Delphi is back in the top 10 of the TIOBE Index this month. I guess it is a good sign. Don’t know if one can read too much in it…
  • Certainly, there is more to do to bump Delphi’s name recognition. My son is back home for the holidays from his college. He started this year in Software Engineering at a well known university. He has yet to hear about Delphi (except by myself at home).
  • It’s certainly time to wish you all very happy holidays. Enjoy time with you family and take care!
Posted in Delphi, Personal, Quality | Tagged , , , , , , | Leave a comment

French Delphi Speech Session Downloadable

The zip of my CodeWay 4 session (in French) is now available for download here.

FYI, the old CodeRage 4 session (in English) is also available from Embarcadero: “Speech Enabling Delphi Applications (zip)”

Posted in Conference, Delphi, Speech, User Interface, VCL, Windows | Tagged , , , , , , , , | 1 Comment

FieldByName, FindField: too convenient to be honest

I don’t know about you, but I can’t count anymore the number of times I’ve seen this code pattern (in code snippets online as well as in production code):

  while not ADataSet.Eof do
  begin
    [...]
    ADataSet.FieldByName('MyFieldName1').SomePropertyOrMethod;
    ADataSet.FieldByName('MyFieldName2').SomePropertyOrMethod;
    [...]
    ADataSet.Next;
  end;

Using FieldByName in a case like this is certainly very convenient and has a lot of advantages: Continue reading

Posted in Coding standard, Delphi, Quality | Tagged , , , , , | 36 Comments