03-23-2023, 09:00 PM (This post was last modified: 03-23-2023, 09:02 PM by aurel.)
OK i will
so like this :
Declare customType Library
Function CreateWindowEx%& (ByVal dwExStyle~&, Byval lpClassName As _Offset, Byval lpWindowName As _Offset, Byval dwStyle~&, Byval x As Long, Byval y As Long, Byval nWidth As Long, Byval nHeight As Long, Byval hWndParent As Offset, Byval hMenu As _Offset, Byval hInstance As _Offset, Byval lpParam As _Offset) End Declare
CONST SW_SHOWDEFAULT = &HA
CONST SW_SHOW = 5
'------------------------------------------------
TYPE POINT
x AS LONG
y AS LONG
END TYPE
' for 64 bit
TYPE MSG
hwnd AS _OFFSET
message AS _OFFSET
wParam AS _UNSIGNED _OFFSET 'unsigned pointer sized integer
lParam AS _OFFSET 'pointer sized integer
time AS _INTEGER64
pt AS POINT
END TYPE
'should be before Library Declarations
TYPE WNDCLASSEX
cbSize As _INTEGER64
Style As LONG
lpfnwndproc As _OFFSET
cbClsextra As LONG
cbWndExtra As LONG
hInstance As _OFFSET
hIcon As _OFFSET
hCursor As _OFFSET
hbrBackground As _OFFSET
lpszMenuName As _OFFSET
lpszClassName As _OFFSET
hIconSm As _OFFSET
END TYPE
DECLARE LIBRARY "win"
FUNCTION GetWindowProc%& ()
END DECLARE
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION SendMessageA%& (BYVAL hWnd%&, BYVAL Msg~&, BYVAL wParam~%&, BYVAL lParam%&)
FUNCTION DefWindowProcA%& (BYVAL hWnd%&, BYVAL Msg~&, BYVAL wParam~%&, BYVAL lParam%&)
SUB PostQuitMessage (BYVAL nExitCode&)
FUNCTION LoadCursorW%& (BYVAL hInstance%&, BYVAL lpCursorName%&)
FUNCTION LoadIcon%& (ByVal hinstance As Long, ByVal lpIconName As long)
'FUNCTION RegisterClassA~% (BYVAL lpWndClass%&)
'FUNCTION RegisterClassEx~% (byval pcWndClassEx%&)
'FUNCTION CreateWindowEx%& (ByVal dwExStyle As Long, byval lpClassName%&, byval lpWindowName%&, Byval dwStyle As Long, Byval x As Long, Byval y As Long, Byval nWidth As Long, Byval nHeight As Long, Byval hWndParent As Long, Byval hMenu As Long, Byval hInstance As _OFFSET, Byval lpParam As Long )
'FUNCTION CreateWindowEx%& (BYVAL dwExStyle~&, BYVAL lpClassName%&, BYVAL lpWindowName%&, BYVAL dwStyle~&, BYVAL x&, BYVAL y&, BYVAL nWidth&, BYVAL nHeight&, BYVAL hWndParent%&, BYVAL hMenu%&, BYVAL hInstance%&, BYVAL lpParam%&)
FUNCTION ShowWindow& (BYVAL hWnd%&, BYVAL nCmdShow&)
FUNCTION UpdateWindow& (BYVAL hWnd%&)
FUNCTION GetMessageA& (BYVAL lpMsg%&, BYVAL hWnd%&, BYVAL wMsgFilterMin~&, BYVAL wMsgFilterMax~&)
FUNCTION TranslateMessage& (BYVAL lpMsg%&)
FUNCTION DispatchMessageA%& (BYVAL lpmsg%&)
END DECLARE
Declare customType Library
Function CreateWindowEx%& (ByVal dwExStyle~&, Byval lpClassName As _Offset, Byval lpWindowName As _Offset, Byval dwStyle~&, Byval x As Long, Byval y As Long, Byval nWidth As Long, Byval nHeight As Long, Byval hWndParent As _Offset, Byval hMenu As _Offset, Byval hInstance As _Offset, Byval lpParam As _Offset)
End Declare
Declare customType Library
FUNCTION RegisterClassEx~% (byval pcWndClassEx%&)
End Declare
DECLARE DYNAMIC LIBRARY "kernel32"
FUNCTION GetModuleHandleA%& (BYVAL lpModuleName%&)
'FUNCTION GetLastError~& ()
END DECLARE
'TYPE WNDCLASSA
' style AS _INTEGER64
' lpfnWndProc AS _OFFSET
' cbClsExtra AS LONG
'cbWndExtra AS LONG
'hInstance AS _OFFSET
'hIcon AS _OFFSET
'hCursor AS _OFFSET
'hbrBackground AS _OFFSET
'lpszMenuName AS _OFFSET
'lpszClassName AS _OFFSET
'END TYPE
DIM SHARED hi AS _OFFSET
DIM SHARED bRet AS LONG
DIM SHARED hw AS _offset
DIM SHARED hwb0 AS _OFFSET
DIM SHARED hwb1 AS _OFFSET
DIM SHARED hwcb AS _OFFSET
DIM SHARED hwgb AS _OFFSET
DIM SHARED hwr0 AS _OFFSET
DIM SHARED hwr1 AS _OFFSET
DIM SHARED hwe AS _OFFSET
DIM SHARED wcx AS WNDCLASSEX
DIM SHARED wmsg AS MSG
DIM SHARED reg AS _UNSIGNED INTEGER
DIM SHARED buf AS STRING * 4096
DIM SHARED sw AS LONG
DIM SHARED uw AS _OFFSET
DIM SHARED t0 AS STRING
DIM SHARED t1 AS STRING
DIM SHARED ClassName AS STRING
ClassName = "QB64pe"
'DIM SHARED crlf AS STRING * 2
'crlf = MKI$(&HA0D)
hi = GetModuleHandleA(0)
wcx.cbsize = 76
wcx.style = CS_DBLCLKS OR CS_OWNDC
wcx.lpfnWndProc = GetWindowProc
wcx.cbClsExtra = 0
wcx.cbWndExtra = 0
wcx.hInstance = hi
wcx.hIcon = 0
wcx.hCursor = LoadCursorW(0, IDC_ARROW)
wcx.hbrBackground = COLOR_WINDOW + 1
wcx.lpszMenuName = 0
wcx.lpszClassName = _OFFSET(ClassName)
wcx.hIconSm = LoadIcon(0,IDI_APPLICATION )
'-----------------------------------------------------------
reg = RegisterClassEx(_OFFSET(wcx)): IF 0 = reg THEN SYSTEM
'-------------------------------------------------------------
'create main window
t1 = "QB64pe_GUI_App2"
hw = CreateWindowEx(0, _OFFSET(ClassName), _OFFSET(t1), WS_OVERLAPPEDWINDOW , 200, 200, 800, 600, 0, 0, hi, 0)
IF 0 = hw THEN SYSTEM
03-24-2023, 06:33 AM (This post was last modified: 03-24-2023, 06:38 AM by aurel.)
<<< Direct all further requests for assistance to @vince and @mnrvovrfc<<<
[url=https://staging.qb64phoenix.com/member.php?action=profile&uid=192][/url]
Hi Zak...did i say something wrong ..i don't get it ?
I search trough all files you add to attachment and there is no anything about declaration
especially not about WNDCLASSEX ..also there is nothing on Wiki site or in REFERENCE site too.
Maybe i should try with LoadLibrary and load this dll.s if would work
It's 3AM where I live and making this post. Maybe Balderdash isn't energetic, isn't used to being bugged by someone else.
I'm not used to being "referred" to. Love it when forum code messes up revealing my user number...
You have to be a bit patient now. What you're trying to do is difficult and the process might take a week or longer. We're only at this stubborn function with ten parameters or so, which has to create buttons and perhaps other controls not as obvious to someone else, besides what's obviously in the name of "CreateWindowEx".
In fact is not ...another thing is QB64 in general is not used very much for GUI winapi programming
and ther is included old WNDCLASSA structure
soe thinngs are screwed when i first time see this code , like LoadCursorW ..why not LoadCursorA
maybe is a way to use different headers much modern
another bad thing is that message loop is created with DO/LOOP
and in C/C++ most used way is with WHILE/WEND
and without strange message handlers like :
which is what i expected ...so it is already there then i need to look into QB64 source and check what is there declared and how , and i think that only old structure is used
which is this one : typedef struct tagWNDCLASSA { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } WNDCLASSA,*PWNDCLASSA,*NPWNDCLASSA,*LPWNDCLASSA;