[Implemented] #WM_USER - Private Messages in WindowEvent

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> dont forget to put your cursor miles away of the window

Ah, now I see! :D I was actually moving the mouse in all the tests, because
I thought you needed to ensure the window "worked" during the wait. When
I don't move the mouse (eg. if I just hit F5 to compile/run and do nothing else)
then yes, the MessageRequester NEVER pops up. :)

I'm glad you finally made me see the light! :lol:

I'd just do it like this (which doesn't need PostMessage or a callback):

Code: Select all

Global ThreadEnd.l

Procedure Thread()
  Delay(Random(4000)+1000)
  ThreadEnd = #True
EndProcedure

If OpenWindow(0, 300, 200, 480, 320, #PB_Window_SystemMenu, "test")
 
  If CreateThread(@Thread(), 0)
   
    Repeat
     
      Select WindowEvent()
        Case 0
          Delay(1) ; To not use 100% CPU.
        Case #PB_Event_CloseWindow
          End
      EndSelect
     
      If ThreadEnd = #True
        Break
      EndIf
     
    ForEver
   
    MessageRequester("test", "test")
   
  EndIf
 
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@PB
hehe yeah and now we can go drink some beers. :D

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Image

;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply