B4J Question [ WM_CLOSE ] Signal by Steam Client

Waldemar Lima

Well-Known Member
Licensed User
hello everyone !
i am developing Game to store : steampowered.com , using B4J

and recently I was having problems, as there is a button where I can start and close the application from the Steam client itself, as in the image below:

but I was having problems with this button because as soon as I clicked it, the B4J application would close all windows, however, the application was running in the background because it was stuck in an xui.AsyncMessageBox ( for more details, there is another topic I had created: TOPIC ) , so I sent a support ticket to the Steam Team , and answered the following >

Play Button : Screenshot
Stop Button : Screenshot

Hi there,

The behavior of the Steam 'Stop' button is different depending on the platform (Windows, MacOS, or Linux). On Windows, Steam will send a WM_CLOSE message to the app's Windows. Elsewhere, a kill signal is sent to the game's process.

From your depot, it looks like your game is a Java-based game. It's possible that your game isn't properly handling the WM_CLOSE event. You may need to import the appropriate Windows DLL to interact with the Windows message pump and properly handle that message.

I would recommend posting your question on the Steamworks Development community forum. It is very likely that a developer there has encountered (and potentially resolved) the same issue that you have.

Best,
Steam Support Team

I would like to know if there is any way to deal with this: WM_CLOSE so that I can differentiate if it was a closing signal coming from the "Steam Client", or if it is just a click on the close button in the Window triggered by the user.
 

Waldemar Lima

Well-Known Member
Licensed User
a better solution would be for me to be able to identify if it was the user who clicked on close, or if it is a WM_CLOSE signal coming from an external application...
it is possible ?
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
If the problem is specific with AsyncMessageBox then switch to B4XDialog. It is a regular panel so will not have any other side effect.

I didn't express myself right ... the problem is not in the " xui.AsyncMessageBox ", it is in the Wait For necessary to wait for the user's response ...

I used the code below to test, and got the same result as "xui.AsyncMessageBox", when I close the application through the Steam Client, all Forms are closed, but the application is still running in the background and only closes if I close it manually...

B4X:
Private Sub B4XPage_CloseRequest As ResumableSub

    Log("Teste CloseRequest")
  
    Button2.Visible = True

    Dim rs As Object = dialog.Show("aaa", "Ok", "Not Ok", "")
    AnimateDialog(dialog, "right")
    Log("chamou o dialog")
    Wait For (rs) Complete (Result As Int) ' ####  Lock Here and run Forever until kill application manually... ####
    Log("infinite loop :C")
    If Result = xui.DialogResponse_Positive Then
        B4XPages.ShowPageAndRemovePreviousPages("mainpage")
        Button2.Visible = False
        Return True
    End If
  
    ExitApplication
    Return True
    
End Sub
 
Upvote 0

Daestrum

Well-Known Member
Licensed User
Longtime User
Does the dialogue show when the steam client closes the app or only when you close it?
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
Does the dialogue show when the steam client closes the app or only when you close it?

Necessarily the dialog is displayed when the user clicks the window's close button, and automatically the event: B4XPages_CloseRequest is triggered, when the steam sends the WM_Close signal, the event: B4XPages_CloseRequest is also activated, I would need a way to filter if it was the user who clicked close or if steam sent the wm_close signal
 
Upvote 0
Top