Bill, Your code is a far better solution. > B) The -1's below really should be: INVALID_HANDLE_VALUE Check with the implementation and MSDN you will see that the return type is long and the error condition is -1. INVALID_HANDLE_VALUE is not of type long and will give a compile warning C4047. Barry