개요. MFC Animation Control | |||||||||||||||||||||||
Animation Control 은 AVI 파일 오픈하여 비디오만 재생가능한 컨트롤. AVI 파일내의 오디오 재생못함. 주용도 : 통상 프로그램에서 간단한 애니메이션 표현하고 싶을 때 AVI파일 오픈하여 플레이 하는 용도. Toolbox 에서 대화상자로 배치시켜서 사용. CAnimateCtrl Class For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation. Provides the functionality of the Windows common animation control. class CAnimateCtrl : public CWnd Public Constructors
Public Methods
This control (and therefore the An animation control is a rectangular window that displays a clip in AVI (Audio Video Interleaved) format— the standard Windows video/audio format. An AVI clip is a series of bitmap frames, like a movie. Animation controls can play only simple AVI clips. Specifically, the clips to be played by an animation control must meet the following requirements:
You can add the AVI clip to your application as an AVI resource, or it can accompany your application as a separate AVI file. Because your thread continues executing while the AVI clip is displayed, one common use for an animation control is to indicate system activity during a lengthy operation. For example, the Find dialog box of File Explorer displays a moving magnifying glass as the system searches for a file. If you create a If you create a For more information on using
Header: afxcmn.h Constructs a CAnimateCtrl(); RemarksYou must call the Create member function before you can perform any other operations on the object you create. ExampleC++ // This example creates a secondary thread that implements // the methods of CAnimateCtrl. The procedure of the thread // is MyClipThreadProc and the thread was created with the // code AfxBeginThread( MyClipThreadProc, (LPVOID) pParentWnd). // The example code creates and initializes an animation control, // then proceeds to pump messages from the queue until one the // private messages WM_STOPCLIP, WM_PLAYCLIP, WM_SHOWFIRSTFRAME or // WM_SHOWLASTFRAME is received. The appropriate action is done for // these messages. The thread ends when the WM_STOPCLIP is received. // NOTE: the thread parameter, pParam, is a pointer to a CWnd object // that will be the parent of the animation control. #define WM_STOPCLIP WM_USER+1 #define WM_PLAYCLIP WM_USER+2 #define WM_SHOWFIRSTFRAME WM_USER+3 #define WM_SHOWLASTFRAME WM_USER+4 UINT MyClipThreadProc(LPVOID pParam) { // NOTE: pParentWnd is the parent window of the animation control. CWnd* pParentWnd = (CWnd*) pParam; CAnimateCtrl cAnimCtrl; // Create the animation control. if (!cAnimCtrl.Create(WS_CHILD|WS_VISIBLE|ACS_CENTER, CRect(10,10,100,100), pParentWnd, 1)) { return false; } // Open the AVI file. if (!cAnimCtrl.Open(_T("MyAvi.avi"))) { return false; } // Pump message from the queue until the stop play message is received. MSG msg; while (GetMessage(&msg, NULL, 0, 0) && (msg.message != WM_STOPCLIP)) { switch (msg.message) { // Start playing from the first frame to the last, // continuously repeating. case WM_PLAYCLIP: if (!cAnimCtrl.Play(0, (UINT)-1, (UINT)-1)) return false; break; // Show the first frame. case WM_SHOWFIRSTFRAME: if (!cAnimCtrl.Seek(0)) return false; cAnimCtrl.RedrawWindow(); break; // Show the last frame. case WM_SHOWLASTFRAME: if (!cAnimCtrl.Seek((UINT)-1)) return false; cAnimCtrl.RedrawWindow(); break; } TranslateMessage(&msg); DispatchMessage(&msg); } cAnimCtrl.Stop(); cAnimCtrl.Close(); return true; } Closes the AVI clip that was previously opened in the animation control (if any) and removes it from memory. BOOL Close(); Return ValueNonzero if successful; otherwise zero. ExampleSee the example for CAnimateCtrl::CAnimateCtrl. Creates an animation control and attaches it to a virtual BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); Parameters
Return ValueNonzero if successful; otherwise zero. RemarksYou construct a Apply the following window styles to an animation control.
If you want to use extended windows styles with your animation control, call CreateEx instead of Create. In addition to the window styles listed above, you may want to apply one or more of the animation control styles to an animation control. See the Windows SDK for more information on animation control styles. ExampleSee the example for CAnimateCtrl::CAnimateCtrl. Creates a control (a child window) and associates it with the virtual BOOL CreateEx( DWORD dwExStyle, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); Parameters
Return ValueNonzero if successful; otherwise 0. RemarksUse Indicates whether an Audio-Video Interleaved (AVI) clip is playing. BOOL IsPlaying() const; Return Value
RemarksThis method sends the ACM_ISPLAYING message, which is described in the Windows SDK. Call this function to open an AVI clip and display its first frame. BOOL Open(LPCTSTR lpszFileName); BOOL Open(UINT nID); Parameters
Return ValueNonzero if successful; otherwise zero. RemarksThe AVI resource is loaded from the module that created the animation control. Open does not support sound in an AVI clip; you can open only silent AVI clips. If the animation control has the If the animation control has the If the animation control has the ExampleSee the example for CAnimateCtrl::CAnimateCtrl. Call this function to play an AVI clip in an animation control. BOOL Play( UINT nFrom, UINT nTo, UINT nRep); Parameters
nRep Return ValueNonzero if successful; otherwise zero. RemarksThe animation control will play the clip in the background while your thread continues executing. If the animation control has ExampleSee the example for CAnimateCtrl::CAnimateCtrl. Call this function to statically display a single frame of your AVI clip. BOOL Seek(UINT nTo); Parameters
Return ValueNonzero if successful; otherwise zero. RemarksIf the animation control has ExampleSee the example for CAnimateCtrl::CAnimateCtrl. Call this function to stop playing an AVI clip in an animation control. BOOL Stop(); Return ValueNonzero if successful; otherwise zero. ExampleSee the example for CAnimateCtrl::CAnimateCtrl. from : https://msdn.microsoft.com/en-us/library/z44k3stc.aspx | |||||||||||||||||||||||
|
'VisualStudio.C++.C# > 코딩팁,함수활용,단편' 카테고리의 다른 글
WM_USER, WM_APP. 메시지 번호 범위 용도. (0) | 2017.04.06 |
---|---|
SendNotifyMessage. (0) | 2017.04.06 |
error LNK2001: unresolved external symbol __imp_sprintf, symbol __imp_printf 해결방법. (0) | 2017.03.19 |
Delay Loading DLL (0) | 2017.03.17 |
AddDllDirectory (0) | 2017.03.17 |
댓글