The error message is clear, you need to have libpq.dll in order to use postgresql related functions. I have the latest version (8.3.1), if you want I'll send it to you. You may choose either a complete package or just the dll. Complete: 3,88 MB (7-zip self SFX), dll: 164 KB (uncompressed).
Well, I'm not sure I would say it's THAT clear!

Anyway the answer is to download pgadmin3, which, apart from being a good debugging tool for the postgres database, it also has all the required dlls.
Just a word of warning to any others falling into the same gotcha: it's no good just adding the libpq.dll into the same directory as the executable. ALL of the dlls that come with pgadmin3 should be copied over to the C:\WINDOWS\System32\.
I wasn't that keen to install postgres into every client machine that uses my app, but I guess throwing in eight or nine dlls to be copied into the system folder is not such a big deal....
