windows & gadgets without Repeat : Until

Just starting out? Need help? Post your questions and find answers here.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: windows & gadgets without Repeat : Until

Post by Trond »

It halts because you get stuck in the loop instead of returning from the procedure. If you start the window in a thread, you can return from the procedure and the program won't halt.

Code: Select all

Procedure TestGadgetThread(hwnd.i)

OpenWindow(2500, 0, 0, 0, 0, "test", #PB_Window_Invisible) ;otherwise dll is buggy

UseGadgetList(hwnd) ;to create on another window

WebGadget(0,5,5,500,500,"www.google.com") ;a gadget

Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow 
      Quit = 1
    EndIf

  Until Quit = 1


EndProcedure


ProcedureDLL TestGadget(hwnd.s)
  CreateThread(@TestGadgetThread(), Val("$" + hwnd))
  ProcedureReturn 1
EndProcedure
cybergeek
User
User
Posts: 33
Joined: Sat Jul 03, 2010 11:11 am

Re: windows & gadgets without Repeat : Until

Post by cybergeek »

it works but crashes application :|
PUREBASIC is AWSUM
Post Reply