CreateToolbarEx is falling

hi all , I just write a simple program in windows to create a tool bar using the
CreateToolbarEx () function . This is the code that I writes to Call the CreateToolBarEx() , it fails and the Error is an Access violation. Any ideas How to correct this ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
	HINSTANCE hinst =hInstance; 

	HWND toolBar = 
		CreateToolbarEx( hwnd , WS_VISIBLE |WS_CHILD | WS_BORDER ,
		103 ,
		45 ,
		hinst ,
		103 ,
		tbrButtons , 
		7,
		40 , 40 , 
		360 ,
		200 ,
		sizeof( TBBUTTON ) ) ;



where the 103 is the resource ID of the bitmap that I include to the programs exe's resource table. Any idea about how should I fix this error ?
At first glance, does your tbrButtons pointer point to a valid TBBUTTON structure (in other words is it correctly initialised?)
yes guestgulkan it is ,

This is the code for that ,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	
	INITCOMMONCONTROLSEX InitCtrlEx ;
	InitCtrlEx.dwSize = sizeof (INITCOMMONCONTROLSEX);
	InitCtrlEx.dwICC = ICC_BAR_CLASSES;
	InitCommonControlsEx( &InitCtrlEx) ;

	TBBUTTON tbrButtons [7];

	tbrButtons[0].iBitmap = 0 ;
	tbrButtons[0].idCommand = NULL  ;
	tbrButtons[0].fsState = TBSTATE_ENABLED ;
	tbrButtons[0].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[0].dwData = 0L ;
	tbrButtons[0].iString = 0 ;

	tbrButtons[1].iBitmap = 1;
	tbrButtons[1].dwData = 0L ;
	tbrButtons[1].idCommand = NULL ;
	tbrButtons[1].fsState = TBSTATE_ENABLED ;
	tbrButtons[1].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[1].iString = 0 ;

	tbrButtons [2].iBitmap = 2 ;
	tbrButtons [2].dwData = 0L ;
	tbrButtons [2].fsState = TBSTATE_ENABLED ;
	tbrButtons [2].fsStyle = TBSTYLE_BUTTON  ;
	tbrButtons [2].idCommand = NULL ;
	tbrButtons [2].iString = 0 ;

	tbrButtons[3].dwData = 0L ;
	tbrButtons[3].fsState = TBSTATE_ENABLED ;
	tbrButtons[3].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[3].iBitmap = 3 ;
	tbrButtons[3].idCommand = NULL ;
	tbrButtons[3].iString = 0 ;

	tbrButtons[4].dwData = 0L ;
	tbrButtons[4].fsState = TBSTATE_ENABLED ;
	tbrButtons[4].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[4].iBitmap = 4 ;
	tbrButtons[4].idCommand = NULL ;
	tbrButtons[4].iString =  0 ;

	tbrButtons[5].dwData = 0L ;
	tbrButtons[5].fsState = TBSTATE_ENABLED ;
	tbrButtons[5].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[5].iBitmap = 5 ;
	tbrButtons[5].idCommand = 0 ;
	tbrButtons[5].idCommand = NULL ;

	tbrButtons[6].dwData = 0L ;
	tbrButtons[6].fsState = TBSTATE_ENABLED ;
	tbrButtons[6].fsStyle = TBSTYLE_BUTTON ;
	tbrButtons[6].iBitmap = 6 ;
	tbrButtons[6].idCommand = NULL ;
	tbrButtons[6].iString = 0 ;


I think the error is comming from the number 103 , really I confused about those resources and it's ID value.Any idea to read something on resources ?
and how it mapped using the resource.h helder file into the C++ code ?
hi let me clear this more ,
[img]
http://img374.imageshack.us/img374/1880/createtoolbarexerrorzz9.png
[/img]

* Edit before that resource id is 103 , but before I remove it and adds again now it is 109 ,

and that is the number that I used there,
1
2
3
4
5
6
7
8
9
10
11
12
13
HWND toolBar = 
		CreateToolbarEx( hwnd , WS_VISIBLE |WS_CHILD | WS_BORDER ,
		103 , // <--- that number
		45 ,
		hinst ,
		103 ,  // <-- that number 
		tbrButtons , 
		7,
		40 , 40 , 
		360 ,
		200 ,
		sizeof( TBBUTTON ) ) ;


Am i correct ?
hi all , I debug the program and try to find out the error.
after the function fail I hat @err,hr at the watch window. and I got this

0x00000008 Not enoughf storage is aviliable to process this command.

what that means ? How can I fix this . Did you have other than this CreateToolbarEx example please let me know.
It's been a whle since I did stuff like this.
What program are you using (microsoft visual studio) ?

I see what I can do -
Yes I am using the visual Studio 6.0 , but I also using a Resource viewer program for view the resource numbers . I don't use that #include "resources.h"
helder file to get the Resource constraint numbers. Instead of I see from that
Resource viewer and put these numbers there.

I have wrote that application using the CreateWindowEx ,and it works loads the images to the buttons properly , But the problem there is I cannot change the height and width values of those buttons.

anyway CreateToolbarEx is failling ... the error is
0x00000008 Not enoughf storage is aviliable to process this command.

and I don't know what to do with that CreateToolbarEx function :(
Topic archived. No new replies allowed.