4 * Copyright 1998, 1999 Eric Kohl
7 * This is just a dummy control. An author is needed! Any volunteers?
8 * I will only improve this control once in a while.
9 * Eric <ekohl@abo.rhein-zeitung.de>
13 * - All notifications.
22 #define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO *)GetWindowLongA (hwnd, 0))
26 ANIMATE_LoadResA (ANIMATE_INFO
*infoPtr
, HINSTANCE hInst
, LPSTR lpName
)
31 hrsrc
= FindResourceA (hInst
, lpName
, "AVI");
35 handle
= LoadResource (hInst
, hrsrc
);
39 infoPtr
->lpAvi
= LockResource (handle
);
48 ANIMATE_LoadFileA (ANIMATE_INFO
*infoPtr
, LPSTR lpName
)
53 CreateFileA (lpName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
54 FILE_ATTRIBUTE_NORMAL
, 0);
59 CreateFileMappingA (infoPtr
->hFile
, NULL
, PAGE_READONLY
| SEC_COMMIT
,
62 CloseHandle (infoPtr
->hFile
);
67 infoPtr
->lpAvi
= MapViewOfFile (handle
, FILE_MAP_READ
, 0, 0, 0);
68 if (!infoPtr
->lpAvi
) {
69 CloseHandle (infoPtr
->hFile
);
79 ANIMATE_Free (ANIMATE_INFO
*infoPtr
)
82 UnmapViewOfFile (infoPtr
->lpAvi
);
83 CloseHandle (infoPtr
->hFile
);
84 infoPtr
->lpAvi
= NULL
;
87 GlobalFree ((HGLOBAL
)infoPtr
->lpAvi
);
88 infoPtr
->lpAvi
= NULL
;
94 ANIMATE_GetAviInfo (infoPtr
)
102 ANIMATE_OpenA (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
104 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(hwnd
);
105 HINSTANCE hInstance
= (HINSTANCE
)wParam
;
107 ANIMATE_Free (infoPtr
);
110 TRACE (animate
, "closing avi!\n");
114 if (HIWORD(lParam
)) {
115 FIXME (animate
, "(\"%s\") empty stub!\n", (LPSTR
)lParam
);
117 if (ANIMATE_LoadResA (infoPtr
, hInstance
, (LPSTR
)lParam
)) {
119 FIXME (animate
, "AVI resource found!\n");
123 FIXME (animate
, "No AVI resource found!\n");
124 if (ANIMATE_LoadFileA (infoPtr
, (LPSTR
)lParam
)) {
125 FIXME (animate
, "AVI file found!\n");
128 FIXME (animate
, "No AVI file found!\n");
134 FIXME (animate
, "(%u) empty stub!\n", (WORD
)LOWORD(lParam
));
136 if (ANIMATE_LoadResA (infoPtr
, hInstance
,
137 MAKEINTRESOURCEA((INT
)lParam
))) {
138 FIXME (animate
, "AVI resource found!\n");
141 FIXME (animate
, "No AVI resource found!\n");
146 ANIMATE_GetAviInfo (infoPtr
);
152 /* << ANIMATE_Open32W >> */
156 ANIMATE_Play (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
158 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
159 INT nFrom
= (INT
)LOWORD(lParam
);
160 INT nTo
= (INT
)HIWORD(lParam
);
161 INT nRepeat
= (INT
)wParam
;
171 FIXME (animate
, "(loop from=%d to=%d) empty stub!\n",
177 FIXME (animate
, "(repeat=%d from=%d to=%d) empty stub!\n",
178 nRepeat
, nFrom
, nTo
);
188 ANIMATE_Stop (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
190 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
204 ANIMATE_Create (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
206 ANIMATE_INFO
*infoPtr
;
208 /* allocate memory for info structure */
209 infoPtr
= (ANIMATE_INFO
*)COMCTL32_Alloc (sizeof(ANIMATE_INFO
));
211 ERR (animate
, "could not allocate info memory!\n");
215 /* store pointer to info structure */
216 SetWindowLongA (hwnd
, 0, (DWORD
)infoPtr
);
219 /* set default settings */
227 ANIMATE_Destroy (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
229 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(hwnd
);
233 ANIMATE_Free (infoPtr
);
235 /* free animate info data */
236 COMCTL32_Free (infoPtr
);
244 ANIMATE_EraseBackground (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
246 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(hwnd
);
248 HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
251 GetClientRect32 (wndPtr->hwndSelf, &rect);
252 FillRect32 ((HDC32)wParam, &rect, hBrush);
253 DeleteObject32 (hBrush);
262 ANIMATE_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
267 return ANIMATE_OpenA (hwnd
, wParam
, lParam
);
269 /* case ACM_OPEN32W: */
270 /* return ANIMATE_Open32W (hwnd, wParam, lParam); */
273 return ANIMATE_Play (hwnd
, wParam
, lParam
);
276 return ANIMATE_Stop (hwnd
, wParam
, lParam
);
280 return ANIMATE_Create (hwnd
, wParam
, lParam
);
283 return ANIMATE_Destroy (hwnd
, wParam
, lParam
);
285 /* case WM_ERASEBKGND: */
286 /* return ANIMATE_EraseBackground (hwnd, wParam, lParam); */
288 /* case WM_NCCREATE: */
289 /* case WM_NCHITTEST: */
292 /* case WM_STYLECHANGED: */
297 ERR (animate
, "unknown msg %04x wp=%08x lp=%08lx\n",
298 uMsg
, wParam
, lParam
);
299 return DefWindowProcA (hwnd
, uMsg
, wParam
, lParam
);
306 ANIMATE_Register (VOID
)
310 if (GlobalFindAtomA (ANIMATE_CLASSA
)) return;
312 ZeroMemory (&wndClass
, sizeof(WNDCLASSA
));
313 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
314 wndClass
.lpfnWndProc
= (WNDPROC
)ANIMATE_WindowProc
;
315 wndClass
.cbClsExtra
= 0;
316 wndClass
.cbWndExtra
= sizeof(ANIMATE_INFO
*);
317 wndClass
.hCursor
= LoadCursorA (0, IDC_ARROWA
);
318 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
319 wndClass
.lpszClassName
= ANIMATE_CLASSA
;
321 RegisterClassA (&wndClass
);
326 ANIMATE_Unregister (VOID
)
328 if (GlobalFindAtomA (ANIMATE_CLASSA
))
329 UnregisterClassA (ANIMATE_CLASSA
, (HINSTANCE
)NULL
);