I am having problems linking to Comctl32.dll used for the common control API. How do I go about importing the information from the file?
This is a discussion on Initializing My Control within the Windows Programming forums, part of the Platform Specific Boards category; I am having problems linking to Comctl32.dll used for the common control API. How do I go about importing the ...
I am having problems linking to Comctl32.dll used for the common control API. How do I go about importing the information from the file?
Last edited by ElWhapo; 03-31-2005 at 12:03 AM.
Did you link to the lib file?
Also to ensure that the compiler links the lib file you should call InitCommonControls or InitCommonControlsEx
Last edited by Quantum1024; 03-31-2005 at 12:10 AM.
I am using InitCommonControlsEx. I am unsure how to link to the lib file. That is the problem I'm having.
You can do it with this
or if your using devc++ I think the library is named COMCTL32.ACode:#pragma comment(lib,"COMCTL32.LIB").
It still does not recognize my common control functions. What am I doing wrong?
Code:// Example Shows How To Create A Basic Animation Control #include <windows.h> #pragma comment(lib,"COMCTL32.LIB") #define WIDTH 500 #define HEIGHT 350 void CreateMyWindow(); LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void CreateMyAnimation(); void InitializeMyCommonControls(); char szClassName[ ] = "Animation"; HWND hWnd; HINSTANCE hInstance; HWND hWndAnim; // Main Window Procedure int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR iCmdLine, int iCmdShow) { CreateMyWindow(); ShowWindow(hWnd, iCmdShow); MSG Msg; while (GetMessage (&Msg, NULL, 0, 0)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } // Message Queue Procedure LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_CREATE: InitializeMyCommonControls(); CreateMyAnimation(); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, Msg, wParam, lParam); } return 0; } // Animation Control Creation Procedure void CreateMyAnimation() { hWndAnim = Animate_Create(hWnd, 1, WS_BORDER | WS_CHILD, hInstance); } // Initialization of Common Controls Procedure void InitializeMyCommonControls() { LPINITCOMMONCONTROLSEX lpInitCommonControlsEx; lpInitCommonControlsEx.dwSize = (LPINITCOMMONCONTROLSEX); lpInitCommonControlsEx.dwICC = ICC_ANIMATE_CLASS; InitCommonControlsEx(lpInitCommonControlsEx); } // Window Creation Procedure void CreateMyWindow() { WNDCLASSEX wndClassEx; wndClassEx.cbSize = sizeof(WNDCLASSEX); wndClassEx.style = CS_HREDRAW | CS_VREDRAW; wndClassEx.lpfnWndProc = WndProc; wndClassEx.cbClsExtra = 0; wndClassEx.cbWndExtra = 0; wndClassEx.hInstance = hInstance; wndClassEx.hIcon = LoadIcon(NULL, IDI_WINLOGO); wndClassEx.hCursor = LoadCursor(NULL, IDC_ARROW); wndClassEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wndClassEx.lpszMenuName = 0; wndClassEx.lpszClassName = szClassName; wndClassEx.hIconSm = LoadIcon(NULL, IDI_WINLOGO); RegisterClassEx(&wndClassEx); hWnd = CreateWindowEx(0, szClassName, "Animation Control", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WIDTH, HEIGHT, 0, 0, hInstance, 0); }
Last edited by ElWhapo; 03-31-2005 at 09:09 AM.
You also need to include the header file.
Code:#include <COMMCTRL.H>
Thanks I got it now.