FILEDLG.ASM
上传用户:ys_happy
上传日期:2007-01-09
资源大小:20k
文件大小:2k
- .386
- .model flat,STDCALL
- include win32.asi ; some 32-bit constants and structures
- include win32.ase
- include commdlg.asi
- public OpenFileDialog, SaveFileDialog
- .data
- ofnData OPENFILENAME <?>
- szFilter db "Fractal Designer",0,"*.fdz",0
- db "Any File",0,"*.*",0,0
- szFileName db 260 DUP (?)
- szFileTitle db 260 DUP (?)
- szDir db 260 DUP (?)
- szDefExt db "fdz"
- .code
- setofndata PROC name : DWORD, data : DWORD, handle : DWORD
- mov [szFileName],0
- mov esi,[name]
- or esi,esi
- jz noname
- lea edi,[szFileName]
- cllp:
- lodsb
- stosb
- or al,al
- jnz cllp
- noname:
-
- mov esi,[data]
- mov [esi].oflStructSize, size OPENFILENAME
- mov eax,[handle]
- mov [esi].ofhwndOwner, eax
- mov [esi].ofhInstance,0
- mov [esi].oflpstrFilter,offset szFilter
- mov [esi].oflpstrCustomFilter,0
- mov [esi].ofnMaxCustFilter,0
- mov [esi].ofnFilterIndex,1
- mov [esi].oflpstrFile,offset szFileName
- mov [esi].ofnMaxFile,260
- mov [esi].oflpstrFileTitle,offset szFileTitle
- mov [esi].ofnMaxFileTitle,260
- mov [esi].oflpstrInitialDir,offset szDir
- mov [esi].ofFlags,OFN_NOCHANGEDIR + OFN_LONGNAMES + OFN_HIDEREADONLY
- mov [esi].ofnFileOffset,0
- mov [esi].ofnFileExtension,0
- mov [esi].oflpstrDefExt,offset szDefExt
- mov [esi].oflCustData,0
- mov [esi].oflpfnHook,0
- mov [esi].oflpTemplateName,0
- ret
- setofndata ENDP
- OpenFileDialog PROC name : DWORD, handle :DWORD
- push esi
- call setofndata,[name],offset ofnData, [handle]
- or [esi].ofFlags,OFN_CREATEPROMPT
- call GetOpenFileName,esi
- pop esi
- or eax,eax
- jz nofd
- lea eax,[ofnData]
- nofd:
- ret
- OpenFileDialog ENDP
- SaveFileDialog PROC name : DWORD, handle :DWORD
- push esi
- call setofndata,[name],offset ofnData, [handle]
- or [esi].ofFlags,OFN_OVERWRITEPROMPT
- call GetSaveFileName,esi
- pop esi
- or eax,eax
- jz nosd
- lea eax,[ofnData]
- nosd:
- ret
- SaveFileDialog ENDP
- end