FILEDLG.ASM
上传用户:ys_happy
上传日期:2007-01-09
资源大小:20k
文件大小:2k
源码类别:

汇编语言

开发平台:

Asm

  1. .386
  2. .model flat,STDCALL
  3. include win32.asi           ; some 32-bit constants and structures
  4. include win32.ase
  5. include commdlg.asi
  6. public OpenFileDialog, SaveFileDialog
  7. .data
  8. ofnData OPENFILENAME <?>
  9. szFilter db "Fractal Designer",0,"*.fdz",0
  10.  db "Any File",0,"*.*",0,0
  11. szFileName db 260 DUP (?)
  12. szFileTitle db  260 DUP (?)
  13. szDir db 260 DUP (?)
  14. szDefExt db "fdz"
  15. .code
  16. setofndata PROC name : DWORD, data : DWORD, handle : DWORD
  17. mov [szFileName],0
  18. mov esi,[name]
  19. or esi,esi
  20. jz noname
  21. lea edi,[szFileName]
  22. cllp:
  23. lodsb
  24. stosb
  25. or al,al
  26. jnz cllp
  27. noname:
  28. mov esi,[data]
  29. mov [esi].oflStructSize, size OPENFILENAME
  30. mov eax,[handle]
  31. mov [esi].ofhwndOwner, eax
  32. mov [esi].ofhInstance,0
  33. mov [esi].oflpstrFilter,offset szFilter
  34. mov [esi].oflpstrCustomFilter,0
  35. mov [esi].ofnMaxCustFilter,0
  36. mov [esi].ofnFilterIndex,1
  37. mov [esi].oflpstrFile,offset szFileName
  38. mov [esi].ofnMaxFile,260
  39. mov [esi].oflpstrFileTitle,offset szFileTitle
  40. mov [esi].ofnMaxFileTitle,260
  41. mov [esi].oflpstrInitialDir,offset szDir
  42. mov [esi].ofFlags,OFN_NOCHANGEDIR  + OFN_LONGNAMES + OFN_HIDEREADONLY
  43. mov [esi].ofnFileOffset,0
  44. mov [esi].ofnFileExtension,0
  45. mov [esi].oflpstrDefExt,offset szDefExt
  46. mov [esi].oflCustData,0
  47. mov [esi].oflpfnHook,0
  48. mov [esi].oflpTemplateName,0
  49. ret
  50. setofndata ENDP
  51. OpenFileDialog PROC name : DWORD, handle :DWORD
  52. push esi
  53. call setofndata,[name],offset ofnData, [handle]
  54. or [esi].ofFlags,OFN_CREATEPROMPT
  55. call GetOpenFileName,esi
  56. pop esi
  57. or eax,eax
  58. jz nofd
  59. lea eax,[ofnData]
  60. nofd:
  61. ret
  62. OpenFileDialog  ENDP
  63. SaveFileDialog PROC name : DWORD, handle :DWORD
  64. push esi
  65. call setofndata,[name],offset ofnData, [handle]
  66. or [esi].ofFlags,OFN_OVERWRITEPROMPT
  67. call GetSaveFileName,esi
  68. pop esi
  69. or eax,eax
  70. jz nosd
  71. lea eax,[ofnData]
  72. nosd:
  73. ret
  74. SaveFileDialog  ENDP
  75.      end