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);
}