Code: Alles auswählen
Import "window.lib"
PB_Window_ProcessEvent(a,b,c,d)
PB_Window_NonBlockResizeInit()
PB_Window_Icon
PB_Window_Cursor
PB_Window_Objects
PB_Object_GetOrAllocateID(*Object,id)
EndImport
Procedure NewOpenWindow(id,x,y,cx,cy,title.s,flags=#WS_VISIBLE|#WS_OVERLAPPEDWINDOW,parent=0)
Protected wnd.wndclass
Protected classname.s = "MY_OWN_CLASS"
Protected *WinObj.integer
Protected hWnd.i
Protected rc.rect
With wnd
\style = #CS_HREDRAW|#CS_VREDRAW
\lpfnWndProc = @PB_Window_ProcessEvent()
\hInstance = GetModuleHandle_(0)
\hIcon = PB_Window_Icon
\hCursor = PB_Window_Cursor
\lpszClassName = @classname
\hbrBackground = #COLOR_WINDOW
\cbWndExtra = 0
\cbClsExtra = 0
EndWith
If RegisterClass_(wnd)
SetRect_(rc,0,0,cx,cy)
AdjustWindowRectEx_(rc,flags,0,#WS_EX_WINDOWEDGE)
If x = #PB_Ignore Or y = #PB_Ignore
x = #CW_USEDEFAULT
y = #CW_USEDEFAULT
EndIf
PB_Window_NonBlockResizeInit()
hWnd = CreateWindowEx_(#WS_EX_WINDOWEDGE,classname,title,flags,x,y,rc\right-rc\left,rc\bottom-rc\top,parent,0,GetModuleHandle_(0),0)
If hWnd
*WinObj = PB_Object_GetOrAllocateID(PB_Window_Objects,id)
*WinObj\i = hWnd
If id = #PB_Any
SetProp_(hWnd,"Pb_WindowID",*WinObj+1)
Else
SetProp_(hWnd,"Pb_WindowID",id+1)
EndIf
UseGadgetList(hWnd)
Else
UnregisterClass_(GetModuleHandle_(0),classname)
EndIf
EndIf
If id = #PB_Any
id = *WinObj
Else
id = hWnd
EndIf
ProcedureReturn id
EndProcedure
Procedure Main()
NewOpenWindow(0,#PB_Ignore,#PB_Ignore,200,200,"333")
ResizeWindow(0, #PB_Ignore, #PB_Ignore, 500, 500)
ButtonGadget(0, 10, 10, 100, 30, "sdfsfd")
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndProcedure:Main()