Hi,
I had problems with winutil.inc, so I tried this simple code:
use winutil
When I run this code I get this error:
Linker found unidentified names:
449 wndproc
I'm wondering if it's my version of winutil.inc that is incorrect.
Thank you
Hi Nicola,
Winutil expects you to provide a WndProc callback function.
demos\WinGui\KeyBoardCodes2.o2bas is a simple example:
'$ filename "t.exe"
'uses RTL64
uses WinUtil
MainWindow 320,100,WS_OVERLAPPEDWINDOW
function WndProc(sys hWnd, wMsg, wParam,lparam) as sys callback
===============================================================
% ID_Timer 3000
% Interval 100
static sys hdc, htimer, keycode, charcode
static String txt
static PaintStruct Paintst
static RECT crect
'==========
select wMsg
'==========
case WM_CREATE
'=============
hTimer = SetTimer hWnd, ID_Timer, interval, 0
GetClientRect hWnd,@cRect
SetWindowText hwnd,"Key Codes and Ascii Codes"
case WM_TIMER
'=============
InvalidateRect hwnd,@crect,1
case WM_DESTROY
'===============
KillTimer(hWnd,ID_TIMER)
PostQuitMessage 0
case WM_PAINT
'============
hDC=BeginPaint hWnd,@Paintst
GetClientRect hWnd,@cRect
'style
'0x20 DT_SINGLELINE
'0x04 DT_VCENTER
'0x01 DT_CENTER
'0x25
SetBkColor hdc,white
SetTextColor hdc,blue
'
txt="Key Code 0x" hex(keycode,2) " Char Code 0x" hex(charcode,2)
'
DrawText hDC,txt,-1,@cRect,0x25
EndPaint hWnd,@Paintst
ValidateRect hwnd,@crect
case WM_CHAR
'===========
charcode=wparam
case WM_KEYDOWN
'==============
keycode=wParam : charcode=0
if wParam=27 then SendMessage hwnd, WM_CLOSE, 0, 0 'ESCAPE
case else
'========
function=DefWindowProc hWnd,wMsg,wParam,lParam
end select
'
end function ' WndProc
Hi Charles,
I understand, so if the wndproc is not present in the code that includes it, winutil generates an error.
Thank you.