Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI app and winAPI calls
#6
I really don't get it what is problem with _OFFSET
or probably i am doing something wrong
here is code:

Code: (Select All)
'test 1 GUI win32 api in QB64pe v3.2.1 by Aurel

CONST IDC_ARROW = &H7F00
    CONST COLOR_WINDOW = 5
     
    CONST WS_OVERLAPPED = 0
    CONST WS_CHILD = &H40000000
    CONST WS_VISIBLE = &H10000000
    CONST WS_MAXIMIZE = &H01000000
    CONST WS_CAPTION = &H00C00000
    CONST WS_VSCROLL = &H00200000
    CONST WS_HSCROLL = &H00100000
    CONST WS_SYSMENU = &H00080000
    CONST WS_THICKFRAME = &H00040000
    CONST WS_TABSTOP = &H00010000
    CONST WS_MINIMIZEBOX = &H00020000
    CONST WS_MAXIMIZEBOX = &H00010000
    CONST WS_OVERLAPPEDWINDOW = WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX
     
    CONST CW_USEDEFAULT = &H80000000
     
    CONST BS_PUSHBUTTON = 0
    CONST BS_AUTOCHECKBOX = 3
    CONST BS_GROUPBOX = 7
    CONST BS_AUTORADIOBUTTON = 9
    CONST BS_TEXT = 0
     
    CONST BN_CLICKED = 0
     
    CONST BM_GETCHECK = &HF0
     
    CONST ES_LEFT = 0
    CONST ES_MULTILINE = 4
    CONST ES_AUTOVSCROLL = &H0040
    CONST ES_AUTOHSCROLL = &H0080
    CONST ES_WANTRETURN = &H1000
     
    CONST WM_DESTROY = 2
    CONST WM_GETTEXT = &H000D
    CONST WM_CLOSE = &H0010
    CONST WM_COMMAND = &H0111
     
    CONST SW_SHOWDEFAULT = &HA
    CONST SW_SHOW        = 5
     
    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 RegisterClassA~% (BYVAL lpWndClass%&)

FUNCTION CreateWindowEx%& (ByVal dwExStyle As Long, byval lpClassName As _OFFSET,byval  lpWindowName As _OFFSET, 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 Long, Byval lpParam As Long )

        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 DYNAMIC LIBRARY "kernel32"
        FUNCTION GetModuleHandleW%& (BYVAL lpModuleName%&)
        'FUNCTION GetLastError~& ()
    END DECLARE

   TYPE POINT
        x AS LONG
        y AS LONG
    END TYPE

' $IF 32BIT THEN
        TYPE MSG
            hwnd AS LONG
            message AS LONG
            wParam AS LONG 'unsigned pointer sized integer
            lParam AS _OFFSET 'pointer sized integer
            time AS LONG
            pt AS POINT
        END TYPE
     
        TYPE WNDCLASSA
            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
        END TYPE
   

    DIM SHARED hi AS _OFFSET
    DIM SHARED bRet AS LONG
    DIM SHARED hw AS LONG
    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 wc AS WNDCLASSA
    DIM SHARED wmsg AS MSG
    DIM SHARED at AS _UNSIGNED INTEGER
     
    DIM SHARED buf AS STRING * 4096
     
    'DIM SHARED discardb AS LONG
    'DIM SHARED discardp AS _OFFSET
    DIM SHARED t0 AS STRING
    DIM SHARED t1 AS STRING
     
    DIM SHARED ClassName AS STRING
    ClassName = "QB64pe" + CHR$(0)
    'DIM SHARED crlf AS STRING * 2
    'crlf = MKI$(&HA0D)
     
    hi = GetModuleHandleW(0)
     
    wc.style = 0
    wc.lpfnWndProc = GetWindowProc
    wc.cbClsExtra = 0
    wc.cbWndExtra = 0
    wc.hInstance = hi
    wc.hIcon = 0
    wc.hCursor = LoadCursorW(0, IDC_ARROW)
    wc.hbrBackground = COLOR_WINDOW + 1
    wc.lpszMenuName = 0
    wc.lpszClassName = _OFFSET(ClassName)
     
    at = RegisterClassA(_OFFSET(wc)): IF 0 = at THEN SYSTEM

'create main window
t1 = "title" + CHR$(0)
hw = CreateWindowEx(0, _OFFSET(ClassName) , _OFFSET(t1), WS_OVERLAPPEDWINDOW , 200, 200, 800, 600, 0, 0, hi, 0)
IF 0 = hw THEN SYSTEM

ShowWindow(hw, SW_SHOW)
UpdateWindow(hw)

'win message loop

  While GetMessageA(_OFFSET(wmsg), 0, 0, 0) <> 0
          TranslateMessage(_OFFSET(wmsg))
           DispatchMessageA(_OFFSET(wmsg))
       Wend   


Attached Files Image(s)
   
Reply


Messages In This Thread
GUI app and winAPI calls - by aurel - 03-22-2023, 02:23 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-22-2023, 02:26 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 05:24 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 06:10 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 06:23 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 07:21 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-22-2023, 08:05 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 08:13 PM
RE: GUI app and winAPI calls - by mnrvovrfc - 03-22-2023, 08:33 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-22-2023, 08:34 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 09:13 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-22-2023, 09:23 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 09:35 PM
RE: GUI app and winAPI calls - by aurel - 03-22-2023, 09:39 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-22-2023, 11:45 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 07:38 AM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-23-2023, 01:03 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 05:26 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 07:18 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 07:29 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-23-2023, 07:33 PM
RE: GUI app and winAPI calls - by mnrvovrfc - 03-23-2023, 07:51 PM
RE: GUI app and winAPI calls - by vince - 03-23-2023, 08:07 PM
RE: GUI app and winAPI calls - by mnrvovrfc - 03-23-2023, 08:41 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 08:25 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 08:41 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-23-2023, 08:53 PM
RE: GUI app and winAPI calls - by vince - 03-23-2023, 08:50 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 08:51 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 08:53 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 09:00 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 09:07 PM
RE: GUI app and winAPI calls - by aurel - 03-23-2023, 09:09 PM
RE: GUI app and winAPI calls - by SpriggsySpriggs - 03-23-2023, 09:11 PM
RE: GUI app and winAPI calls - by vince - 03-23-2023, 09:21 PM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 06:33 AM
RE: GUI app and winAPI calls - by mnrvovrfc - 03-24-2023, 07:12 AM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 09:27 AM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 09:51 AM
RE: GUI app and winAPI calls - by mnrvovrfc - 03-24-2023, 06:19 PM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 02:49 PM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 08:43 PM
RE: GUI app and winAPI calls - by aurel - 03-24-2023, 08:49 PM
RE: GUI app and winAPI calls - by aurel - 03-25-2023, 04:28 PM
RE: GUI app and winAPI calls - by aurel - 03-25-2023, 07:32 PM
RE: GUI app and winAPI calls - by aurel - 03-25-2023, 09:35 PM
RE: GUI app and winAPI calls - by RhoSigma - 03-25-2023, 10:44 PM
RE: GUI app and winAPI calls - by aurel - 03-26-2023, 07:16 AM
RE: GUI app and winAPI calls - by RhoSigma - 03-26-2023, 08:39 AM



Users browsing this thread: 23 Guest(s)