_FindFile proc uses edi ebx _lpszPath
local @stFindfile:WIN32_FIND_DATA
local @hFindFile
local @szPath:BYTE ;''used to load?file path name\?
local @szSearch:BYTE ;''used to load?file path name\*.*?
local @szFindFile:BYTE ;''used to load?file path name\the found file path name?
local @szbuffer:BYTE
invoke GetDlgItemText,hDlg4,1000,addr @szbuffer,sizeof @szbuffer
invoke lstrcpy,addr @szPath,_lpszPath
;********************************************************************
;add \*.*at the end of the file path
;********************************************************************
@@:
invoke lstrlen,addr @szPath
lea esi,@szPath
add esi,eax
xor eax,eax
mov al,'\'
.if BYTE ptr != al
mov WORD ptr ,ax
.endif
invoke lstrcpy,addr @szSearch,addr @szPath
invoke lstrcat,addr @szSearch,addr szAll
invoke FindFirstFile,addr @szSearch,addr @stFindFile
.if eax != INVALID_HANDLE_VALUE
mov @hFindFile,eax
.while eax !=0
invoke lstrcpy,addr @szFindFile,addr @szPath
invoke lstrcat,addr @szFindFile,addr @stFindFile.cFileName
.if @stFindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
.if @stFindFile.cFileName != '.'
invoke _FindFile,addr @szFindFile
ret
.endif
.else
invoke SetDlgItemText,hDlg4,110,addr @szFindFile
invoke lstrcmp,addr @szbuffer,addr @stFindFile.cFileName ;@szbuffer used to load the file which the user want to find
.if eax == 0
invoke FindClose,@hFindFile
ret
.endif
.endif
invoke FindNextFile,@hFindFile,addr @stFindFile
.endw
.if @hFindFile
invoke FindClose,@hFindFile
ret
.endif
.endif
ret
_FindFile endp
--------------------------------------------------------------------------------
local @stFindfile:WIN32_FIND_DATA
local @hFindFile
local @szPath:BYTE ;''used to load?file path name\?
local @szSearch:BYTE ;''used to load?file path name\*.*?
local @szFindFile:BYTE ;''used to load?file path name\the found file path name?
local @szbuffer:BYTE
invoke GetDlgItemText,hDlg4,1000,addr @szbuffer,sizeof @szbuffer
invoke lstrcpy,addr @szPath,_lpszPath
;********************************************************************
;add \*.*at the end of the file path
;********************************************************************
@@:
invoke lstrlen,addr @szPath
lea esi,@szPath
add esi,eax
xor eax,eax
mov al,'\'
.if BYTE ptr != al
mov WORD ptr ,ax
.endif
invoke lstrcpy,addr @szSearch,addr @szPath
invoke lstrcat,addr @szSearch,addr szAll
invoke FindFirstFile,addr @szSearch,addr @stFindFile
.if eax != INVALID_HANDLE_VALUE
mov @hFindFile,eax
.while eax !=0
invoke lstrcpy,addr @szFindFile,addr @szPath
invoke lstrcat,addr @szFindFile,addr @stFindFile.cFileName
.if @stFindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
.if @stFindFile.cFileName != '.'
invoke _FindFile,addr @szFindFile
ret
.endif
.else
invoke SetDlgItemText,hDlg4,110,addr @szFindFile
invoke lstrcmp,addr @szbuffer,addr @stFindFile.cFileName ;@szbuffer used to load the file which the user want to find
.if eax == 0
invoke FindClose,@hFindFile
ret
.endif
.endif
invoke FindNextFile,@hFindFile,addr @stFindFile
.endw
.if @hFindFile
invoke FindClose,@hFindFile
ret
.endif
.endif
ret
_FindFile endp
--------------------------------------------------------------------------------
I want to find the file which was inputed in an edit box
for example:I want to find the file which named "text.mdb"
and I know it is in the D:\
I uses the _FindFile function which was created by myself to find the file.
in the edit box ,i input "text.mdb" in the volumenumber edit box i input "D:\"
Now,I start to search,but when the function find the file "text.mdb",the function can't be run out.of course ,the _FindFile function is failed to search.
The output should be "D:\programfiles\login\text.mdb"
what should i do ? can you help me !!!
thank you!!!
for example:I want to find the file which named "text.mdb"
and I know it is in the D:\
I uses the _FindFile function which was created by myself to find the file.
in the edit box ,i input "text.mdb" in the volumenumber edit box i input "D:\"
Now,I start to search,but when the function find the file "text.mdb",the function can't be run out.of course ,the _FindFile function is failed to search.
The output should be "D:\programfiles\login\text.mdb"
what should i do ? can you help me !!!
thank you!!!
i think this example which in masm32pack will help you!
\Masm32\examples\exampl05\findfile\findfile.asm
\Masm32\examples\exampl05\findfile\findfile.asm
how do i to get the example?
My masm32 didnt have these example which you said
My masm32 didnt have these example which you said
Many people are confused by the similarity of the names MASM and MASM32.
The MASM32 Package is an (apparently authorized) redistribution of the MASM package, it contains a number of items not found in the authentic MASM Package, such as a bunch of examples written around a helper library called 'm32lib'.
You can find the MASM32 Package at http://masm32.com
The MASM32 Package is an (apparently authorized) redistribution of the MASM package, it contains a number of items not found in the authentic MASM Package, such as a bunch of examples written around a helper library called 'm32lib'.
You can find the MASM32 Package at http://masm32.com