I am using Olly to debug my code. During the writing of a data file, I check to see if the file already exists. If it does, a dialog asks the user if it is alright to overrite the file.
The file_already_ exists error is the switch for the dialog. However the file_already_exists error stays up on the Olly interface, even though furthur invokes are sucessfull.
Is there any way to clear the error once I have delt with it. It makes debugging the code after it, needlessly complicated.
I have never had such problems with Olly, but you can try one of the following:
invoke SetLastError, 0
debugging = 1
ife debugging
invoke ShowWarning
endif
Didn't seem to do the trick, let me check my code again. Thanks
> the file_already_exists error stays up on the Olly interface
In case you mean "Olly keeps the LastErr message in the middle of its upper right window": Don't blame Olly. Clear the message by using SetLastError, 0 after the invoke that triggers the error.
Some functions clear the last-error code value on success, and some do not.
test to see if the file exists before the write
you can hook the save file dialog and add a message box
forgot to mention...
i use the same code to test if the file exists as i do to get the file size (the other thread) :U
also - you can use SetLastError to clear the error code
oops - Jochen told you that, already :P
here is a save file dialog
it hooks the Save File dialog to test for overwrite
it also hooks the message box to alter the button text
looking at that code - it could use a slight improvement
if the filename exists as a folder, it could show a message box
i may play with it later today :P
Thanks
well - if the proposed file name exists as a folder, it opens the folder
guess that isn't really a problem :P