|
|
|
date: Tue, 12 Feb 2008 11:24:10 +0200,
group: microsoft.public.platformsdk.shell
back
Re: Testing directory existence
Or, if you prefer not to use shlwapi, which is available only with Internet
Explorer 4.0 or higher (including Windows 2000 or higher), you can use
GetFileAttributes and look for FILE_ATTRIBUTE_DIRECTORY:
http://msdn2.microsoft.com/en-us/library/aa364944.aspx
This page says it requires Windows 2000 or higher, but it's wrong! I will
provide feedback asking for it to be corrected.
Paul
"Kellie Fitton" wrote in message
news:92918d09-b461-4c45-8e64-a70946a54a36@l32g2000hse.googlegroups.com...
On Feb 12, 1:24 am, "Kürþat" wrote:
> Hi,
>
> How to test if a directory exists? Which Win32 function should be used?
>
> Thanks in advance...
Hi,
You can use the following APIs to verify that a path is a valid
directory:
PathIsDirectory()
PathIsDirectoryEmpty()
http://msdn2.microsoft.com/en-us/library/bb773621(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/bb773623(VS.85).aspx
Kellie.
date: Tue, 12 Feb 2008 15:47:55 -0500
author: Paul Baker [MVP, Windows - SDK] am
Re: Testing directory existence
... but be careful - if the file/directory of that path does not
exist, the FILE_ATTRIBUTE_DIRECTORY flag will be set (as the return
value is INVALID_FILE_ATTRIBUTES, which is "-1"). So there's first the
need to check for INVALID_FILE_ATTRIBUTES return value.
Christian
> Or, if you prefer not to use shlwapi, which is available only with
> Internet
> Explorer 4.0 or higher (including Windows 2000 or higher), you can
> use
> GetFileAttributes and look for FILE_ATTRIBUTE_DIRECTORY:
>
> http://msdn2.microsoft.com/en-us/library/aa364944.aspx
>
> This page says it requires Windows 2000 or higher, but it's wrong! I
> will
> provide feedback asking for it to be corrected.
>
> Paul
>
> "Kellie Fitton" wrote in message
> news:92918d09-b461-4c45-8e64-a70946a54a36@l32g2000hse.googlegroups.com...
> On Feb 12, 1:24 am, "Kürþat" wrote:
>> Hi,
>>
>> How to test if a directory exists? Which Win32 function should be
>> used?
>>
>> Thanks in advance...
>
>
> Hi,
>
> You can use the following APIs to verify that a path is a valid
> directory:
>
> PathIsDirectory()
>
> PathIsDirectoryEmpty()
>
> http://msdn2.microsoft.com/en-us/library/bb773621(VS.85).aspx
>
> http://msdn2.microsoft.com/en-us/library/bb773623(VS.85).aspx
>
> Kellie.
>
>
date: Wed, 13 Feb 2008 08:36:43 +0100
author: Christian Kaiser
|
|