×

查找文件夹api

查找文件夹api(查找文件夹linux命令)

admin admin 发表于2023-03-21 15:12:09 浏览48 评论0

抢沙发发表评论

本文目录一览:

VB获取文件夹路径

给你个VB遍历文件夹的代码吧

Private

Declare

Function

FindFirstFile

Lib

"kernel32"

Alias

"FindFirstFileA"

(ByVal

lpFileName

As

String,

lpFindFileData

As

WIN32_FIND_DATA)

As

Long

'查找下一个文件的API

Private

Declare

Function

FindNextFile

Lib

"kernel32"

Alias

"FindNextFileA"

(ByVal

hFindFile

As

Long,

lpFindFileData

As

WIN32_FIND_DATA)

As

Long

'获取文件属性的API

Private

Declare

Function

GetFileAttributes

Lib

"kernel32"

Alias

"GetFileAttributesA"

(ByVal

lpFileName

As

String)

As

Long

'关闭查找文件的API

Private

Declare

Function

FindClose

Lib

"kernel32"

(ByVal

hFindFile

As

Long)

As

Long

Const

MAX_PATH

=

260

Const

MAXDWORD

=

HFFFF

Const

FILE_ATTRIBUTE_DIRECTORY

=

H10

Private

Type

FILETIME

dwLowDateTime

As

Long

dwHighDateTime

As

Long

End

Type

Dim

tempstr

As

String

'定义类(用于查找文件)

Private

Type

WIN32_FIND_DATA

dwFileAttributes

As

Long

ftCreationTime

As

FILETIME

ftLastACCESSTime

As

FILETIME

ftLastWriteTime

As

FILETIME

nFileSizeHigh

As

Long

nFileSizeLow

As

Long

dwReserved0

As

Long

dwReserved1

As

Long

cFileName

As

String

*

MAX_PATH

cAlternate

As

String

*

14

End

Type

Dim

filecount

As

Integer

Dim

dirs()

As

String

Dim

curr

As

Long

Dim

ss()

As

String

Private

Sub

Command1_Click()

tempstr

=

"c:"

searchdir

tempstr

filecount

=

End

Sub

Public

Function

searchdir(path

As

String)

Dim

WFD

As

WIN32_FIND_DATA

Dim

i

As

Long

Dim

temp

As

String

Dim

h

As

Long

Dim

zhaodao

As

Long

Dim

iindex

As

Integer

Dim

dirs()

As

String

Dim

l

As

Long

zhaodao

=

1

h

=

FindFirstFile(path

"\*.*",

WFD)

If

h

-1

Then

While

zhaodao

zhaodao

=

1

temp

=

Left(WFD.cFileName,

InStr(WFD.cFileName,

Chr$(0))

-

1)

If

temp

"."

And

temp

".."

Then

If

WFD.dwFileAttributes

And

vbDirectory

Then

ReDim

Preserve

dirs(iindex)

dirs(iindex)

=

path

"\"

temp

iindex

=

iindex

+

1

ReDim

Preserve

ss(filecount)

ss(filecount)

=

path

"\"

temp

filecount

=

filecount

+

1

End

If

End

If

zhaodao

=

FindNextFile(h,

WFD)

Wend

End

If

FindClose

(h)

If

iindex

Then

For

i

=

To

iindex

-

1

Call

searchdir(dirs(i))

Next

i

End

If

End

Function

mfc如何使用多线程搜索文件夹?

1、根据API中的文件和目录操作函数构成一个具有递归功能的目录遍历和文件查找

2、可以根据MFC中对线程的封装格式,将上述操作放入线程函数中

3、更多交流参考我空间文章。

jdk中api文档在哪个文件夹中

第一步 找到jdk安装目录

第二步 进入jdk1.6文件夹

第三步 找到docs文件夹

第四步 打开index.html,根据关键字查看api用法