Event add #WM_ENDSESSION for save() etc.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Event add #WM_ENDSESSION for save() etc.

Post by gurj »

Event add #WM_ENDSESSION for save() etc.
my pb for chinese:
http://ataorj.ys168.com
User avatar
gurj
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: Event add #WM_ENDSESSION for save() etc.

Post by gurj »

If system closing And If our program Not got Case #WM_ENDSESSION
our program will killed tough
so,from winapi_library of RSBasic:
(see code)
but I Not hope my code in this Procedure, so hope pb_Event has own 'Case #WM_ENDSESSION'
thanks!

Code: Select all

EnableExplicit

Define EventID

Procedure WinCallback(hWnd, uMsg, wParam, lParam) 
 If uMsg = #WM_ENDSESSION 
  ;(my code)
    ;Windows wird heruntergefahren.
    ;Hier k鰊nen noch wichtige Einstellungen gespeichert werden.
  EndIf 

  ProcedureReturn #PB_ProcessPureBasicEvents 
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  SetWindowCallback(@WinCallback())
  
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_CloseWindow
      End
    EndIf
  ForEver
EndIf
my pb for chinese:
http://ataorj.ys168.com
Post Reply