CreateFile fails in VS2005
Posted on 2006-07-23
If I create a test MFC dialog app. in VS2005 and in the OnInitDialog() generated code I add the following code just before the return:
h = CreateFile((LPCTSTR)"C:\\document.rtf",FILE_READ_EA,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL);
d = GetLastError();
CreateFile fails with d=2. If I create a the same app. in VC++6 it works fine. What gives?