02-17-2021 03:40 PM
Hi,
I get the following message when I try to exit DIAdem. See in joined piece.
I know why I get it and I know how to make it go away. When I click on an area containing a graphic, an external script accessing DIAdem starts and that's why I can't stop DIAdem. If I select the area containing my sud, my external script stops and then I can exit DIAdem.
The only thing I need is a way to detect the message and display a custom message box that explains what to do.
I tried to play with all the properties of TOCommand but I can't find a way to detect that DIAdem was requested to close and couldn't close.
The property bInterfaceLocked seems promising but it's set to True each time any message or a dialog box menu appears in DIAdem so it's not sufficient for my need.
Thanks for your help.
02-23-2021 10:36 AM
Any suggestions?
Thanks.
02-24-2021 03:25 PM
Hi Alex,
It looks like you have quite a customized DIAdem interface there. If you can insert a custom icon and/or menu to exit the application, then you can have this code run when that icon/menu is selected:
On Error Resume Next
ProgramExit()
On Error Goto 0
MsgBox "Instructions for how to exit DIAdem"
The "ProgramExit()" command will programmatically cause DIAdem to close. The Error checking should protect you from the ToCommand exit error message.
Brad Turpin
Principal Technical Support Engineer
NI
02-24-2021 03:42 PM
Hi Brad,
Thanks for your answer. The close button on my sud is a good idea but it's not really useful since when my sud area is active, the external script that uses ToCommand is automatically stopped, so I can then press X in the corner to exit DIAdem without any trouble.
I run a script when I initiate DIAdem. Is there any command I could set that would inhibit the ToCommand exit error message and would let the user exit DIAdem even if they let a graphic area selected instead of the sud?
In last resort, is there an event that is triggered when the user try to exit DIAdem with the X in the corner? I could easily force DIAdem to stop whatever is going on with ToCommand.
Thank you again!
02-26-2021 10:12 AM
Hi Alex,
There is no way to change the behavior that an application being controlled through ActiveX can not shut down without first being released by the calling program.
There is no event that can be customized when the [X] button in the upper right hand corner is clicked to shut down DIAdem.
Would it help to suppress the error message entirely when the user tries to exit DIAdem (which doesn't work)? I know that what you want is to provide instructions, but I can't think of a way to accomplish that.
Sorry,
Brad Turpin
Principal Technical Support Engineer
NI
02-26-2021 10:16 AM
Hi Brad,
Editing the error message would be perfect but I know I'm asking a lot. I can live with it.
Thanks for your help anyways.