Page 1 of 1

dlls

Posted: Fri May 21, 2004 5:14 pm
by okman
guys i just made a dll to use with gamemaker. (gamemaker.nl) my objective was to prepare a dll to add an extra window to gm form(using the openwindow command in pb).

heres my code

Code: Select all

ProcedureDLL MyWin(Message$)

 OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, Message$)
Repeat 
WaitWindowEvent()
    
     If #PB_Event_CloseWindow = 1 ; 
      Quit = 1
    
 EndIf 
 Until Quit = 1
    EndProcedure
it works fine. but if i press the close button on the new window obtained it doesnt close. plz help.

Posted: Fri May 21, 2004 5:28 pm
by Chris
Try that:

Code: Select all

ProcedureDLL MyWin(Message$) 
  
  OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, Message$) 
  Repeat 
    Select WaitWindowEvent() 
      Case #PB_Event_CloseWindow : Quit = 1 
    EndSelect
  Until Quit = 1
EndProcedure
or that

Code: Select all

ProcedureDLL MyWin(Message$) 
  
  OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, Message$) 
  Repeat 
    If WaitWindowEvent() = #PB_Event_CloseWindow
      Quit = 1
    EndIf 
  Until Quit = 1 
EndProcedure
or that:

Code: Select all

ProcedureDLL MyWin(Message$) 
  
  OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, Message$) 
  Repeat 
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndProcedure
The function WaitWindowEvent() must always return the value of #PB_Event_CloseWindow if you want to close the window.

Chris :)

still doesnt work

Posted: Thu May 27, 2004 5:06 am
by okman
still the window doesnt close when clicked on x. :(

Re: still doesnt work

Posted: Thu May 27, 2004 1:18 pm
by NoahPhense
okman wrote:still the window doesnt close when clicked on x. :(
This one works fine with 3.91 b1 ..

DLL

Code: Select all

ProcedureDLL MyWin(Message$) 
  
  OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, Message$) 
  Repeat 
  Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndProcedure
EXE

Code: Select all

If OpenLibrary(0, "test.dll")
  CallFunction(0, "MyWin", "testtesttest")
  CloseLibrary(0)
EndIf

End
You might experience a problem if you are not checking the Shared DLL option under Compiler Options...

- np

Posted: Fri Jun 04, 2004 8:44 pm
by neomancer
Im a little new, but it worked.

if your still having problems

use

destroywindow_(WindowID(0))

i dont know if it will leave memory leaks tho, i dunno how to look for those