Re: File already exists. How?
Posted: Fri Mar 11, 2016 3:38 pm
An animated image showing what the topic creator wants exactly:

With the "SaveFileRequester()" of PB that does not work, unfortunately.
It is possible with the WinAPI:
- GetOpenFileName (https://msdn.microsoft.com/en-us/librar ... 85%29.aspx)
- OPENFILENAME (https://msdn.microsoft.com/en-us/librar ... 85%29.aspx)
http://www.purebasic.fr/english/viewtop ... 12&t=13682
(This code does not work with unicode.)
With the above code it works:

With the "SaveFileRequester()" of PB that does not work, unfortunately.
It is possible with the WinAPI:
- GetOpenFileName (https://msdn.microsoft.com/en-us/librar ... 85%29.aspx)
- OPENFILENAME (https://msdn.microsoft.com/en-us/librar ... 85%29.aspx)
Here is an example of how it works with the WinAPI:Flags:
[...]
OFN_OVERWRITEPROMPT
0x00000002
Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
http://www.purebasic.fr/english/viewtop ... 12&t=13682
(This code does not work with unicode.)
With the above code it works:
Code: Select all
file$ = GetSaveFileName(0, "", "", "", 0, "", "", #Null, #Null, #Null, #OFN_OVERWRITEPROMPT)
If file$
Debug file$
Else
Debug "Requester was canceled"
EndIf