I am still trying to resolve a problem I\'m having, the first part of it was that I apparently need to call WNetAddConnection2 in order to use CreateFile to open a file across a
You are right about why it's not working. You are passing a local file name (e.g. Z:\Documents\somefile.txt) when you should be passing a share name (e.g. \\myserver\sharename).
If the share is already connected to Z: then you don't need to call WNetAddConnection2.
If the share is not already connected to Z: then there's no way you can automatically convert Z:\Documents\somefile.txt to a remote name because Windows has no idea what Z: represents.
If the share might not be connected then your program needs to know in advance what share Z: is supposed to connect to and make the connection itself. You can either connect the share to Z: and use the existing path, or connect it with no drive letter and adjust the path yourself; you just need to replace the Z:\ with \\myserver\sharename\.