fork download
  1. include \masm32\include\masm32rt.inc
  2.  
  3. ID_DLG_MAIN = 100
  4. ID_KONIEC = 1030
  5. ID_ZAPISZ = 1040
  6.  
  7. OFN_ENABLESIZING = 00800000h
  8. OFN_FORCESHOWHIDDEN = 10000000h
  9.  
  10. .data?
  11. hInstance dd ?
  12. hFile dd ?
  13. oofn OPENFILENAME <>
  14. bufor db 30000 dup(?)
  15. xRead dd ?
  16.  
  17. .data
  18. ofilter db '*.txt',NULL,'*.txt',NULL
  19. ocustFilter db 256 dup(NULL)
  20. ofname db 256 dup(NULL)
  21. oftitle db 256 dup(NULL)
  22. oinitDir db 'C:\',NULL
  23. oDlgTitle2 db 'Zapisz',NULL
  24.  
  25. .code
  26. DlgProc proc hDlg,uMsg,wParam,lParam:DWORD
  27. pushad
  28.  
  29. .IF uMsg==WM_CLOSE
  30. INVOKE EndDialog,hDlg,0
  31. .ELSEIF uMsg==WM_COMMAND
  32. .IF wParam==ID_KONIEC
  33. INVOKE EndDialog,hDlg,0
  34.  
  35. .ELSEIF wParam==ID_ZAPISZ
  36. mov oofn.lStructSize,SIZEOF oofn
  37.  
  38. push hDlg
  39. pop oofn.hwndOwner
  40.  
  41. push hInstance
  42. pop oofn.hInstance
  43.  
  44. mov oofn.lpstrFilter,OFFSET ofilter
  45.  
  46. mov oofn.lpstrCustomFilter,OFFSET ocustFilter
  47. mov oofn.nMaxCustFilter,SIZEOF ocustFilter ;256
  48. mov oofn.nFilterIndex,0
  49.  
  50. mov oofn.lpstrFile,OFFSET ofname
  51. mov oofn.nMaxFile,256
  52.  
  53. mov oofn.lpstrFileTitle,OFFSET oftitle
  54. mov oofn.nMaxFileTitle,SIZEOF oftitle
  55.  
  56. mov oofn.lpstrInitialDir,OFFSET oinitDir
  57.  
  58. mov oofn.lpstrTitle,OFFSET oDlgTitle2
  59.  
  60. mov oofn.Flags,OFN_ENABLESIZING OR \
  61. OFN_EXPLORER OR \
  62. OFN_FORCESHOWHIDDEN OR \
  63. OFN_PATHMUSTEXIST OR \
  64. OFN_OVERWRITEPROMPT OR \
  65. OFN_HIDEREADONLY OR \
  66. OFN_FILEMUSTEXIST OR \
  67. OFN_NODEREFERENCELINKS
  68. mov oofn.nFileOffset,0
  69. mov oofn.lpfnHook,NULL
  70. mov oofn.lpTemplateName,NULL
  71.  
  72. INVOKE GetSaveFileName,ADDR oofn
  73. .IF eax!=NULL
  74. INVOKE CreateFile,OFFSET ofname, GENERIC_READ or \
  75. GENERIC_WRITE,FILE_SHARE_READ or \
  76. FILE_SHARE_WRITE,NULL, CREATE_NEW,NULL,NULL
  77. mov hFile,eax
  78. .IF hFile!=NULL
  79. INVOKE SendMessage,hDlg,WM_SETTEXT,0,OFFSET oftitle
  80. INVOKE GetDlgItemText, hDlg, 101, OFFSET bufor, SIZEOF bufor
  81. INVOKE WriteFile, hFile, OFFSET bufor, SIZEOF bufor, ADDR xRead, NULL
  82. INVOKE CloseHandle,hFile
  83. .ENDIF
  84. .ENDIF
  85. .ENDIF
  86. .ENDIF
  87.  
  88. popad
  89. xor eax,eax
  90. ret
  91. DlgProc endp
  92.  
  93. Start:
  94.  
  95. INVOKE GetModuleHandle,NULL
  96. mov hInstance,eax
  97.  
  98. INVOKE DialogBoxParam,hInstance,ID_DLG_MAIN,0,ADDR DlgProc,0
  99.  
  100. INVOKE ExitProcess,0
  101.  
  102. END Start
  103.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty