It seems as there has been an important change on these controls. After googling for solutions, I have posted this question at stackoverflow:
http://stackoverflow.com/questions/16099680/sysanimate32-on-windows-7-and-8
- Code: Select all Expand view
- #include <windows.h>
#include <CommCtrl.h>
HINSTANCE hInstance;
#define IDC_MYANIMATE 9
HWND CreateAnimationControl( HWND hParent )
{
HWND hAnimation = Animate_Create( hParent, IDC_MYANIMATE, ACS_AUTOPLAY | WS_BORDER | WS_CHILD | WS_VISIBLE, hInstance);
if( ! Animate_Open( hAnimation, "test.avi" ) )
MessageBox( 0, "can't open the video", "warning", MB_ICONINFORMATION );
return hAnimation;
}
LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
static HWND hAnimation = NULL;
switch (uiMsg)
{
case WM_DESTROY:
PostQuitMessage( 0 );
break;
case WM_CREATE:
hAnimation = CreateAnimationControl( hWnd );
break;
case WM_SHOWWINDOW:
if( wParam )
{
MoveWindow( hAnimation, 0, 0, 300, 300, TRUE );
Animate_Play( hAnimation, 0, -1, -1 );
}
break;
}
return DefWindowProc( hWnd, uiMsg, wParam, lParam );
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpsCmdLine, int iCmdShow )
{
WNDCLASSEX WindowClass;
HWND hWnd;
MSG uMsg;
hInstance = GetModuleHandle (NULL);
WindowClass.cbClsExtra = 0;
WindowClass.cbSize = sizeof( WNDCLASSEX );
WindowClass.cbWndExtra = 0;
WindowClass.hbrBackground = CreateSolidBrush( RGB( 0, 0, 180 ) );
WindowClass.hCursor = LoadCursor( NULL, IDC_ARROW );
WindowClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
WindowClass.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
WindowClass.hInstance = hInstance;
WindowClass.lpfnWndProc = WindowProcedure;
WindowClass.lpszClassName = "1";
WindowClass.lpszMenuName = NULL;
WindowClass.style = 0;
if( ! RegisterClassEx( &WindowClass ) )
{
MessageBox (NULL, "Window class registration has failed!", "Error:", MB_OK | MB_ICONERROR);
return 0;
}
hWnd = CreateWindow( "1", "Win32 Animation Testing", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,
hInstance, NULL);
if( ! hWnd )
{
MessageBox (NULL, "Window creation has failed!", "Error:", MB_OK | MB_ICONERROR);
return 0;
}
ShowWindow( hWnd, SW_SHOW );
UpdateWindow( hWnd );
while( GetMessage( &uMsg, NULL, 0, 0 ) > 0 )
{
TranslateMessage( &uMsg );
DispatchMessage ( &uMsg );
}
return ( int ) uMsg.wParam;
}
to build it:
set path=c:\bcc582\bin
bcc32 -W test.c