OO-Snippets: How to Terminate the OOo process even if the QS is running

Commons

KeywordsQuickstarter, Close, Windows, API Windows
LanguageOOBasic
ApplicationOffice
AuthorsDidier Dorange-Pattoret (initial)
Supported Versions2.0.x  
Supported OSWin32  
QuestionIs there another way to terminate the OOo process even if the QS is running beside Office.HowToCloseTheQuickstarterUnderWindows2.snip
Answer

Code-Snippet-Listing (snippet-source)

Declare Function GetActiveWindow Lib "user32" () As Long
Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

Sub Essai
   rem getting the active window's handle.
   hWnd = GetActiveWindow()
   rem closing all active windows
   On error resume Next
       myEnum = StarDesktop.Components.CreateEnumeration
       Do while myEnum.HasmoreElements
           oDoc = myEnum.NextElement
           If HasUnoInterfaces(oDoc, "com.sun.star.util.XCloseable") Then
           oDoc.close(true)
           Else
           oDoc.dispose()
           End If
       Loop
       On error goto 0
   rem closing the quickstarter
   ExitProcess(hWnd)
End Sub 

Changelog

DateUserModification

and