I'm a bit new in development, so if my questions sound lame, please forgive me! ;)
I have this problem with using TBS_TOOLTIPS for a trackbar in a window App. Obviously, I'm using DevC++. I included commctrl.h and commdlg.h in the main.c.
I also linked to comctl32.lib in parameters option of my project. I also added the path of comctl32.lib in the list of lib directories. comctl32.dll is in system32 folder and I added its address in my compiler's options.
Still when I compile the code, I get the " TBS_TOOLTIPS undeclared " error. I commented out #if (_WIN32_IE >= 0x0300 ) and its corresponding #endif in commctrl.h. It works but after closing the window there is this error about referenced memory.
My questions are:
1- What does _WIN32_IE have to do with all this? ( IE is internet explorer right? )
2- How does system check IE version?
3- How can I find out what version of comctl32.dll I am using?
4- How can I fix my problem?
I would appreciate if someone could help me out with these questions.
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
main.c: In function CreatTool':
main.c:307: error:TBS_TOOLTIPS' undeclared (first use in this function)
main.c:307: error: (Each undeclared identifier is reported only once
main.c:307: error: for each function it appears in.)
main.c:332: error: `TBTS_RIGHT' undeclared (first use in this function)
make.exe: *** [main.o] Error 1
Execution terminated
My Questions:
1- What does _WIN32_IE have to do with all this? ( IE is internet explorer right? )
2- How does system check IE version?
3- How can I find out what version of comctl32.dll I am using?
4- How can I fix my problem?
Thanks everyone
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/ Make the class name into a global variable /
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
/* The Window structure */
wincl.hInstance=hThisInstance;
wincl.lpszClassName=szClassName;
wincl.lpfnWndProc=WindowProcedure;/* This function is called by windows */
wincl.style=CS_DBLCLKS;/* Catch double-clicks */
wincl.cbSize=sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */
wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wincl.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
wincl.lpszMenuName=NULL;/* No menu */
wincl.cbClsExtra=0;/* No extra bytes after the window class */
wincl.cbWndExtra=0;/* structure or the window instance *//* Use Windows's default color as the background of the window */
wincl.hbrBackground=(HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if(!RegisterClassEx(&wincl))return0;/* The class is registered, let's create the program*/
hwnd=CreateWindowEx(0,/* Extended possibilites for variation */szClassName,/* Classname */"WindowsApp",/* Title Text */WS_OVERLAPPEDWINDOW,/* default window */CW_USEDEFAULT,/* Windows decides the position */CW_USEDEFAULT,/* where the window ends up on the screen */544,/* The programs width */375,/* and height in pixels */HWND_DESKTOP,/* The window is a child-window to desktop */NULL,/* No menu */hThisInstance,/* Program Instance handler */NULL/* No Window Creation data */);/* Make the window visible on the screen */
ShowWindow(hwnd,nFunsterStil);
/****** **** Added ** ******/
INITCOMMONCONTROLSEX icex;
memset(&icex, 0x0, sizeof(INITCOMMONCONTROLSEX));
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC =
ICC_COOL_CLASSES | // Load the coolbar class.
ICC_BAR_CLASSES | // Load toolbar, status bar, track bar, and
// tooltips control classes.
// ICC_TREEVIEW_CLASSES | // Load tree view and tooltips control classes.
// ICC_DATE_CLASSES | // Load date and time picker control class.
// ICC_HOTKEY_CLASS | // Load hot-key control class.
// ICC_LISTVIEW_CLASSES | // Load list view and header control classes.
// ICC_PROGRESS_CLASS | // Load progress bar control class.
// ICC_TAB_CLASSES | // Load tab and tooltips control classes.
// ICC_ANIMATE_CLASS | // Load animate control class.
// ICC_UPDOWN_CLASS | // Load up-down control class.
// ICC_USEREX_CLASSES | // Load ComboBoxEx class.
// ICC_WIN95_CLASSES | // Load the animate control, header, hot-key,
// list view, progress bar, status bar, tab,
// tooltips, toolbar, track bar, tree view,
// and up-down control classes.
0; // allows commenting out styles
if(!(InitCommonControlsEx(&icex)))
{
MessageBox((HWND)NULL, "InitCommonControlsEx failed", "Error", MB_OK);
return FALSE;
}
/****** *END OF ADD **** *******/
/* Run the message loop. It will run until GetMessage() returns 0 */while(GetMessage(&messages,NULL,0,0)){/* Translate virtual-key messages into character messages */TranslateMessage(&messages);/* Send message to WindowProcedure */DispatchMessage(&messages);}/* The program return-value is 0 - The value that PostQuitMessage() gave */returnmessages.wParam;
}
/ This function is called by the Windows function DispatchMessage() /
Hi guys,
I'm a bit new in development, so if my questions sound lame, please forgive me! ;)
I have this problem with using TBS_TOOLTIPS for a trackbar in a window App. Obviously, I'm using DevC++. I included commctrl.h and commdlg.h in the main.c.
I also linked to comctl32.lib in parameters option of my project. I also added the path of comctl32.lib in the list of lib directories. comctl32.dll is in system32 folder and I added its address in my compiler's options.
Still when I compile the code, I get the " TBS_TOOLTIPS undeclared " error. I commented out #if (_WIN32_IE >= 0x0300 ) and its corresponding #endif in commctrl.h. It works but after closing the window there is this error about referenced memory.
My questions are:
1- What does _WIN32_IE have to do with all this? ( IE is internet explorer right? )
2- How does system check IE version?
3- How can I find out what version of comctl32.dll I am using?
4- How can I fix my problem?
I would appreciate if someone could help me out with these questions.
Cheers
Awesome, Thanks a lot BiT! That worked out well.
Ok, So after being harassed by Dr.Wayne (kidd'n! ;) ) I refine my post to this format:
DevC++ Format: 4.9.9.2
OS: Windows XP Pro SysPack2
Programming Language: C
Sample program:
/ initializing window structure /
...
/ registring window /
...
/ setting Max, Min, Range, TicFreq, etc /
Compiler log:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\keslami\My Documents\Haptic Belt\Makefile.win"
Executing make clean
rm -f main.o Haptic_Belt_private.res "Haptic Belt.exe"
gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include" -I"C:/Program Files/Microsoft Platform SDK/Include" -I"C:/Program Files/Microsoft Visual Studio/VC98/Include" -I"C:/Documents and Settings/keslami/My Documents/Haptic Belt" -I"C:/Documents and Settings/keslami/My Documents/Downloads/libusb-win32-device-bin-0.1.12.1/libusb-win32-device-bin-0.1.12.1/include" -I"C:/Dev-Cpp/include"
main.c: In function
CreatTool': main.c:307: error:
TBS_TOOLTIPS' undeclared (first use in this function)main.c:307: error: (Each undeclared identifier is reported only once
main.c:307: error: for each function it appears in.)
main.c:332: error: `TBTS_RIGHT' undeclared (first use in this function)
make.exe: *** [main.o] Error 1
Execution terminated
My Questions:
1- What does _WIN32_IE have to do with all this? ( IE is internet explorer right? )
2- How does system check IE version?
3- How can I find out what version of comctl32.dll I am using?
4- How can I fix my problem?
Thanks everyone
Search feature worked for me.
your library file should end with .a not .lib
Having spaces in the path is just asking for problems as well, lots of info on this in the boards here just have to search.
Start here and you should be able to get this resolved easily.
http://sourceforge.net/forum/message.php?msg_id=2486139
Version Information
http://msdn2.microsoft.com/en-us/library/bb776779(VS.85).aspx
Working Example. Used the template for windows application
/* CUT */
// in your project options add -lcomctl32
define _WIN32_IE 0x0600 //<-what you where probably missing
include <windows.h>
include <commctrl.h>
/ Declare Windows procedure /
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/ Make the class name into a global variable /
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
/******
**** Added **
******/
/******
*END OF ADD ****
*******/
}
/ This function is called by the Windows function DispatchMessage() /
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) / handle the messages /
{
/******
**** Added **
*******/
case WM_CREATE:
{
HWND sliderHwnd = CreateWindowEx( WS_EX_CLIENTEDGE, TRACKBAR_CLASS, "Front Controller",
WS_CHILD | WS_VISIBLE | TBS_TOOLTIPS, 0, 0, 255, 30, hwnd,
NULL, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); // no WM_CREATE parameter
}
break;
/*****
****END OF ADD ****
*****/
case WM_DESTROY:
PostQuitMessage (0); / send a WM_QUIT to the message queue /
break;
default: / for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
}
/ end cut /