Hi Aurel,
Try this, might be incorrect!
Type WndEventArgs
wParam As Long
lParam As Long
hWnd As Dword
hInst As Dword
wWidth As Word
wHeight As Word
wX As Word
wY As Word
wCharHt As Word
xPos As Word
yPos As Word
szText As Asciiz*128
End Type
Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type PAINTSTRUCT
hdc As Long
fErase As Long
rcPaint As Rect
fRestore As Long
fIncUpdate As Long
rgbReserved As Byte
End Type
Type POINTAPI
x As Long
y As Long
End Type
Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
% WM_LBUTTONDOWN = &H201
% WM_LBUTTONUP = &H202
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% SW_SHOW = 5
% WS_OVERLAPPED = &h80000
% HWND_DESKTOP = 0
% IDI_WINLOGO = 32517
% IDC_ARROW = 32512
! GetDC Lib "user32.dll" (sys hwnd) As sys
! GetTextMetrics Lib "gdi32.dll" Alias "GetTextMetricsA" (sys hdc, ByRef lpMetrics As TEXTMETRIC) As sys
! ReleaseDC Lib "user32.dll" (sys hwnd, hdc) As sys
! InvalidateRect Lib "user32.dll" (sys hwnd, ByRef lpRect As RECT, sys bErase) As sys
! BeginPaint Lib "user32.dll" (sys hwnd, ByRef lpPaint As PAINTSTRUCT) As sys
! EndPaint Lib "user32.dll" (sys hwnd, ByRef lpPaint As PAINTSTRUCT) As sys
! TextOut Lib "gdi32.dll" Alias "TextOutA" (sys hdc, x, y, string lpString, sys nCount) As sys
! DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (sys hwnd, wMsg, wParam, lParam) As sys
! PostQuitMessage Lib "user32.dll" (sys nExitCode)
! GetMessage Lib "user32.dll" Alias "GetMessageA" (MSG *lpMsg, sys hwnd, wMsgFilterMin, wMsgFilterMax) As sys
! TranslateMessage Lib "user32.dll" (ByRef lpMsg As MSG) As sys
! DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (MSG *lpMsg) As sys
! LoadCursor Lib "user32.dll" Alias "LoadCursorA" (sys hInstance, string lpCursorName) As sys
! LoadIcon Lib "user32.dll" Alias "LoadIconA" (sys hInstance, string lpIconName) As sys
! CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (sys dwExStyle, string lpClassName, lpWindowName, sys dwStyle, x, y, nWidth, nHeight, hWndParent, ByVal hMenu, hInstance, ByRef lpParam As Any) As sys
! RegisterClass Lib "user32.dll" Alias "RegisterClassA" (ByRef Class As WNDCLASS) As sys
! ShowWindow Lib "user32.dll" (sys hwnd, nCmdShow) As sys
Function HiWord (sys hi) as sys
shr hi,16
Return hi
End Function
Function LoWord (sys lo) as sys
and lo,0xFFFF
Return lo
End Function
Function fnWndProc_OnCreate(WndEventArgs *wea) As sys
TEXTMETRIC tm
sys hDC
hDC=GetDC(wea.hWnd)
GetTextMetrics(hDC,tm)
wea.wCharHt=tm.tmHeight
ReleaseDC(wea.hWnd,hDC)
MsgBox "wea.wCharHt= " + tm.tmHeight,"Achtung",48
Return 0
End Function
Function fnWndProc_OnMouseMove(WndEventArgs *wea) As sys
wea.wX=LoWord(wea.lParam) : wea.wY=HiWord(wea.lParam)
InvalidateRect(wea.hWnd,0,1)
Return 0
End Function
Function fnWndProc_OnSize(WndEventArgs *wea) As sys
wea.wWidth=LoWord(wea.lParam) : wea.wHeight=HiWord(wea.lParam)
InvalidateRect(wea.hWnd,0,1)
Return 0
End Function
Function fnWndProc_OnChar(wea As WndEventArgs) As Long
wea.szText=wea.szText+Chr$(wea.wParam)
InvalidateRect(wea.hWnd,0,1)
Return 0
End Function
Function fnWndProc_OnLButtonDown(wea As WndEventArgs) As Long
If wea.wParam= WM_LBUTTONDOWN
wea.xPos=LoWord(wea.lParam) : wea.yPos=HiWord(wea.lParam)
InvalidateRect(wea.hWnd,0,l)
End If
Return WM_LBUTTONDOWN
End Function
Function fnWndProc_OnPaint(WndEventArgs *wea) As sys
dim szLine As Asciiz*48
PAINTSTRUCT ps
sys hDC
hDC=BeginPaint(wea.hWnd,ps)
szLine="MouseX="+ Str(wea.wX) + " MouseY="+ Str(wea.wY)
TextOut(hDC,0,0,szLine,Len(szLine))
szLine="wea.wWidth="+Trim$(Str$(wea.wWidth)) & " wea.wHeight=" + Trim$(Str$(wea.wHeight))
TextOut(hDC,0,16,szLine,Len(szLine))
TextOut(hDC,0,32,wea.szText,Len(wea.szText))
If wea.xPos<>0 And wea.yPos<>0
szLine="WM_LBUTTONDOWN At (" + Str(wea.xPos) + "," + Str(wea.yPos) + ")"
TextOut(hDC,wea.xPos,wea.yPos,szLine,Len(szLine))
wea.xPos=0 : wea.yPos=0
End If
EndPaint(wea.hWnd,ps)
Return 0
End Function
Function WndProc(sys hWnd, wMsg, wParam, lParam) As sys
Static wea As WndEventArgs
Select wMsg
Case WM_CREATE
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnCreate(wea)
'Exit Function
Case WM_MOUSEMOVE
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnMouseMove(wea)
'Exit Function
Case %WM_SIZE
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnSize(wea)
'Exit Function
Case WM_CHAR
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnChar(wea)
'Exit Function
Case WM_LBUTTONDOWN
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnLButtonDown(wea)
'Exit Function
Case WM_PAINT
wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
'WndProc=fnWndProc_OnPaint(wea)
'Exit Function
Case WM_DESTROY
Call PostQuitMessage(0)
WndProc=0
Exit Function
End Select
WndProc=DefWindowProc(hWnd,wMsg,wParam,lParam)
End Function
Function WinMain(sys hIns, hPrevIns, asciiz lpCmdLine, sys iShow) As sys
dim szClassName As Asciiz*6
WndClassEx wc
sys hMainWnd
Msg tagMsg
szClassName="CrapForm"
wc.cbSize=SizeOf(wc) : wc.style=0
wc.lpfnWndProc= &WndProc : wc.cbClsExtra=0
wc.cbWndExtra=0 : wc.hInstance=hIns
wc.hIcon=LoadIcon(0,IDI_WINLOGO) : wc.hCursor=LoadCursor(0, IDC_ARROW)
wc.hbrBackground=GetStockObject(WHITE_BRUSH) : wc.lpszMenuName=NULL
wc.lpszClassName=VarPtr(szClassName) : wc.hIconSm=LoadIcon(0,IDI_WINLOGO)
RegisterClassEx &wc
hMainWnd=CreateWindowEx(0,szClassName,"CrapForm", WS_OVERLAPPED,200,100,325,300,HWND_DESKTOP,0,hIns,ByVal 0)
ShowWindow(hMainWnd,iShow)
While GetMessage(&Msg,0,0,0)
TranslateMessage(&Msg)
DispatchMessage (&Msg)
Wend
WinMain=msg.wParam
End Function