Author Topic: STATUSBAR - FLICKER FREE?  (Read 7540 times)

0 Members and 2 Guests are viewing this topic.

Peter

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #15 on: October 22, 2015, 08:21:54 AM »
Quote
If 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

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #16 on: October 22, 2015, 10:07:53 AM »
Punch...  ;D ;D ;D

Hi mister Mike 

Quote
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?

yes of course..without problem i can run your .fbs script with my ASci_FBSL editor
so i see that listbox flickering ...there is no need to lie about that ..right?

As I suspect main problem connected with flickering is because i use
WNDCLASS and not WNDCLASSEX ...

****************************************************
So proper way for GUI application is to use WNDCLASSEX.
****************************************************
also as window style must be used this :
style   = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN

Here is test program with listbox control..so anyone can try to compile
and to see how work.
all best Aurel   :D


Code: [Select]
'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

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #17 on: October 22, 2015, 12:31:39 PM »
@Peter:

Quote
If 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

Exactly! I'm trying to help Aurel to understand English better because it is only now that he has succeeded in decrypting the very first sentence in the message I posted three days ago. :o He does not or he can not read and understand what I'm telling him! ;D


@Aurel:

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 ...

This was the first sentence in the message I posted to you three days ago. I am glad you have finally found the time to read it and translate successfully. I am also glad you implemented some of my suggestions in your OxygenBasic code. I also hope you will, from now on, be using SendMessage(hStatus, WM_SIZE, 0, 0) to reposition your statusbar both in your editor code and elsewhere.

I will however also strongly recommend using my BeginDeferWindowPos()/DeferWindowPos()/EndDeferWindowPos() suggestion whenever your GUI is going to host some five visible controls or more.

Good luck! :)

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #18 on: October 22, 2015, 02:53:28 PM »
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.

Code: [Select]
'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
'-----------------------------------------

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #19 on: October 24, 2015, 09:13:46 AM »
Mike
my code contain bug  :o
but your even don't show status bar  :o :o :o
 ;D

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #20 on: October 24, 2015, 11:10:02 AM »
my code contain bug  :o

Here's how you create your controls:
Quote
LBox = CreateWindowEx 0x200,"LISTBOX","", 0x50000140, lbx, lby, lw, lh, Hwnd, 0,0,LBID

and here's how they must be created:
Quote
LBox = CreateWindowEx WS_EX_CLIENTEDGE, "ListBox", "", WS_CHILD + WS_VISIBLE + LBS_NOINTEGRALHEIGHT, lbx, lby, lw, lh, Hwnd, LBID, 0, 0

Watch out for your control ID argument positions the next time you land in front of your PC to code something.


but your even don't show status bar  :o :o :o

Ya trollin' an' tryin' to make a fool of me again, man? Watch yet another one of my videos then, you seem to be so fond of them, doncha?

Please stop that, Aurel, or I won't respond to your questions ever again.

.

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #21 on: October 24, 2015, 12:20:02 PM »
Yes you have right about wrong position of LBID and i made mistake
but i really ...really ...don't get it why statusbar is not visible this time ( oxygen code).
and there is no joke...
it looks if status control is called from include file like awinh then
is visible
but if is created directly then nothing ?????
strange..



Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #22 on: October 24, 2015, 12:26:32 PM »
Aurel,

Why didn't you download my zip?

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #23 on: October 24, 2015, 12:36:03 PM »
Ok downloading ....

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #24 on: October 24, 2015, 12:39:06 PM »
Now I see. I hope my exe works on your PC as expected?

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #25 on: October 24, 2015, 12:47:17 PM »
No ..not work...i really dont get it why?
As i say i see your video and see that status is created but
when i run your exe then there is no statusBar and
i repeat this is not any kind of joke ...maybe is problem in Oxygen ..who knows?
And i repeat again...
if status bar is created from include file then work but directly after listbox not work
crazy... :o

here is my code:
Code: [Select]
'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

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #26 on: October 24, 2015, 12:52:44 PM »
I am talking about skeleton.exe that's in the zip, not about my script that's in there too, or your script that you've just posted. Please double click on skeleton.exe. Does it show both the listbox and the statusbar? Does the listbox display its text lines?

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #27 on: October 24, 2015, 12:58:01 PM »
Yes ...
i know i am not kid ...
listbox is here but there is no statusbar ...and it looks i figured why is not
i forget that in include file is:
Quote
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.

sooo that why work from include and why not from my code
sorry man what kind of trouble for nothing ...
i will resolved this tomorow....
good night ....


PS ..this is the missing thing:

dim comctl32 = LoadLibrary "comctl32.dll"
oh what a mumbo jumbo

Mike Lobanovsky

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #28 on: October 24, 2015, 01:01:58 PM »
Please tell me tomorrow if the listbox in my skeleton.exe shows the "Some listbox strings added for your enjoyment" message in its lines for you.

Have a good rest, Aurel. :)

Aurel

  • Guest
Re: STATUSBAR - FLICKER FREE?
« Reply #29 on: October 25, 2015, 04:42:36 AM »
Hi Mike
yes your skeleton-exe work ok ...listbox work ok
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

Code: [Select]
'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