Code: Alles auswählen
#define TESTCLASS 1000
#define IDC_BTN1 1001
TESTCLASS DIALOGEX 10,10,388,211
CAPTION "myDialog"
FONT 8,"MS Sans Serif",0,0,0
CLASS "TESTCLASS"
STYLE 0x10CF0000
BEGIN
CONTROL "IDC_BTN",IDC_BTN1,"Button",0x50010000,9,9,69,30
END
Code: Alles auswählen
#IDD_DLG1 = 1000
#IDC_BTN1 = 1001
Import "window.lib"
CompilerIf #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 NewOpenWindow(id,res_id)
Protected wnd.wndclass
Protected classname.s = "TESTCLASS"
Protected *WinObj.long
Protected hWnd.l
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_BTNFACE + 1
\cbWndExtra = #DLGWINDOWEXTRA
\cbClsExtra = 0
EndWith
If RegisterClass_(wnd)
hWnd = CreateDialogParam_(GetModuleHandle_(0),res_id,0,0,0)
If hWnd
*WinObj = PB_Object_GetOrAllocateID(PB_Window_Objects,id)
*WinObj\l = 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
ProcedureReturn id
EndProcedure
;##################################################################
;#
;#
;#
;##################################################################
NewOpenWindow(0,#IDD_DLG1)
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget
If EventGadget() = #IDC_BTN1
Debug "BUTTON CLICK"
EndIf
EndIf
Until event = #PB_Event_CloseWindow