Hi,
I am trying to cancel some actions (ex. File->Save, File->SaveAs, File->print, File->close).
I can able to block other commands in above except File->Save. While blocking save action, the modifications are getting saved.
After MS_DGNAUTOSAVE set to 0, modifications not saved. How to block autosave action through programmatically.
InputFilterReturnValue monitorFunction(Inputq_element* queueElementP) { if (queueElementP != NULL) { if (queueElementP->u.cmd.command == File_Save) { return INPUT_REJECT; } } return INPUT_ACCEPT; }
In above code File_Save is commandid of File->Save action.
Regards,
Rajesh Varatharajan
Hi Rajesh,
it should work in my opinion. Did you check that File_Save is the command you are searching for (e.g. monitoring what is sent when you use File > Save function)?
Another option can be to use Transaction Monitor (ITxnManager), but I am not sure whether it allows also to filter/block the transactions.
Also, but I have never tried it, DgnFile has SetAbandoChangesFlag() method. By documentation, it should protect the file from any saving. But it requires to monitor the file opening (using Session Manager?) and to set it immediately.
And please, respect the best practices! Always, no exception!! When these deep integration issues are discussed, to specify product + version can be crucial (e.g. when Bentley already knows a bug was reported for the version). Why you do not use simple standardized subject format [<product> <version> <API>] Question as described in the best practices? It can be easily copied / pasted from previous questions in a second.
[<product> <version> <API>] Question
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
Thanks for your reply. Sorry for not mentioning version. Microstation Update 10.15.2.11 and SDK version 10.15.00.76.
Jan Šlegr said:it should work in my opinion. Did you check that File_Save is the command you are searching for (e.g. monitoring what is sent when you use File > Save function)?
yes that is the save command and also looking for to block auto-save too.
Jan Šlegr said:Also, but I have never tried it, DgnFile has SetAbandoChangesFlag() method. By documentation, it should protect the file from any saving. But it requires to monitor the file opening (using Session Manager?) and to set it immediately.
Thanks Jan. It's working for me. When I call SetAbandonChangesFlag() for active file, no modifications saved to the file in disk.
Rajesh Varatharajan.
Rajesh Varatharajan said:In above code File_Save is commandid of File->Save action.
Where did you find File_Save? That is, which header file contains that definition?
File_Save
MicroStation command macros look like CMD_XXX. One place to look for command macros is ..\SDK\include\Mstn\cmdlist.r.h. For example, CMD_SAVE_DESIGN.
CMD_XXX
..\SDK\include\Mstn\cmdlist.r.h
CMD_SAVE_DESIGN
Regards, Jon Summers LA Solutions
Hi Jon,
Jon Summers said:Where did you find File_Save?
Its our own define value, got from queueElementP->u.cmd.command in InputFilterReturnValue monitorFunction(Inputq_element* queueElementP) .
Thanks Jon. We will check and use cmdlist.r.h.