Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

I can not create rebar with CreateWindowEx()

lm_lxt
Beginner
598 Views

Hi All,

The code is following:

hRebar=CreateWindowEx (WS_EX_TOOLWINDOW, &
"ReBarWindow32"C, &
"jhlj", &
ior(WS_VISIBLE,,WS_CHILD),&
0,&
0,&
0,&
0,&
hWnd, &
null,&
HInst, &
NULL)

BUT it can not show the rebar window.I don't kown why.

Many thanks for any help!!

0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
598 Views
Well, for the start, it has zero dimensions so it can hardly be visible. Besides, the rebar's behavior is fairly peculiar, as it automatically accomodates its dimensions to the parent window client area and included toolbars; it might be easily the case that you won't see anything until you add a child (toolbar) into it.

In any case, Spy++ is your friend.
0 Kudos
lm_lxt
Beginner
598 Views

Many Thanks!But I have another problem that the width of verticalrebar have the same value in any case! The following is my resource:


module Constant
use IFwin
use COMCTL32

integer*4 hInst ,hh

character*200 string
logical*4 results

integer*4,parameter:: NumButton = 4

type( T_TBBUTTON ), DIMENSION(*) :: tbrButtons( NumButton )
end module Constant

module Toolbar
integer*4,parameter:: IDC_CURSOR1 =101
integer*4,parameter:: IDI_ICON1 =102
integer*4,parameter:: IDR_MENU1 =103

integer*4,parameter:: ID_40001 =40001
integer*4,parameter:: ID_40002 =40002
integer*4,parameter:: ID_40003 =40003
integer*4,parameter:: ID_40004 =40004
end module Toolbar
!
integer function WinMain( hInstance, hPrevInstance, lpszCmdLine, nCmdShow )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_WinMain@16' :: WinMain
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'WinMain' :: WinMain
!DEC$ ENDIF
use Constant
use Toolbar

integer*4 hInstance
integer*4 hPrevInstance
integer*4 nCmdShow
integer*4 lpszCmdLine

integer*4 i,istyle


interface
integer*4 function MainWndProc ( hwnd, mesg, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'MainWndProc' :: MainWndProc
!DEC$ ENDIF

integer*4 hwnd
integer*4 mesg
integer*4 wParam
integer*4 lParam
end function
end interface
!==============================================================
type ( T_WNDCLASS ) wc

type ( T_MSG ) mesg& nbsp;

integer*4 hWnd,Hbitmap1
integer*4 COLOR
character*100 lpszClassName

character*100 lpszAppName

COLOR=9

lpszClassName ="GenericClass"C
lpszAppName ="hhh"C
if(hPrevInstance .eq. 0) then
wc%lpszClassName = LOC( lpszClassName )
wc%lpfnWndProc = LOC( MainWndProc )
wc%style = 0
wc%hInstance = hInstance

wc%hIcon = LoadIcon( hInstance, IDI_ICON1)
wc%hCursor = LoadCursor( hInstance, IDC_CURSOR1 )
wc%hbrBackground = ( COLOR_WINDOW+COLOR )
wc%lpszMenuName = IDR_MENU1
wc%cbClsExtra = 0
wc%cbWndExtra = 0
i = RegisterClass( wc )
end if

hh=hInstance
hWnd = CreateWindowEx( 0,
& nbsp; lpszClassName, lpszAppName,

INT( WS_OVERLAPPEDWINDOW ),
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL
)


i = ShowWindow( hWnd, SW_MAXIMIZE )
i = UpdateWindow( hWnd )
do while( GetMessage (mesg, NULL, 0, 0) .NEQV. .FALSE.)
i = TranslateMessage( mesg )
i = DispatchMessage( mesg )
end do

WinMain = mesg%wParam
return
end function WinMain
!
integer*4 function MainWndProc ( hWnd, mesg, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'MainWndProc' :: MainWndProc
!DEC$ ENDIF

use Constant
use Toolbar

integer*4 hWnd

integer*4 mesg
integer*4 wParam
integer*4 lParam

!====================================================
interface
logical function DialogFunc ( hdWnd, mesg, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_DialogFunc@16' :: DialogFunc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'DialogFunc' :: DialogFunc
!DEC$ ENDIF

integer*4 hdWnd
integer*4 mesg
integer*4 wParam
integer*4 lParam
end function
end interface
!====================================================
integer*4 hdc, hRebar,Hbitmap1,dwBtnSize
type(t_REBARINFO) rbi
type(t_REBARBANDINFO) rbBand
select case ( mesg )
case(WM_CREATE)

call INITCOMMONCONTROLS()
hRebar=CreateWindowEx (0, &
"ReBarWindow32"C, &
"dsh", &
ior(ior(ior(ior(ws_visible,WS_child),WS_THICKFRAME),ior(WS_caption,ws_sysmenu)),ior(CCS_left,CCS_NOPARENTALIGN )),&
CW_USEDEFAULT,&
CW_USEDEFAULT,&
0,&
300,&
hWnd, &
ID_40001,&
hh, &
NULL)

call InitToolBar( )
Hbitmap1=LoadImage(hRebar,"toolbar1.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
hInst = CreateToolbarEx( hRebar, &
ior( ior(WS_VISIBLE ,WS_CHILD),tbstyle_wrapable),&
null, &
NumButton, &
null, &
Hbitmap1, &
tbrButtons, &
NumButton, &
35,35,0,0, &
sizeof(tbrButtons(1)))

results= MoveWindow(hRebar,50,50,100,100,TRUE)
case (WM_SIZE)
! hdc=SendMessage(hRebar, WM_SIZE, wParam, lParam)
! hdc=SendMessage(hInst, WM_SIZE, SIZE_RESTORED, lParam)
case( WM_COMMAND )
select case( wParam )
c ase( ID_40001 )
case( ID_40002 )
hdc=MessageBox(hWnd,"open","open",MB_OK)
case( ID_40003 )
hdc=MessageBox(hWnd,"save","save",MB_OK)
case( ID_40004 )
call PostQuitMessage( 0 )
end select
!case ( WM_SIZE )
! hdc=SendMessage(hInst,WM_SIZE,SIZE_RESTORED,iParam)
case ( WM_DESTROY )
call PostQuitMessage( 0 )
case default

MainWndProc = DefWindowProc( hWnd, mesg, wParam, lParam )
end select
return
end function MainWndProc
!
subroutine InitToolBar( )
use Constant
use Toolbar
integer j

j = ID_40001
do i = 1 ,NumButton
tbrButtons(i)%iBitmap = i-1
tbrButtons(i)%idCommand = j
tbrButtons(i)%fsState = TBSTATE_ENABLED
tbrButtons(i)%fsStyle = TBSTYLE_BUTTON
tbrButtons(i)%dwData = 0
tbrButtons(i)%iString = 0
j =j+1
enddo
return
end subroutine InitToolBar

0 Kudos
Jugoslav_Dujic
Valued Contributor II
598 Views
The same value of width as... ?

I'm not too familiar with rebars (I made a working one long time ago). Take a look on "common control styles" and "Rebar control styles" pages. I think you need one or more of CCS_VERT, RBS_VARHEIGHT and CCS_LEFT/CCS_RIGHT. CCS_NOPARENTALIGN should prevent it from auto-alignment.
0 Kudos
lm_lxt
Beginner
598 Views

Many thanks! I got the answers.

0 Kudos
Reply