Build libpq.dll and libpqdll.lib interface libraries.
Get postgresql sources .tar.gz
Extract archive into e.g.: E:\PGPROG\postgresql-8.1.3
Run VS.NET command prompt
Change working directory src of the extracted source tree
cd E:\PGPROG\postgresql-8.1.3\src
Run win32 make file:
nmake.exe /f win32.mak