flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Yardman 19 Aug 2007, 14:47
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:49; edited 1 time in total |
|||
![]() |
|
ManOfSteel 20 Aug 2007, 05:59
Maybe it's because ofn.lpstrFile (a global value) points to lpFileName (a local array)?
I tried to use lstrcpy to copy ofn.lpstrFile to an external buffer and it worked. The only explanation is that local memory is freed when returning from a procedure. I would appreciate some confirmations and clarifications on this one from you guys. Code: .data szBuffer db MAX_PATH dup (?) ofn OPENFILENAME lpFilter db '*.txt',0,'*.txt',0,0 lpTitle db 'Save',0 .code start: call savedlg invoke MessageBox,0,szBuffer,'Filename',0 invoke ExitProcess,0 proc savedlg local lpFileName[MAX_PATH]:BYTE mov [ofn.lStructSize],sizeof.OPENFILENAME mov [ofn.lpstrFilter],lpFilter mov [ofn.lpstrDefExt],lpFilter lea eax,[lpFileName] mov [ofn.lpstrFile],eax mov [ofn.nMaxFile],MAX_PATH mov [ofn.lpstrTitle],lpTitle mov [ofn.Flags],OFN_EXPLORER or OFN_LONGNAMES or OFN_OVERWRITEPROMPT invoke GetSaveFileName,ofn test eax,eax jne @f invoke MessageBox,0,'Error','Error',0 @@: invoke lstrcpy,szBuffer,[ofn.lpstrFile] ret endp |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.