Hi Aurel,
Complicated stuff. The FB original was a bit messy, so I went through it line by line, pulling in all the required definitions.
I got this working in examples/GUI
includepath "../../inc/"
$SimpleMessageLoop
$FileName "t.exe"
#include "RTL32.inc"
#include "WinUtil.inc"
MainWindow 320,100,WS_OVERLAPPEDWINDOW
'#case captial
% ICC_BAR_CLASSES = 4
% TBSTYLE_BUTTON 0x0000 // obsolete; use BTNS_BUTTON instead
% TBSTYLE_SEP 0x0001 // obsolete; use BTNS_SEP instead
% TBSTYLE_CHECK 0x0002 // obsolete; use BTNS_CHECK instead
% TBSTYLE_GROUP 0x0004 // obsolete; use BTNS_GROUP instead
% TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) // obsolete; use BTNS_CHECKGROUP instead
% TBSTYLE_DROPDOWN 0x0008 // obsolete; use BTNS_DROPDOWN instead
% TBSTYLE_AUTOSIZE 0x0010 // obsolete; use BTNS_AUTOSIZE instead
% TBSTYLE_NOPREFIX 0x0020 // obsolete; use BTNS_NOPREFIX instead
% TBSTYLE_TOOLTIPS 0x0100
% TBSTYLE_WRAPABLE 0x0200
% TBSTYLE_ALTDRAG 0x0400
% TBSTYLE_FLAT 0x0800
% TBSTYLE_LIST 0x1000
% TBSTYLE_CUSTOMERASE 0x2000
% TBSTYLE_REGISTERDROP 0x4000
% TBSTYLE_TRANSPARENT 0x8000
% HINST_COMMCTRL -1
% IDB_STD_SMALL_COLOR 0
% IDB_STD_LARGE_COLOR 1
% IDB_VIEW_SMALL_COLOR 4
% IDB_VIEW_LARGE_COLOR 5
% IDB_HIST_SMALL_COLOR 8
% IDB_HIST_LARGE_COLOR 9
% IDB_HIST_NORMAL 12
% IDB_HIST_HOT 13
% IDB_HIST_DISABLED 14
% IDB_HIST_PRESSED 15
% STD_CUT = 0
% STD_COPY = 1
% STD_PASTE = 2
% STD_UNDO = 3
% STD_REDOW = 4
% STD_DELETE = 5
% STD_FILENEW = 6
% STD_FILEOPEN = 7
% STD_FILESAVE = 8
% STD_PRINTPRE = 9
% STD_PROPERTIES = 10
% STD_HELP = 11
% STD_FIND = 12
% STD_REPLACE = 13
% STD_PRINT = 14
% TB_ENABLEBUTTON (WM_USER + 1)
% TB_CHECKBUTTON (WM_USER + 2)
% TB_PRESSBUTTON (WM_USER + 3)
% TB_HIDEBUTTON (WM_USER + 4)
% TB_INDETERMINATE (WM_USER + 5)
% TB_MARKBUTTON (WM_USER + 6)
% TB_ISBUTTONENABLED (WM_USER + 9)
% TB_ISBUTTONCHECKED (WM_USER + 10)
% TB_ISBUTTONPRESSED (WM_USER + 11)
% TB_ISBUTTONHIDDEN (WM_USER + 12)
% TB_ISBUTTONINDETERMINATE (WM_USER + 13)
% TB_ISBUTTONHIGHLIGHTED (WM_USER + 14)
% TB_SETSTATE (WM_USER + 17)
% TB_GETSTATE (WM_USER + 18)
% TB_ADDBITMAP (WM_USER + 19)
% TB_ADDBUTTONS (WM_USER + 20)
% TB_INSERTBUTTON (WM_USER + 21)
% TB_DELETEBUTTON (WM_USER + 22)
% TB_GETBUTTON (WM_USER + 23)
% TB_BUTTONCOUNT (WM_USER + 24)
% TB_COMMANDTOINDEX (WM_USER + 25)
% TB_BUTTONSTRUCTSIZE (WM_USER + 30)
% CMB_MASKED 0x02
% TBSTATE_CHECKED 0x01
% TBSTATE_PRESSED 0x02
% TBSTATE_ENABLED 0x04
% TBSTATE_HIDDEN 0x08
% TBSTATE_INDETERMINATE 0x10
% TBSTATE_WRAP 0x20
% TBSTATE_ELLIPSES 0x40
% TBSTATE_MARKED 0x80
% WS_EX_DLGMODALFRAME 1
typedef byte BYTE
typedef word WORD
typedef dword DWORD
% _WIN32
typedef struct {
sys hInst;
sys nID;
} TBADDBITMAP, *LPTBADDBITMAP;
#ifdef _WIN32
%n 2
#else
%n 6
#endif
typedef struct {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
BYTE bReserved[n];
sys dwData;
sys iString;
} TBBUTTON, *PTBBUTTON, *LPTBBUTTON;
typedef struct tagINITCOMMONCONTROLSEX {
DWORD dwSize;
DWORD dwICC;
} INITCOMMONCONTROLSEXtype, *LPINITCOMMONCONTROLSEX;
declare InitCommonControlsEx lib "ComCtl32.dll" (INITCOMMONCONTROLSEXtype*ic) as sys
indexbase 0
function WndProc(hWnd, wMsg, wParam,lparam) as sys callback
===========================================================
static sys hdc, htools, hInstance
static tbAddBmp as TBADDBITMAP
static tbb as TBBUTTON
static iccx as INITCOMMONCONTROLSEXtype
'' bitmap for each button
static tbBmp(7) as sys 'as BYTE
static RECT r
'==========
select wMsg
'==========
case WM_CREATE
'=============
SetWindowText hwnd,"ToolBar Demo"
'
iccx.dwSize = sizeof( iccx )
iccx.dwICC = ICC_BAR_CLASSES
tbBmp = {STD_FILENEW, STD_FILEOPEN, STD_FILESAVE, STD_CUT, STD_COPY, STD_PASTE }
hInstance=GetModuleHandle null
InitCommonControlsEx( iccx )
% TBSTYLES TBSTYLE_FLAT% or WS_CHILD or WS_VISIBLE
hTools =
CreateWindowEx( WS_EX_DLGMODALFRAME, "ToolBarWindow32",
null,WS_CHILD or WS_VISIBLE or TBSTYLES,
0, 0, 0, 0, hWnd, null,hInstance, null )
'
' paint toolbar buttons
'
if hTools <> null then
SendMessage( hTools, TB_BUTTONSTRUCTSIZE, sizeof tbb, null )
tbAddBmp.hInst = HINST_COMMCTRL
tbAddBmp.nID = IDB_STD_SMALL_COLOR
SendMessage( hTools, TB_ADDBITMAP, 0, @tbAddBmp )
'
'' apply bitmap to toolbar buttons
'
dim i,k as LONG
for i = 0 to 6
if i=3 then k=TBSTYLE_SEP else k=TBSTYLE_BUTTON
with tbb
.iBitmap = tbBmp(i)
.fsState = TBSTATE_ENABLED
.fsStyle = k
.idCommand = -1
.dwData = 0
end with
SendMessage( hTools, TB_ADDBUTTONS, 1, @tbb)
next
end if
case WM_DESTROY
'===============
PostQuitMessage 0
case WM_KEYDOWN
'==============
if wParam=27 then SendMessage hwnd, WM_CLOSE, 0, 0 'ESCAPE
case else
'========
function=DefWindowProc hWnd,wMsg,wParam,lParam
end select
'
end function ' WndProc
Charles
X