Loop in Win9x (solved)

Just starting out? Need help? Post your questions and find answers here.
PureBaser
User
User
Posts: 33
Joined: Mon Apr 10, 2006 8:47 pm
Location: Berlin, Germany
Contact:

Loop in Win9x (solved)

Post by PureBaser »

Code: Select all

OpenWindow(0,0,0,200,200,"Loop Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
CreateGadgetList(WindowID(0))
ButtonGadget(0,0,80,25,20,"Ok")
CheckBoxGadget(1,0,180,60,20,"Loop")
SetActiveWindow(0)
Repeat
Ereignis = WaitWindowEvent()
Select Ereignis
Case #PB_Event_Gadget
If EventGadget() = 0
 HideWindow(0,1) 
  If GetGadgetState(1) = 1
    Repeat
      MessageRequester("blah","blubberlub")
    Until GetAsyncKeyState_(#VK_SHIFT)
  Else
    MessageRequester("blah","blubberlub") 
  EndIf 
  HideWindow(0,0)
EndIf
EndSelect
Until Ereignis = #PB_Event_CloseWindow
CloseWindow(0)
End
The loop in Win9x System does function spontaenous (sometimes its loop, sometimes not)! In WinXP is always ok. "$8000" is not helpful...
Last edited by PureBaser on Thu May 18, 2006 12:23 pm, edited 1 time in total.
PB 4 | WinXP_SP2
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

does this help :

Code: Select all

GetAsyncKeyState_(#VK_SHIFT) & $8000
If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. However, you should not rely on this last behavior
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Use GetKeyState_() instead of GetAsyncKeyState_()
PureBaser
User
User
Posts: 33
Joined: Mon Apr 10, 2006 8:47 pm
Location: Berlin, Germany
Contact:

Post by PureBaser »

I bet, that I tried the & $8000 and that didn't help a few time ago... But that was with PB 3.94 - so I had to try retry - and it's perfect :D The Loop is correct!
PB 4 | WinXP_SP2
Post Reply