Chris,
Here is one that works in late versions of PBWIN 10. The code you posted looks like an old Turbo Assembler WndProc.
It can be done but there are no great gains in doing so and you have to get the addresses of the APIs yourself using LoadLibrary/GetProcAddress.
Code:
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
#include "\basic\include\win32api.inc"
MACRO entry_point = PBmain
GLOBAL hInstance as DWORD
GLOBAL hIcon as DWORD
GLOBAL hWnd as DWORD
GLOBAL hUser as DWORD
GLOBAL pPostQuitMessage as DWORD
GLOBAL pDefWindowProcA as DWORD
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION entry_point as LONG
LOCAL Wid as LONG
LOCAL Hgt as LONG
LOCAL wcex as WNDCLASSEX
LOCAL szClassName as ASCIIZ * 32
LOCAL Sw as DWORD
LOCAL Sh as DWORD
hInstance = GetModuleHandle(ByVal %NULL) ' application instance handle
hIcon = LoadIcon(hInstance,ByVal 2) ' application icon handle
Sw = GetSystemMetrics(%SM_CXSCREEN) ' screen width
Sh = GetSystemMetrics(%SM_CYSCREEN) ' screen height
GetAddresses
DisplayName$ = "PB Asm WndProc"
szClassName = "Application_Class"
' ----------------------------------------------------------------------
' set the arguments to determine the characteristics of the window class
' ----------------------------------------------------------------------
wcex.cbSize = SIZEOF(wcex)
wcex.style = %CS_BYTEALIGNCLIENT or %CS_BYTEALIGNWINDOW
wcex.lpfnWndProc = CODEPTR(WndProc)
wcex.cbClsExtra = 0
wcex.cbWndExtra = 0
wcex.hInstance = hInstance
wcex.hIcon = hIcon
wcex.hCursor = LoadCursor(%NULL,ByVal %IDC_ARROW)
wcex.hbrBackground = %COLOR_BTNFACE + 1
wcex.lpszMenuName = %NULL
wcex.lpszClassName = VarPtr(szClassName)
wcex.hIconSm = hIcon
' ---------------------------------------------
' register the class with those characteristics
' ---------------------------------------------
RegisterClassEx wcex
' -----------------------------------------------
' Set Width & Height to percentage of screen size
' -----------------------------------------------
Wid = Sw * .70
Hgt = Sh * .70
' ---------------------------------------
' limit the aspect ratio for wide screens
' ---------------------------------------
If Wid > Hgt * 1.4 Then
Wid = Hgt * 1.4
End If
' ------------------------
' Window is self centering
' ------------------------
hWnd = CreateWindowEx( _
%WS_EX_LEFT, _ ' extended style
szClassName, _ ' window class name
ByVal StrPtr(DisplayName$), _ ' window title
%WS_OVERLAPPEDWINDOW, _ ' window style
Sw\2-(Wid\2), _ ' initial x position
Sh\2-(Hgt\2), _ ' initial y position
Wid, _ ' initial x size
Hgt, _ ' initial y size
%NULL, _ ' parent window handle
%NULL, _ ' window menu handle
hInstance, _ ' program instance handle
ByVal %NULL) ' creation parameters
'-------------------------
ShowWindow hWnd, %SW_SHOW
UpdateWindow hWnd
MessageLoop
FreeLibrary hUser
FUNCTION = 0
END FUNCTION
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FUNCTION MessageLoop() as DWORD
LOCAL pst as DWORD ' DWORD pointer for structure
LOCAL msg as tagMSG ' message structure
pst = VarPtr(msg) ' get pointer address
! jmp nxt_msg ' jump into MsgLoop
MsgLoop:
TranslateMessage ByVal pst
DispatchMessage ByVal pst
nxt_msg:
GetMessage ByVal pst,0,0,0
! test eax, eax
! jne MsgLoop
FUNCTION = msg.wParam
END FUNCTION
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
FASTPROC WndProc
PREFIX "!"
push ebp ; set up a stack frame
mov ebp, esp
cmp DWORD PTR [ebp+12], 2 ; WM_DESTROY
jne lbl0
push 0
call pPostQuitMessage
lbl0:
push DWORD PTR [ebp+20]
push DWORD PTR [ebp+16]
push DWORD PTR [ebp+12]
push DWORD PTR [ebp+8]
call pDefWindowProcA
leave ; exit the stack frame
ret 16 ; balance stack on exit
END PREFIX
END FASTPROC
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
SUB GetAddresses()
hUser = LoadLibrary("user32.dll")
pPostQuitMessage = GetProcAddress(hUser,"PostQuitMessage")
pDefWindowProcA = GetProcAddress(hUser,"DefWindowProcA")
END SUB
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤