Thanks ASerge,
Yes, I did have another function before get last error, I sent the handle to an edit box to read it!
OK, the error is actually 5 (access denied). Upon closer inspection of the CreateFile() function I realised that the access flags had not been set properly.
Problem now solved.
Thanks for pointing me in the right direction.
DG