home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / TxtPlayer / app.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  7.1 KB  |  420 lines

  1. //------------------------------------------------------------------------------
  2. // File: app.h
  3. //
  4. // Desc: DirectShow sample code - header file for TxtPlayer sample
  5. //
  6. // Copyright (c) 1994 - 2001, Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9. /* -------------------------------------------------------------------------
  10. ** Function prototypes
  11. ** -------------------------------------------------------------------------
  12. */
  13. int
  14. DoMainLoop(
  15.     void
  16.     );
  17.  
  18. BOOL
  19. InitApplication(
  20.     HINSTANCE hInstance
  21.     );
  22.  
  23. BOOL
  24. InitInstance(
  25.     HINSTANCE hInstance,
  26.     int nCmdShow
  27.     );
  28.  
  29. BOOL
  30. LoadWindowPos(
  31.     LPRECT lprc
  32.     );
  33.  
  34. BOOL
  35. SaveWindowPos(
  36.     HWND hwnd
  37.     );
  38.  
  39. void
  40. PatB(
  41.     HDC hdc,
  42.     int x,
  43.     int y,
  44.     int dx,
  45.     int dy,
  46.     DWORD rgb
  47.     );
  48.  
  49. void
  50. UpdateMpegMovieRect(
  51.     void
  52.     );
  53.  
  54. void
  55. GetAdjustedClientRect(
  56.     RECT *prc
  57.     );
  58.  
  59. BOOL
  60. DrawStats(
  61.     HDC hdc
  62.     );
  63.  
  64. void
  65. CalcMovieRect(
  66.     LPRECT lprc
  67.     );
  68.  
  69. LPCTSTR
  70. IdStr(
  71.     int idResource
  72.     );
  73.  
  74. void
  75. UpdateSystemColors(
  76.     void
  77.     );
  78.  
  79. void
  80. SetDurationLength(
  81.     REFTIME rt
  82.     );
  83.  
  84. void
  85. SetCurrentPosition(
  86.     REFTIME rt
  87.     );
  88.  
  89. TCHAR *
  90. FormatRefTime(
  91.     TCHAR *sz,
  92.     REFTIME rt
  93.     );
  94.  
  95. void
  96. DoMpegVideoPropertyPage();
  97.  
  98. void
  99. DoMpegAudioPropertyPage();
  100.  
  101. /* -------------------------------------------------------------------------
  102. ** Registry stuff
  103. ** -------------------------------------------------------------------------
  104. */
  105. int
  106. ProfileIntIn(
  107.    const TCHAR *szKey,
  108.    int iDefault
  109.    );
  110.  
  111. BOOL
  112. ProfileIntOut(
  113.    const TCHAR *szKey,
  114.    int iDefault
  115.    );
  116.  
  117. void
  118. ProfileStringOut (
  119.     LPTSTR  szKey,
  120.     LPTSTR  sz
  121.     );
  122.  
  123. UINT
  124. ProfileStringIn (
  125.     LPTSTR  szKey,
  126.     LPTSTR  szDef,
  127.     LPTSTR  sz,
  128.     DWORD   cb
  129.     );
  130.  
  131. BOOL
  132. LoadWindowPos(
  133.     LPRECT lprc
  134.     );
  135.  
  136. BOOL
  137. SaveWindowPos(
  138.     HWND hwnd
  139.     );
  140.  
  141. HKEY
  142. GetAppKey(
  143.     BOOL fCreate
  144.     );
  145.  
  146.  
  147. /* -------------------------------------------------------------------------
  148. ** Message crackers
  149. ** -------------------------------------------------------------------------
  150. */
  151. /* void Cls_OnUser(HWND hwnd, WPARAM wParam, LPARAM lParam ) */
  152. #define HANDLE_WM_USER(hwnd, wParam, lParam, fn) \
  153.     ((fn)(hwnd, wParam, lParam), 0L)
  154.  
  155. #ifndef HANDLE_WM_NOTIFY
  156. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  157. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  158.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  159. #endif
  160.  
  161.  
  162. /* -------------------------------------------------------------------------
  163. ** VideoCd window class prototypes
  164. ** -------------------------------------------------------------------------
  165. */
  166. extern "C" LRESULT CALLBACK
  167. VideoCdWndProc(
  168.     HWND hwnd,
  169.     UINT message,
  170.     WPARAM wParam,
  171.     LPARAM lParam
  172.     );
  173.  
  174. void
  175. VideoCd_OnClose(
  176.     HWND hwnd
  177.     );
  178.  
  179. BOOL
  180. VideoCd_OnQueryEndSession(
  181.     HWND hwnd
  182.     );
  183.  
  184. void
  185. VideoCd_OnDestroy(
  186.     HWND hwnd
  187.     );
  188.  
  189. void
  190. VideoCd_OnCommand(
  191.     HWND hwnd,
  192.     int id,
  193.     HWND hwndCtl,
  194.     UINT codeNotify
  195.     );
  196.  
  197. void
  198. VideoCd_OnPaint(
  199.     HWND hwnd
  200.     );
  201.  
  202. void
  203. VideoCd_OnTimer(
  204.     HWND hwnd,
  205.     UINT id
  206.     );
  207.  
  208. BOOL
  209. VideoCd_OnCreate(
  210.     HWND hwnd,
  211.     LPCREATESTRUCT lpCreateStruct
  212.     );
  213.  
  214. void
  215. VideoCd_OnSize(
  216.     HWND hwnd,
  217.     UINT state,
  218.     int cx,
  219.     int cy
  220.     );
  221.  
  222. void
  223. VideoCd_OnActivate(
  224.     HWND hwnd,
  225.     WPARAM wParam,
  226.     LPARAM lParam
  227.     );
  228.  
  229. void
  230. VideoCd_OnHScroll(
  231.     HWND hwnd,
  232.     HWND hwndCtl,
  233.     UINT code,
  234.     int pos
  235.     );
  236.  
  237. void
  238. VideoCd_OnUser(
  239.     HWND hwnd,
  240.     WPARAM wParam,
  241.     LPARAM lParam
  242.     );
  243.  
  244. void
  245. VideoCd_OnSysColorChange(
  246.     HWND hwnd
  247.     );
  248.  
  249. void
  250. VideoCd_OnMenuSelect(
  251.     HWND hwnd,
  252.     HMENU hmenu,
  253.     int item,
  254.     HMENU hmenuPopup,
  255.     UINT flags
  256.     );
  257.  
  258. void
  259. VideoCd_OnInitMenuPopup(
  260.     HWND hwnd,
  261.     HMENU hMenu,
  262.     UINT item,
  263.     BOOL fSystemMenu
  264.     );
  265.  
  266. #ifdef WM_NOTIFY
  267. LRESULT
  268. VideoCd_OnNotify(
  269.     HWND hwnd,
  270.     int idFrom,
  271.     NMHDR FAR* pnmhdr
  272.     );
  273. #endif
  274.  
  275.  
  276. void
  277. VideoCd_OnGraphNotify(
  278.     void
  279.     );
  280.  
  281. void
  282. VideoCd_OnDropFiles(
  283.     HWND hwnd,
  284.     HDROP hdrop);
  285.  
  286. void
  287. SetPlayButtonsEnableState(
  288.     void
  289.     );
  290.  
  291.  
  292. /* -------------------------------------------------------------------------
  293. ** Command processing functions
  294. ** -------------------------------------------------------------------------
  295. */
  296.  
  297. BOOL
  298. VcdPlayerOpenCmd(
  299.     void
  300.     );
  301.  
  302. BOOL
  303. VcdPlayerCloseCmd(
  304.     void
  305.     );
  306.  
  307. BOOL
  308. VcdPlayerPlayCmd(
  309.     void
  310.     );
  311.  
  312. BOOL
  313. VcdPlayerRewindCmd(
  314.     void
  315.     );
  316.  
  317. BOOL
  318. VcdPlayerStopCmd(
  319.     void
  320.     );
  321.  
  322. BOOL
  323. VcdPlayerPauseCmd(
  324.     void
  325.     );
  326.  
  327. BOOL
  328. VcdPlayerStepCmd(
  329.     void
  330.     );
  331.  
  332. void
  333. VcdPlayerSeekCmd(
  334.     REFTIME rtSeekBy
  335.     );
  336.  
  337. void
  338. ProcessOpen(
  339.     TCHAR *achFileName,
  340.     BOOL bPlay = FALSE
  341.     );
  342.  
  343. int
  344. VcdPlayerChangeTimeFormat(
  345.     int id
  346.     );
  347.  
  348.  
  349. /* -------------------------------------------------------------------------
  350. ** Recent filename stuff
  351. ** -------------------------------------------------------------------------
  352. */
  353. typedef TCHAR RECENTFILES[MAX_PATH];
  354. #define MAX_RECENT_FILES    5
  355. #define ID_RECENT_FILE_BASE 500
  356.  
  357. int
  358. GetRecentFiles(
  359.     int LastCount
  360.     );
  361.  
  362. int
  363. SetRecentFiles(
  364.     TCHAR *FileName,
  365.     int iCount
  366.     );
  367.  
  368.  
  369. /* -------------------------------------------------------------------------
  370. ** Global Variables
  371. ** -------------------------------------------------------------------------
  372. */
  373. extern int              cxMovie;
  374. extern int              cyMovie;
  375. extern HWND             hwndApp;
  376. extern HWND             g_hwndStatusbar;
  377.  
  378. extern int              cx;
  379. extern int              cy;
  380. extern int              xOffset;
  381. extern int              yOffset;
  382. extern TCHAR            g_achFileName[];
  383. extern OPENFILENAME     ofn;
  384. extern DWORD            g_State;
  385. extern int              nRecentFiles;
  386. extern LONG             lMovieOrgX, lMovieOrgY;
  387. extern int              g_TimeFormat;
  388.  
  389. /* -------------------------------------------------------------------------
  390. ** Constants
  391. ** -------------------------------------------------------------------------
  392. */
  393. #define LEFT_MARGIN 0
  394.  
  395. /* -------------------------------------------------------------------------
  396. ** Video CD Player states
  397. **
  398. **  These are bit flags
  399. ** -------------------------------------------------------------------------
  400. */
  401. #define VCD_PLAYING          0x0001
  402. #define VCD_STOPPED          0x0002
  403. #define VCD_PAUSED           0x0004
  404. #define VCD_SKIP_F           0x0008
  405. #define VCD_SKIP_B           0x0010
  406. #define VCD_FF               0x0020
  407. #define VCD_RW               0x0040
  408. #define VCD_SEEKING          (VCD_FF | VCD_RW)
  409. #define VCD_LOADED           0x0080
  410. #define VCD_NO_CD            0x0100
  411. #define VCD_DATA_CD_LOADED   0x0200
  412. #define VCD_EDITING          0x0400
  413. #define VCD_PAUSED_AND_MOVED 0x0800
  414. #define VCD_PLAY_PENDING     0x1000
  415. #define VCD_WAS_PLAYING      0x2000
  416. #define VCD_IN_USE           0x4000
  417. #define VCD_STEPPING         0x8000
  418.  
  419. enum {PerformanceTimer = 32, StatusTimer = 33};
  420.