Receive callback messages in main loop
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Receive callback messages in main loop
I wish a future release could let us receive event messages like #WM_QUERYENDSESSION in our main loop instead of having to code a callback to receive them. Thank you.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Receive callback messages in main loop
How were you planning to do this from the main loop, just curious?MSDN for WM_QUERYENDSESSION wrote:Return Values
If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.

Much of the more advanced functionality of the Windows OS is accomplished in the callback model; the Purebasic main loop can only insulate the coder from the simpler elements and this is why Fred implemented the SetWindowCallback function. Coders of all levels can both achieve rapid success and conquer more in-depth challenges within the one development tool. It's one of the reasons we love it so.
BERESHEIT
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Receive callback messages in main loop
I was just hoping something like this could be done:netmaestro wrote:How were you planning to do this from the main loop, just curious?
Code: Select all
If OpenWindow(0,100,150,450,200,"Windows shutdown detect",#PB_Window_SystemMenu)
Repeat
eventID=WaitWindowEvent()
If eventID = #WM_QUERYENDSESSION
;Do your stuff here
MessageRequester("","Oops! Windows are shuting down!!")
EndIf
Until eventID=#PB_Event_CloseWindow
EndIf
I guess my request, then, is: remove that insulation?netmaestro wrote:the Purebasic main loop can only insulate the coder from the simpler elements

Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Receive callback messages in main loop
Well, that's five wasted minutes I'm not getting back.
BERESHEIT
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Receive callback messages in main loop
What does that mean?
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!