>Hi Nadya,
>
>>The CreateFile function creates a file successfully, but then WriteFile function fails. What should I take into consideration to use your code?
>
>At the beginning of the function declare the following API function
>
>DECLARE LONG GetLastError IN Win32API
>
>Immediately after WriteFile call the function. The return value should indicate why the code is failing. If you have Visual Studio installed, there's a tool called error lookup that gives you the error message. Or just post the code here.
Thanks, Christof. I added an Error trapping routine to the procedure (thanks to Sergey Berezniker). It works nicely if the service is running. However, it doesn't show message if the service is not running, but still returns true.
If it's not broken, fix it until it is.
My Blog