AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Friday, October 10, 2008

GetTempFileName, MAX_PATH and Vista

If you need to create a temporary file name – you normally use GetTempFileNameA API function, like I do also. Here a sample: GetTempFile - Create a temporary file. I noticed that on my Vista PC it sometimes fails with Overflow error message. On other Vista PC it fails all the time. I have no idea why it fails sometimes only, but I found how to fix it - MAX_PATH constant should be set to 32768 - this is because NTFS file path limit is not 255 characters, but 32768. So, do not forget to update your source code if you are using this function.

Update: Recently I found that increasing MAX_PATH does not always help, I am still getting Error #6: “Overflow” sometimes on some PCs. I think the reason that too many files in Temp folder, file is actually generated, even when error occurs. So I just had to use On Error Resume Next for a while…

Labels: ,

1 Comments:

Anonymous John said...

Hi Alex,

Many thanks for the tip. I appreciate your time and use of the autoemail blog!

10:41 PM  

Post a Comment

Links to this post:

Create a Link

<< Home