Code: Select all
Global winID
Import "window.lib"
CompilerIf #PB_Compiler_Version < 550 And #PB_Compiler_Unicode
_PB_Window_ProcessEvent(a,b,c,d) As "_PB_Window_ProcessEvent_UNICODE@16"
CompilerElse
_PB_Window_ProcessEvent(a,b,c,d) As "_PB_Window_ProcessEvent@16"
CompilerEndIf
PB_Window_Icon
PB_Window_Cursor
PB_Window_Objects
PB_Object_GetOrAllocateID(*Object,id)
EndImport
Procedure _OpenWindow(id,x,y,cx,cy,title.s,flags=#WS_VISIBLE |#WS_OVERLAPPEDWINDOW,parent=0)
Protected wnd.wndclass
Protected classname.s = "Window_CLASS"
Protected *WinObj.integer
Protected hWnd.i
Protected rc.rect
With wnd
\style = #CS_HREDRAW | #CS_VREDRAW | #CS_NOCLOSE ;| #CS_DROPSHADOW
\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
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
Else
UnregisterClass_(GetModuleHandle_(0),classname)
EndIf
EndIf
If id = #PB_Any
id = *WinObj
Else
id = hWnd
EndIf
winID = id
ProcedureReturn winID
EndProcedure
_OpenWindow(0,#PB_Ignore,#PB_Ignore,600,400,"Windows No Close")
SetWindowLongPtr_(winID,#GWL_STYLE ,GetWindowLongPtr_(winID,#GWL_STYLE ) &~ #WS_MAXIMIZEBOX)
HideWindow(0,0,#PB_Window_ScreenCentered)
CatchImage(0, ?Icon)
SendMessage_(winID,#WM_SETICON,0,ImageID(0))
StickyWindow(0,1)
AddKeyboardShortcut(0,#PB_Shortcut_Escape ,10)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Menu
Select EventMenu()
Case 10
End
EndSelect
EndSelect
ForEver
DataSection
Icon:
Data.b 0, 0, 1, 0, 1, 0, 32, 32, 4, 0, 0, 0, 0, 0, 232, 2, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 1, 0, 4, 0, 0, 0
Data.b 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 128, 0, 0, 0, 128, 128, 0, 128, 0
Data.b 0, 0, 128, 0, 128, 0, 128, 128, 0, 0, 128, 128, 128, 0, 192, 192, 192, 0, 0, 0, 255, 0, 0, 255, 0, 0, 0, 255, 255, 0, 255, 0, 0, 0, 255, 0, 255, 0, 255, 255
Data.b 0, 0, 255, 255, 255, 0, 0, 9, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 144, 0, 0, 159, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 249, 0, 9, 255
Data.b 255, 255, 255, 135, 119, 255, 255, 135, 120, 255, 255, 255, 255, 144, 159, 255, 255, 255, 247, 7, 135, 255, 255, 72, 112, 8, 255, 255, 255, 249, 159, 255, 255, 255, 119, 136, 136, 127, 247, 120
Data.b 136, 112, 255, 255, 255, 249, 159, 255, 255, 255, 120, 136, 136, 112, 0, 136, 136, 135, 255, 255, 255, 249, 159, 255, 255, 255, 135, 136, 136, 136, 136, 136, 136, 136, 255, 255, 255, 249, 159, 255
Data.b 255, 255, 128, 136, 136, 136, 136, 136, 136, 120, 255, 255, 255, 249, 159, 255, 119, 136, 7, 136, 136, 136, 136, 136, 136, 119, 248, 119, 255, 249, 159, 240, 120, 112, 120, 136, 136, 136, 136, 136
Data.b 136, 135, 7, 119, 15, 249, 159, 128, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 8, 249, 159, 119, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 119, 249, 159, 120
Data.b 136, 136, 136, 136, 136, 135, 120, 136, 136, 136, 136, 136, 128, 249, 159, 119, 136, 136, 136, 136, 135, 15, 240, 120, 136, 136, 136, 136, 112, 249, 159, 248, 7, 136, 136, 136, 112, 255, 255, 7
Data.b 136, 136, 136, 112, 143, 249, 159, 255, 240, 136, 136, 136, 0, 255, 255, 0, 136, 136, 136, 15, 255, 249, 159, 255, 240, 136, 136, 136, 0, 255, 255, 0, 136, 136, 136, 15, 255, 249, 159, 255
Data.b 116, 136, 136, 136, 112, 15, 255, 7, 136, 136, 136, 7, 255, 249, 159, 128, 120, 136, 136, 136, 128, 0, 0, 8, 136, 136, 136, 135, 8, 249, 159, 8, 136, 136, 255, 248, 136, 112, 7, 136
Data.b 136, 136, 136, 136, 128, 249, 159, 120, 143, 255, 255, 255, 255, 136, 136, 143, 255, 255, 255, 136, 128, 249, 159, 132, 136, 143, 255, 255, 255, 255, 255, 255, 255, 255, 136, 136, 120, 249, 159, 240
Data.b 136, 135, 143, 255, 255, 255, 255, 255, 255, 248, 120, 136, 15, 249, 159, 248, 119, 135, 8, 255, 255, 255, 255, 255, 255, 128, 120, 119, 127, 249, 159, 255, 255, 255, 112, 255, 255, 255, 255, 255
Data.b 255, 119, 255, 248, 255, 249, 159, 255, 255, 255, 135, 255, 255, 255, 255, 255, 255, 120, 255, 255, 136, 249, 159, 255, 255, 255, 120, 255, 255, 119, 119, 255, 255, 135, 255, 255, 255, 249, 159, 255
Data.b 255, 255, 120, 255, 248, 120, 135, 143, 255, 128, 255, 255, 255, 249, 159, 255, 255, 255, 128, 120, 247, 143, 255, 127, 135, 8, 255, 255, 255, 249, 9, 255, 255, 255, 255, 119, 112, 255, 255, 119
Data.b 119, 255, 255, 255, 255, 144, 0, 159, 255, 255, 255, 255, 143, 255, 255, 248, 255, 255, 255, 255, 249, 0, 0, 9, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 144, 0, 224, 0
Data.b 0, 7, 192, 0, 0, 3, 128, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data.b 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Data.b 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 1, 192, 0
Data.b 0, 3, 224, 0, 0, 7
Iconend:
EndDataSection