Advertisement
Guest User

Untitled

a guest
Sep 15th, 2010
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.74 KB | None | 0 0
  1. #include <windows.h>
  2. #include <Commctrl.h>
  3.  
  4. /*  Declare Windows procedure  */
  5. LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
  6.  
  7. /*  Make the class name into a global variable  */
  8. char szClassName[ ] = "WindowsApp";
  9.  
  10. int WINAPI WinMain (HINSTANCE hThisInstance,
  11.                     HINSTANCE hPrevInstance,
  12.                     LPSTR lpszArgument,
  13.                     int nFunsterStil)
  14.  
  15. {
  16.     HWND hwnd;               /* This is the handle for our window */
  17.     MSG messages;            /* Here messages to the application are saved */
  18.     WNDCLASSEX wincl;        /* Data structure for the windowclass */
  19.     HWND film;
  20.  
  21.     /* The Window structure */
  22.     wincl.hInstance = hThisInstance;
  23.     wincl.lpszClassName = szClassName;
  24.     wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
  25.     wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
  26.     wincl.cbSize = sizeof (WNDCLASSEX);
  27.  
  28.     /* Use default icon and mouse-pointer */
  29.     wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
  30.     wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
  31.     wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
  32.     wincl.lpszMenuName = NULL;                 /* No menu */
  33.     wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
  34.     wincl.cbWndExtra = 0;                      /* structure or the window instance */
  35.     /* Use Windows's default color as the background of the window */
  36.     wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
  37.  
  38.     /* Register the window class, and if it fails quit the program */
  39.     if (!RegisterClassEx (&wincl))
  40.         return 0;
  41.  
  42.     /* The class is registered, let's create the program*/
  43.     hwnd = CreateWindowEx (
  44.            0,                   /* Extended possibilites for variation */
  45.            szClassName,         /* Classname */
  46.            "Windows App",       /* Title Text */
  47.            WS_OVERLAPPEDWINDOW, /* default window */
  48.            CW_USEDEFAULT,       /* Windows decides the position */
  49.            CW_USEDEFAULT,       /* where the window ends up on the screen */
  50.            544,                 /* The programs width */
  51.            375,                 /* and height in pixels */
  52.            HWND_DESKTOP,        /* The window is a child-window to desktop */
  53.            NULL,                /* No menu */
  54.            hThisInstance,       /* Program Instance handler */
  55.            NULL                 /* No Window Creation data */
  56.            );
  57.  
  58.     /* Make the window visible on the screen */
  59.     ShowWindow (hwnd, nFunsterStil);
  60.    
  61.     film = Animate_Create(hwnd, 10, WS_CHILD | WS_VISIBLE | ACS_AUTOPLAY, hThisInstance);
  62.    
  63.     Animate_OpenEx(film, hThisInstance, "a.avi");
  64.    
  65.     Animate_Play(film, 0, -1, 1);
  66.    
  67.     Animate_Stop(film);
  68.  
  69.     /* Run the message loop. It will run until GetMessage() returns 0 */
  70.     while (GetMessage (&messages, NULL, 0, 0))
  71.     {
  72.         /* Translate virtual-key messages into character messages */
  73.         TranslateMessage(&messages);
  74.         /* Send message to WindowProcedure */
  75.         DispatchMessage(&messages);
  76.     }
  77.  
  78.     /* The program return-value is 0 - The value that PostQuitMessage() gave */
  79.     return messages.wParam;
  80. }
  81.  
  82.  
  83. /*  This function is called by the Windows function DispatchMessage()  */
  84.  
  85. LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  86. {
  87.     switch (message)                  /* handle the messages */
  88.     {
  89.         case WM_DESTROY:
  90.             PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
  91.             break;
  92.         default:                      /* for messages that we don't deal with */
  93.             return DefWindowProc (hwnd, message, wParam, lParam);
  94.     }
  95.  
  96.     return 0;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement