wcx.style = CS_DBLCLKS '|CS_OWNDC
so there is no CS_VREDRAW - CS_HREDRAWwinstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN
MoveWindow ( status,0,(h-32),w,h,1)
which is under message WM_SIZEType WNDCLASS
'cbSize as long
Style as long
lpfnwndproc as long
cbClsextra as long
cbWndExtra as long
hInstance as long
hIcon as long
' hIconSm AS long
hCursor as long
hbrBackground as long
lpszMenuName as long
lpszClassName as long
End Type
Type WNDCLASSEX
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
hIconSm AS sys
End Type
SendMessage status,WM_SIZE ,0,0
like is in that example (in C).If I see no flicker while you see one, then there will be no other cure to this problem than throw your PC away in the trash bin.
something it is not normal...and please stop with stupid observations.
If Sp2 has a bug while Sp3 hasn't, it means Sp2 is buggy and bad, and Sp3 is bugless and good.
Have you been able to compile my FBSL code, Aurel? Your editor can't compile it, so how did you manage to even check out my suggestions before criticizing them?
'skeleton VB way...
$ filename "skeleton.exe"
include "rtl32.inc"
'#lookahead
'structures
Type WNDCLASSEX
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
hIconSm AS sys
End Type
Type POINTAPI
x as long
y as long
End Type
Type MSG
hwnd as sys
message as int
wParam as sys
lParam as sys
time as dword
pt as POINTAPI
End Type
Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
'constants
% IDI_WINLOGO = 32517
% IDI_APPLICATION = 32512
% IDC_ARROW = 32512
% CS_OWNDC = 32
% CS_DBLCLKS = &H8
% SW_NORMAL = 1
% SW_SHOW = 5
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% WM_KEYDOWN = 256
% WM_KEYUP = 257
% WM_MOUSEMOVE = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP = 514
% WM_RBUTTONUP = 517
% WM_MBUTTONUP = 520
% WS_OVERLAPPEDWINDOW = 0x00CF0000
% WS_SYSMENU = 0x80000
% WS_OVERLAPPED = WS_SYSMENU
% WS_POPUP = 0x80000000
% WS_DLGFRAME = 0x400000
% WS_VISIBLE = 0x10000000
% WS_CLIPSIBLINGS = 0x4000000
% WS_CLIPCHILDREN = 0x2000000
'defines...
SYS WHITE_BRUSH = 0
'declarations...
Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Any) As Long
Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long
Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (sys lpModuleName) as Long
Declare Function RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (byref lpwcx as WNDCLASSEX) as Long
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as Long
Declare Function TranslateMessage Lib "user32.dll" (byref lpMsg as MSG) as Long
Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as MSG) as Long
Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (lpMsg As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Declare Function UpdateWindow Lib "user32.dll" (ByVal lhwnd As Long) As Long
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As sys, ByRef lpRect As RECT) As Long
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function CreatePopupMenu Lib "user32.dll" () As Long
Declare Function CreateMenu Lib "user32.dll" () As Long
Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Declare Function AppendMenu Lib "user32.dll" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DestroyMenu Lib "user32.dll" (ByVal hMenu As Long) As Long
Declare Function TrackPopupMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long
'
'GetClientSize / GetClientRect
Declare Function GetSize(int window , winX as int, winY as int, winW as int, winH as int)
Dim wcx as WNDCLASSEX
Dim wm as MSG
Dim hwnd,style, Wx, Wy, Ww, Wh, wparent as Long
Dim wcaption,ClassName as String
Dim rc as RECT
'wcaption = "MyWindow"
classname = "Oxygen"
style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
Wx=0 : Wy=0 : Ww=640 : Wh=480
wparent = 0 'HWND_DESKTOP
'listbox def -------------------------------
INT LBox,lbx=20,lby=20,lw=300,lh=200,LBID=100
'RECT def -----------------------
INT Lx,Ty,Hs,Vs
'FILL WNDCLASSEX structure :::::::::::::::::::::::::::::::
inst = GetModuleHandle 0
wcx.cbSize = sizeOf(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra = 0
wcx.cbWndExtra = 0
wcx.hInstance = inst
wcx.hIcon = LoadIcon 0,IDI_APPLICATION
wcx.hCursor = LoadCursor 0,IDC_ARROW
wcx.hbrBackground = GetStockObject(WHITE_BRUSH)
wcx.lpszMenuName = strptr ""
wcx.lpszClassName = strptr Classname
wcx.hIconSm = 0
RegisterClassEx wcx
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
wcaption = "MyWindowEx"
'create window -------------------------------
Hwnd = CreateWindowEx 0,ClassName , wcaption, style, Wx, Wy, Ww, Wh, wparent, 0, inst,0
ShowWindow Hwnd,SW_SHOW
'create listbox
LBox = CreateWindowEx 0x200,"LISTBOX","", 0x50000140, lbx, lby, lw, lh, Hwnd, 0,0,LBID
'message loop-----------------
WHILE GetMessage(wm,0,0,0)
TranslateMessage wm
DispatchMessage wm
WEND
'main callback procedure ---------------------------------------
Function WndProc (sys hwnd,wMsg,wParam,lParam) as sys callback
Select wMsg
Case WM_SIZE
GetSize(Hwnd , Lx, Ty, Hs, Vs)
MoveWindow (LBox, lbx , lby, Hs-40, Vs-50, 1)
Case WM_DESTROY
PostQuitMessage 0
End Select
'never put default return inside select
Return DefWindowProc(Hwnd,wMsg,wParam,lParam)
End Function
'------------------------------------------
'GetClientsize --------------------------------------------------------------------------------
SUB GetSize(int window , winX as int, winY as int, winW as int, winH as int)
GetClientRect( window, rc)
'hndx=0:hndy=0:hndw=0:hndh=0
winX = rc.Left
winY = rc.top
winW = rc.right
winH = rc.bottom
'Return rc
End SUB
QuoteIf Sp2 has a bug while Sp3 hasn't, it means Sp2 is buggy and bad, and Sp3 is bugless and good.Explanation for children. (Punch and Judy show) ;D
The following FBSL script (and of course its equivalent in OxygenBasic if its main window doesn't have CS_HREDRAW/CS_VREDRAW and has WS_CLIPCHILDREN) will provide you with a GUI that's perfectly flicker-free ...
'skeleton VB way...
$ filename "skeleton.exe"
'include "rtl32.inc"
'#lookahead
'structures
Type WNDCLASSEX
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
hIconSm AS sys
End Type
Type POINTAPI
x as long
y as long
End Type
Type MSG
hwnd as sys
message as int
wParam as sys
lParam as sys
time as dword
pt as POINTAPI
End Type
Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
'constants
% IDI_WINLOGO = 32517
% IDI_APPLICATION = 32512
% IDC_ARROW = 32512
% CS_OWNDC = 32
% CS_DBLCLKS = &H8
% SW_NORMAL = 1
% SW_SHOW = 5
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% WM_KEYDOWN = 256
% WM_KEYUP = 257
% WM_MOUSEMOVE = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP = 514
% WM_RBUTTONUP = 517
% WM_MBUTTONUP = 520
% WS_OVERLAPPEDWINDOW = 0x00CF0000
% WS_SYSMENU = 0x80000
% WS_OVERLAPPED = WS_SYSMENU
% WS_POPUP = 0x80000000
% WS_DLGFRAME = 0x400000
% WS_CHILD = 0x40000000
% WS_VISIBLE = 0x10000000
% WS_CLIPSIBLINGS = 0x4000000
% WS_CLIPCHILDREN = 0x2000000
% WS_EX_CLIENTEDGE = 0x200
% LBS_NOINTEGRALHEIGHT = 0x100
% LBS_HASSTRINGS = 0x40
% LB_ADDSTRING = 0x180
'defines...
SYS WHITE_BRUSH = 0
'declarations...
Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Any) As Long
Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long
Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (sys lpModuleName) as Long
Declare Function RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (byref lpwcx as WNDCLASSEX) as Long
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as Long
Declare Function TranslateMessage Lib "user32.dll" (byref lpMsg as MSG) as Long
Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as MSG) as Long
Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (lpMsg As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Declare Function UpdateWindow Lib "user32.dll" (ByVal lhwnd As Long) As Long
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As sys, ByRef lpRect As RECT) As Long
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function CreatePopupMenu Lib "user32.dll" () As Long
Declare Function CreateMenu Lib "user32.dll" () As Long
Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Declare Function AppendMenu Lib "user32.dll" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DestroyMenu Lib "user32.dll" (ByVal hMenu As Long) As Long
Declare Function TrackPopupMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
Dim wcx as WNDCLASSEX
Dim wm as MSG
Dim hwnd,style, Wx, Wy, Ww, Wh, wparent as Long
Dim wcaption,ClassName as String
Dim rc as RECT
'wcaption = "MyWindow"
classname = "Oxygen"
style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
Wx=0 : Wy=0 : Ww=640 : Wh=480
wparent = 0 'HWND_DESKTOP
'listbox def -------------------------------
INT LBox, lbx=20,lby=20,lw=300,lh=200,LBID=100
'FILL WNDCLASSEX structure :::::::::::::::::::::::::::::::
inst = GetModuleHandle 0
wcx.cbSize = sizeOf(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra = 0
wcx.cbWndExtra = 0
wcx.hInstance = inst
wcx.hIcon = LoadIcon 0,IDI_APPLICATION
wcx.hCursor = LoadCursor 0,IDC_ARROW
wcx.hbrBackground = GetStockObject(WHITE_BRUSH)
wcx.lpszMenuName = strptr ""
wcx.lpszClassName = strptr Classname
wcx.hIconSm = 0
RegisterClassEx wcx
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
wcaption = "MyWindowEx"
'create window -------------------------------
Hwnd = CreateWindowEx 0,ClassName , wcaption, style, Wx, Wy, Ww, Wh, wparent, 0, inst,0
ShowWindow Hwnd,SW_SHOW
' status bar
Int SBar, SBID = 101
Macro HiWord(a)
(0xffff And (a>>16))
End Macro
Macro LoWord(a)
(a And 0xffff)
End Macro
'message loop-----------------
WHILE GetMessage(wm,0,0,0)
TranslateMessage wm
DispatchMessage wm
WEND
'main callback procedure ---------------------------------------
Function WndProc(sys hwnd, wMsg, wParam, lParam) As sys callback
Select wMsg
Case WM_CREATE
LBox = CreateWindowEx WS_EX_CLIENTEDGE, "ListBox", "", WS_CHILD + WS_VISIBLE + LBS_NOINTEGRALHEIGHT, lbx, lby, lw, lh, Hwnd, LBID, 0, 0
SendMessage LBox, LB_ADDSTRING, 0, "Some"
SendMessage LBox, LB_ADDSTRING, 0, "listbox"
SendMessage LBox, LB_ADDSTRING, 0, "strings"
SendMessage LBox, LB_ADDSTRING, 0, "added"
SendMessage LBox, LB_ADDSTRING, 0, "for"
SendMessage LBox, LB_ADDSTRING, 0, "your"
SendMessage LBox, LB_ADDSTRING, 0, "enjoyment"
SBar = CreateWindowEx 0, "MSCtls_StatusBar32", "Ready...", WS_CHILD + WS_VISIBLE, 0, 0, 0, 0, Hwnd, SBID, 0, 0
Case WM_SIZE
MoveWindow LBox, lbx, lby, LoWord(lParam) - 40, HiWord(lParam) - 50, 1
SendMessage SBar, WM_SIZE, 0, 0
Case WM_DESTROY
PostQuitMessage 0
End Select
'never put default return inside select
Return DefWindowProc(Hwnd, wMsg, wParam, lParam)
End Function
'-----------------------------------------
my code contain bug :o
LBox = CreateWindowEx 0x200,"LISTBOX","", 0x50000140, lbx, lby, lw, lh, Hwnd, 0,0,LBID
LBox = CreateWindowEx WS_EX_CLIENTEDGE, "ListBox", "", WS_CHILD + WS_VISIBLE + LBS_NOINTEGRALHEIGHT, lbx, lby, lw, lh, Hwnd, LBID, 0, 0
but your even don't show status bar :o :o :o
'skeleton VB way...
$ filename "skeleton.exe"
include "rtl32.inc"
'#lookahead
'structures
Type WNDCLASSEX
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
hIconSm AS sys
End Type
Type POINTAPI
x as long
y as long
End Type
Type MSG
hwnd as sys
message as int
wParam as sys
lParam as sys
time as dword
pt as POINTAPI
End Type
Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
'constants
% IDI_WINLOGO = 32517
% IDI_APPLICATION = 32512
% IDC_ARROW = 32512
% CS_OWNDC = 32
% CS_DBLCLKS = &H8
% SW_NORMAL = 1
% SW_SHOW = 5
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% WM_KEYDOWN = 256
% WM_KEYUP = 257
% WM_MOUSEMOVE = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP = 514
% WM_RBUTTONUP = 517
% WM_MBUTTONUP = 520
% WS_OVERLAPPEDWINDOW = 0x00CF0000
% WS_SYSMENU = 0x80000
% WS_OVERLAPPED = WS_SYSMENU
% WS_POPUP = 0x80000000
% WS_DLGFRAME = 0x400000
% WS_VISIBLE = 0x10000000
% WS_CHILD = 0x40000000
% WS_CLIPSIBLINGS = 0x4000000
% WS_CLIPCHILDREN = 0x2000000
% LB_ADDSTRING = 0x180
'statusbar constants
% SBARS_SIZEGRIP = 0x100
'defines...
SYS WHITE_BRUSH = 0
'declarations...
Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Any) As Long
Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long
Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (sys lpModuleName) as Long
Declare Function RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (byref lpwcx as WNDCLASSEX) as Long
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as Long
Declare Function TranslateMessage Lib "user32.dll" (byref lpMsg as MSG) as Long
Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as MSG) as Long
Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (lpMsg As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Declare Function UpdateWindow Lib "user32.dll" (ByVal lhwnd As Long) As Long
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As sys, ByRef lpRect As RECT) As Long
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function SendMessage Lib "User32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function CreatePopupMenu Lib "user32.dll" () As Long
Declare Function CreateMenu Lib "user32.dll" () As Long
Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Declare Function AppendMenu Lib "user32.dll" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DestroyMenu Lib "user32.dll" (ByVal hMenu As Long) As Long
Declare Function TrackPopupMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long
Declare Function GetSize(int window , winX as int, winY as int, winW as int, winH as int)
Dim wcx as WNDCLASSEX
Dim wm as MSG
Dim hwnd,style, Wx, Wy, Ww, Wh, wparent as Long
Dim wcaption,ClassName,cr as String
Dim rc as RECT
cr=chr(10)
'wcaption = "MyWindow"
classname = "Oxygen"
style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
Wx=0 : Wy=0 : Ww=640 : Wh=480
wparent = 0 'HWND_DESKTOP
'listbox def -------------------------------
INT LBox,lbx=20,lby=20,lw=300,lh=200,LBID=100
'RECT def -----------------------
INT Lx,Ty,Hs,Vs
'FILL WNDCLASSEX structure
inst = GetModuleHandle 0
wcx.cbSize = sizeOf(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra = 0
wcx.cbWndExtra = 0
wcx.hInstance = inst
wcx.hIcon = LoadIcon 0,IDI_APPLICATION
wcx.hCursor = LoadCursor 0,IDC_ARROW
wcx.hbrBackground = GetStockObject(WHITE_BRUSH)
wcx.lpszMenuName = strptr ""
wcx.lpszClassName = strptr Classname
wcx.hIconSm = 0
RegisterClassEx wcx
wcaption = "MyWindowEx"
'create window -------------------------------
Hwnd = CreateWindowEx 0,ClassName , wcaption, style, Wx, Wy, Ww, Wh, wparent, 0, inst,0
ShowWindow Hwnd,SW_SHOW
'create listbox
LBox = CreateWindowEx 0x200,"LISTBOX","", 0x50000140, lbx, lby, lw, lh, Hwnd, LBID,0,0
SendMessage LBox, LB_ADDSTRING, 0,strptr "Some"
SendMessage LBox, LB_ADDSTRING, 0,strptr "listbox"
SendMessage LBox, LB_ADDSTRING, 0,strptr "strings"
SendMessage LBox, LB_ADDSTRING, 0,strptr "added"
SendMessage LBox, LB_ADDSTRING, 0,strptr "for you"
' status bar
Int SBar, SBID = 110
SBar = CreateWindowEx 0x200, "msctls_statusbar32", "!status bar", 1409286400 , 0, 0, 0, 0, Hwnd, SBID, 0, 0
'message loop-----------------
WHILE GetMessage(wm,0,0,0)
TranslateMessage wm
DispatchMessage wm
WEND
'main callback procedure ---------------------------------------
Function WndProc (sys hwnd,wMsg,wParam,lParam) as sys callback
Select wMsg
Case WM_SIZE
GetSize(Hwnd , Lx, Ty, Hs, Vs)
MoveWindow (LBox, lbx , lby, Hs-40, Vs-80, 1)
SendMessage SBar, WM_SIZE, 0, 0
Case WM_DESTROY
PostQuitMessage 0
End Select
'never put default return inside select
Return DefWindowProc(Hwnd,wMsg,wParam,lParam)
End Function
'------------------------------------------
'GetClientsize --------------------------------------------------------------------------------
SUB GetSize(int window , winX as int, winY as int, winW as int, winH as int)
GetClientRect( window, rc)
'hndx=0:hndy=0:hndw=0:hndh=0
winX = rc.Left
winY = rc.top
winW = rc.right
winH = rc.bottom
'Return rc
End SUB
As with all common controls, you must call InitCommonControls() BEFORE you try and use them. You will need to #include <commctrl.h> in order to use this function and to get the functions and declarations necessary for use of the Common Controls. You will also need to add comctl32.lib to your linker settings if it is not already there. Note that InitCommonControls() is an older API, and for more control you can use InitCommonControlsEx() (aka InitCommonControlSex()) which is also required for the most recent common controls. However since I'm not using any of the advanced features, InitCommonControls() is adequate and simpler.
'skeleton VB way...
$ filename "skeleton.exe"
include "rtl32.inc"
'#lookahead
'structures
Type WNDCLASSEX
cbSize as int
Style as int
lpfnwndproc as sys
cbClsextra as int
cbWndExtra as int
hInstance as sys
hIcon as sys
hCursor as sys
hbrBackground as sys
lpszMenuName as sys
lpszClassName as sys
hIconSm AS sys
End Type
Type POINTAPI
x as long
y as long
End Type
Type MSG
hwnd as sys
message as int
wParam as sys
lParam as sys
time as dword
pt as POINTAPI
End Type
Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
'constants
% IDI_WINLOGO = 32517
% IDI_APPLICATION = 32512
% IDC_ARROW = 32512
% CS_OWNDC = 32
% CS_DBLCLKS = &H8
% SW_NORMAL = 1
% SW_SHOW = 5
% WM_CREATE = 1
% WM_DESTROY = 2
% WM_PAINT = 15
% WM_QUIT = 18
% WM_SIZE = 5
% WM_MOVE = 3
% WM_CHAR = 258
% WM_KEYDOWN = 256
% WM_KEYUP = 257
% WM_MOUSEMOVE = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP = 514
% WM_RBUTTONUP = 517
% WM_MBUTTONUP = 520
% WS_OVERLAPPEDWINDOW = 0x00CF0000
% WS_SYSMENU = 0x80000
% WS_OVERLAPPED = WS_SYSMENU
% WS_POPUP = 0x80000000
% WS_DLGFRAME = 0x400000
% WS_VISIBLE = 0x10000000
% WS_CHILD = 0x40000000
% WS_CLIPSIBLINGS = 0x4000000
% WS_CLIPCHILDREN = 0x2000000
% LB_ADDSTRING = 0x180
'statusbar constants
% SBARS_SIZEGRIP = 0x100
'defines...
SYS WHITE_BRUSH = 0
'declarations...
Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Any) As Long
Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long
Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (sys lpModuleName) as Long
Declare Function RegisterClassEx Lib "user32.dll" Alias "RegisterClassExA" (byref lpwcx as WNDCLASSEX) as Long
Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as Long
Declare Function TranslateMessage Lib "user32.dll" (byref lpMsg as MSG) as Long
Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as MSG) as Long
Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (lpMsg As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Declare Function UpdateWindow Lib "user32.dll" (ByVal lhwnd As Long) As Long
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As sys, ByRef lpRect As RECT) As Long
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function SendMessage Lib "User32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function CreatePopupMenu Lib "user32.dll" () As Long
Declare Function CreateMenu Lib "user32.dll" () As Long
Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
Declare Function AppendMenu Lib "user32.dll" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DestroyMenu Lib "user32.dll" (ByVal hMenu As Long) As Long
Declare Function TrackPopupMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long
Declare Function GetSize(int window , winX as int, winY as int, winW as int, winH as int)
dim comctl32 = LoadLibrary "comctl32.dll"
Dim wcx as WNDCLASSEX
Dim wm as MSG
Dim hwnd,style, Wx, Wy, Ww, Wh, wparent as Long
Dim wcaption,ClassName,cr as String
Dim rc as RECT
cr=chr(10)
'wcaption = "MyWindow"
classname = "Oxygen"
style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
Wx=0 : Wy=0 : Ww=640 : Wh=480
wparent = 0 'HWND_DESKTOP
'listbox def -------------------------------
INT LBox,lbx=20,lby=20,lw=300,lh=200,LBID=100
'RECT def -----------------------
INT Lx,Ty,Hs,Vs
'FILL WNDCLASSEX structure
inst = GetModuleHandle 0
wcx.cbSize = sizeOf(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra = 0
wcx.cbWndExtra = 0
wcx.hInstance = inst
wcx.hIcon = LoadIcon 0,IDI_APPLICATION
wcx.hCursor = LoadCursor 0,IDC_ARROW
wcx.hbrBackground = GetStockObject(WHITE_BRUSH)
wcx.lpszMenuName = strptr ""
wcx.lpszClassName = strptr Classname
wcx.hIconSm = 0
RegisterClassEx wcx
wcaption = "MyWindowEx"
'create window -------------------------------
Hwnd = CreateWindowEx 0,ClassName , wcaption, style, Wx, Wy, Ww, Wh, wparent, 0, inst,0
ShowWindow Hwnd,SW_SHOW
'create listbox
LBox = CreateWindowEx 0x200,"LISTBOX","", 0x50000140|WS_CLIPSIBLINGS, lbx, lby, lw, lh, Hwnd, LBID,0,0
SendMessage LBox, LB_ADDSTRING, 0,strptr "Some"
SendMessage LBox, LB_ADDSTRING, 0,strptr "listbox"
SendMessage LBox, LB_ADDSTRING, 0,strptr "strings"
SendMessage LBox, LB_ADDSTRING, 0,strptr "added"
SendMessage LBox, LB_ADDSTRING, 0,strptr "for you"
' status bar
Int SBar, SBID = 110
SBar = CreateWindowEx 0x200, "msctls_statusbar32", "_Status_Bar:", 1409286400 , 0, 0, 0, 0, Hwnd, SBID, 0, 0
'message loop-----------------
WHILE GetMessage(wm,0,0,0)
TranslateMessage wm
DispatchMessage wm
WEND
'main callback procedure ---------------------------------------
Function WndProc (sys hwnd,wMsg,wParam,lParam) as sys callback
Select wMsg
Case WM_SIZE
GetSize(Hwnd , Lx, Ty, Hs, Vs)
MoveWindow (LBox, lbx , lby, Hs-40, Vs-80, 1)
SendMessage SBar, WM_SIZE, 0, 0
Case WM_DESTROY
PostQuitMessage 0
End Select
'never put default return inside select
Return DefWindowProc(Hwnd,wMsg,wParam,lParam)
End Function
'------------------------------------------
'GetClientsize --------------------------------------------------------------------------------
SUB GetSize(int window , winX as int, winY as int, winW as int, winH as int)
GetClientRect( window, rc)
'hndx=0:hndy=0:hndw=0:hndh=0
winX = rc.Left
winY = rc.top
winW = rc.right
winH = rc.bottom
'Return rc
End SUB
... but as i say there is no status control because missing :
dim comctl32 = LoadLibrary "comctl32.dll"
... so when i add this in my program then work everything :D
Anyway, good to hear your interpreter's tool palette will now include two more user controlsI don't do that for my interpreter,but in first place because Oxygen basic and for testing