Aurel,
Your code contained bugs. Here's a full version that behaves for me exactly like FBSL: no flicker in both controls under Classic, slight flicker of blue selected line in the listbox under Luna.
'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
'-----------------------------------------