dlls

Just starting out? Need help? Post your questions and find answers here.
okman
New User
New User
Posts: 5
Joined: Fri May 21, 2004 5:06 pm

dlls

Post 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.
Chris
User
User
Posts: 60
Joined: Wed Jun 11, 2003 4:54 pm
Location: Somewhere... But i can see you!

Post 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 :)
My english is bad !!!... It's normal, i'm french :lol:
My english is not really the English.
It's the FrogLish (Froggy's English) ;)
okman
New User
New User
Posts: 5
Joined: Fri May 21, 2004 5:06 pm

still doesnt work

Post by okman »

still the window doesnt close when clicked on x. :(
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: still doesnt work

Post 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
neomancer
User
User
Posts: 14
Joined: Fri Jun 04, 2004 10:25 am

Post 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
They can smash your cookie, but they cant take you fortune
Post Reply