Advertisement

Newbie got jammed over here and needs advice

Started by March 05, 2002 11:48 AM
12 comments, last by savagerx 22 years, 9 months ago
Hi, Recently I'm trying to use the common control ICC_BAR_CLASSES and found that there were some problems and several error msgs were generated. Thus, I referred to my guide book and did some amendment and even attempting to self-troubleshoot it. But still I got those errors. Therefore, exhausting all my available resources, I seek help from the programmers here. My instinct tells me that the marcos may be wrong. The affected source are pasted below:
      	cc.dwICC = ICC_BAR_CLASSES;
	cc.dwSize = sizeof(INITCOMMONCONTROLSEX);
	InitCommonControlsEx(&cc);
  

      
	InitButtons();
	tbwnd = CreateToolbarEx(hwnd,						WS_VISIBLE|WS_BORDER|TBSTYLE_TOOLTIPS|WS_CHILD,
							IDM_TOOLBAR,
							TOTALBUTTONS,
							hThisInst,
							MyBit,
							&Buttons,
							TOTALBUTTONS,
							16,16,
							16,16,
							sizeof(TBBUTTON));
  

      
void InitButtons(){

	Buttons[0].iBitmap = 0;
	Buttons[0].idCommand = IDM_OPEN;
	Buttons[0].fsState = TBSTATE_ENABLED;
	Buttons[0].fsStyle = BTNS_BUTTON;
	Buttons[0].dwData = OL;
	Buttons[0].iString = 0;


	Buttons[1].iBitmap = 3;
	Buttons[1].idCommand = IDM_SAVE;
	Buttons[1].fsState = TBSTATE_ENABLED;
	Buttons[1].fsStyle = BTNS_BUTTON;
	Buttons[1].dwData = OL;
	Buttons[1].iString = 0;


	Buttons[2].iBitmap = 1;
	Buttons[2].idCommand = IDM_UPPERCASE;
	Buttons[2].fsState = TBSTATE_ENABLED;
	Buttons[2].fsStyle = BTNS_BUTTON;
	Buttons[2].dwData = OL;
	Buttons[2].iString = 0;


	Buttons[3].iBitmap = 2;
	Buttons[3].idCommand = IDM_LOWERCASE;
	Buttons[3].fsState = TBSTATE_ENABLED;
	Buttons[3].fsStyle = BTNS_BUTTON;
	Buttons[3].dwData = OL;
	Buttons[3].iString = 0;


	Buttons[4].iBitmap = 0;
	Buttons[4].idCommand = 0;
	Buttons[4].fsState = TBSTATE_ENABLED;
	Buttons[4].fsStyle = BTNS_SEP;
	Buttons[4].dwData = OL;
	Buttons[4].iString = 0;


	Buttons[5].iBitmap = 4;
	Buttons[5].idCommand = IDM_HELP;
	Buttons[5].fsState = TBSTATE_ENABLED;
	Buttons[5].fsStyle = BTNS_BUTTON;
	Buttons[5].dwData = OL;
	Buttons[5].iString = 0;

}
  

Below is from my rc file
      
MyBit BITMAP TB_BITMAP.bmp
      
THE ERROR MESSAGE IS: --------------------Configuration: Practice023 - Win32 Debug-------------------- Compiling... Main.cpp c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(81) : error C2065: 'MyBit' : undeclared identifier c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(106) : error C2065: 'BTNS_BUTTON' : undeclared identifier c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(107) : error C2065: 'OL' : undeclared identifier c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(134) : error C2065: 'BTNS_SEP' : undeclared identifier Error executing cl.exe. Main.obj - 4 error(s), 0 warning(s) Pls help :'( P.S. Presume that the iBitmap field is correct. And at the mean time, I'll try again. Tkx The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant Edited by - savagerx on March 5, 2002 12:53:52 PM Edited by - savagerx on March 7, 2002 1:36:43 PM
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
Looks like you haven''t #included the resource header file (probably called resouce.h)
Advertisement
Okay, I found out that I may have not included the COMCTRL32.lib into my project, but how can I do so?

I am using VC++ 6.0

The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
Hi, I would like to enquire how do I add the library file COMCTL32.LIB to my project''s linker options. Tkx

I welcome any comments or walkthrough. Pls..

The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
OK, to add a file to the linker, do this:

-Goto ''Projects/Settings'' on the file menu.
-Select the ''link'' tab at the top of the dialog.
-In the ''settings for'' box (top left) select ''All Configarations''
-Now add ''COMCTRL32.LIB'' to the list of modules in the ''Object/Library Modules:'' text box. (don''t forget to have a space between the new module and any other modules already there).
-Now close the dialog, save your project and recompile.


Easy, Hope this works and fixes your problem.

- Weasalmongler


Sorry, but I''ve tried the advice and still, I got the errors:c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(106) : error C2065: ''BTNS_BUTTON'' : undeclared identifier
c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(107) : error C2065: ''OL'' : undeclared identifier
c:\documents and settings\administrator\desktop\tienseck\visual c++ files\practice023\main.cpp(134) : error C2065: ''BTNS_SEP'' : undeclared identifier

I wonder why Common Controls always have so much problems.



The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
Advertisement
This might help (but probably not).

You may want to try including the MFC header (I think that it is "afxwin.h", but I could be wrong). There is a tiny chance that this might fix your problem, but I''m not good with this sort of windows stuff.

Oh..just another thought, should ''OL'' actually be OL (I don''t know what OL is supposed to be) or should it be Zero L (or is it that already).

Oh, I give up, hope you fix your problems soon

-Weasalmongler
I think your syntax is wrong, a few typo''s, try something like this :

  static TBBUTTON  buttons[] = {    { 0, IDM_OPEN,   TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },    { 3, IDM_SAVE,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },    { 1, IDM_UPPERCASE,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },    { 2, IDM_LOWERCASE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },    { 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0 },    { 4, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },};  


,Jay
Oh Holy!
I can''t imagine that magic word really solved the problem.
But just for my info, why can''t I use the conventional way of initalizing the Buttons? Is there anything wrong with "OL" in the dwData field? The author didn''t explain much on that issue. It just told me to include the commctrl.h to my source and COMCTL32.LIB to my linker options.



Weasalmongler tkx

The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
I didn''t understand your last post. Did you fix the problem or do you want me to answer something? -Sorry.

-Weasalmongler

This topic is closed to new replies.

Advertisement