News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Need help with GetSaveFileName

Started by ragdog, December 01, 2008, 06:39:20 PM

Previous topic - Next topic

ragdog

Hi

I have a question to GetSaveFileName this crash under xp-sp2
If i remove this
          mov  @stOF.lpstrDefExt, "txt"
          mov  @stOF.lpstrCustomFilter,NULL
          mov  @stOF.nMaxCustFilter,0

works this.



_GetSaveFileName proc uses edi, hWnd:HWND
LOCAL @stOF:OPENFILENAME

       invoke  RtlZeroMemory,addr @File,sizeof @File
       invoke  RtlZeroMemory,addr @stOF,sizeof @stOF
         mov  @stOF.lStructSize,sizeof @stOF
push  hWnd
  pop  @stOF.hwndOwner

          mov  @stOF.lpstrFilter,offset szSaveFilter
          mov  @stOF.lpstrFile,offset @File
          mov  @stOF.nMaxFile,512
          mov  @stOF.lpstrTitle, offset szBrowseTitle
          mov  @stOF.lpstrDefExt, "txt"
          mov  @stOF.lpstrCustomFilter,NULL
          mov  @stOF.nMaxCustFilter,0
          mov  @stOF.Flags,OFN_OVERWRITEPROMPT OR OFN_HIDEREADONLY
         
          .if !@File
              invoke lstrcpyn,addr @File,CTEXT ("File.txt"),256
          .endif
       
          invoke GetSaveFileName,addr @stOF
             .if  eax
      mov eax,@stOF.lpstrFile
     .endif
         ret
_GetSaveFileName endp


greets

jj2007

lpstrCustomFilter
    Pointer to a static buffer that contains a pair of null-terminated filter strings

One NULL is not enough. This might be one reason for your crash.
EDIT: But mov  @stOF.lpstrDefExt, "txt" is another hot candidate. Try
mov  @stOF.lpstrDefExt, chr$("txt")

ragdog