title: VB6: CreateFile() creates file with garbled name in current working directory
body: <p>I was troubleshooting a problem where CreateFile couldn't open an existing named pipe when I found CreateFile() didn't work well with the filename parameter. My code is:</p>
  
  <pre><code>Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileW" ( _
  ByVal lpFileName As String, _
  ByVal dwDesiredAccess As Long, _
  ByVal dwShareMode As Long, _
  ByVal lpSecurityAttributes As Long, _
  ByVal dwCreationDisposition As Long, _
  ByVal dwFlagsAndAttributes As Long, _
  ByVal hTemplateFile As Long) As Long
  
  pipeHandle = CreateFile("C:\\test.txt", GENERIC_READ Or GENERIC_WRITE, 0&amp;, 0&amp;, CREATE_ALWAYS, 0&amp;, 0&amp;)
  </code></pre>
  
  <p>It does not create the file in C:\, instead, it creates a file in the current VB working directory, with a garbled filename. It seems CreateFile cannot recognize and parse the given filename string.</p>
  
  <p>Why is this happening? I'm using VB6 on Windows 7 (used some trick to install it). Could that be causing the problem?</p>