My BASE minimised application Window reappears unannounced during a user's session

I have a BASE application that addresses a remote PostGresSQL database. A macro is executed in the On Open Document area that makes invisible and minimises the application window of Libreoffice Base on startup (in Windows 11), so that the user only sees a custom Dialog and then a screen that controls input/search operations. When the user closes the form, the application is shut down. I have a function in place that addresses the remote server every 30 seconds or so to prevent the connection from timing out. All my driver connections are set at 500 seconds timeout.

So far so good. However, after around 7 minutes the application window reappears. There is no code in the application that asks to make the application window visible, and I’m puzzled as to how and why this is happening. Has anyone else come across this behaviour and found a solution?

Best wishes,

CB

Does your application run any Base reports? If not, I would extract all forms to stand-alone Writer documents and keep the Base window closed forever.

Hello again Villeroy!

Thanks again for taking an interest in my stuff. As I think I explained in an earlier forum submission (114336) I need to have established the preferred language and access level of the user - and indeed now the dataset they are able to address - before I can load the form they will use; this is established through a call to the database before the call to load the form.

So it would be much easier for me to understand why the application window kicks back in and becomes visible - and resists becoming invisible again! - so that I can suppress the event. Have you or anyone in the community come across this behaviour? Have you or anyone found a cause or a solution?

Hello again
After further investigation, I have traced the culprit: the reappearance of the Application Window coincides with the Document AutoRecovery setting.
Wah!
If you find that this is happening to your application, go to:
LibreOffice / Options / Load/Save / General / Save
and disable the checkbox:
Save Autorecovery information every XX minutes.
If you are distributing your application, you may need to ensure this setting is correct on the host machine when your application starts by using a macro, so I will see if I can amend this answer to include a subroutine below.

Note that changing this setting may effect the operation of Calc and Writer also.

Best Wishes,

CB
----===

Sub DisableAutoRecovery()

Dim oConfig As Object
Dim oConfigUpdate as Object 
Dim aProp(1) As New com.sun.star.beans.PropertyValue

oConfig = createUnoService("com.sun.star.configuration.ConfigurationProvider")

aProp(0).Name = "nodepath"
aProp(0).Value = "/org.openoffice.Office.Common/Save/Document"

oConfigUpdate = oConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aProp())

' Set the boolean value for AutoRecovery Enabled to false
oConfigUpdate.setPropertyValue("AutoSave", False)

' Commit the changes
oConfigUpdate.commitChanges()

MsgBox "AutoRecovery has been disabled.", 0, "Settings Changed"

End Sub


(but note mikekaganski’s comments below…)

You would likely best use a dedicated user profile for such a task, where you modify such application-wide important settings. Note that there is no way to disable it only temporarily reliably: nothing prevents a crash, in which no belts can ensure that the modified setting restores its initial value.