home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / tema / stream / download / asfrec / source / wingui / global.h < prev    next >
C/C++ Source or Header  |  2000-12-11  |  5KB  |  174 lines

  1.  
  2. // Allows Visual C++ to precompile the standard header files
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. /* networking headers */
  8. #include <winsock2.h>
  9.  
  10. #ifdef  __MINGW32__
  11. #define WIN32
  12. #endif /* __MINGW32__ */
  13.  
  14.  
  15. #ifdef NDEBUG
  16.   #define ASSERT( exp ) ((void)0)
  17. #else
  18.   void DbgAssert(const char *pCondition, const char *pFileName, int iLine);
  19.   #define ASSERT(exp) if(!(exp)) DbgAssert( TEXT(#exp), TEXT(__FILE__), TEXT(__LINE__) );
  20. #endif
  21.  
  22. #include <windows.h>
  23. #include <commdlg.h>
  24. #include <wingdi.h>
  25.  
  26.  
  27. #include <shlwapi.h>
  28. #include <commctrl.h>
  29.  
  30. #include <objbase.h>
  31. #include <strmif.h>
  32. #include <control.h>
  33. #include <evcode.h>
  34. #include <uuids.h>
  35.  
  36. #ifdef  __MINGW32__
  37. #include "msimg32.h"
  38. #endif /* __MINGW32__ */
  39.  
  40. #include "resource.h"
  41.  
  42.  
  43. #define OATRUE (-1)
  44. #define OAFALSE (0)
  45.  
  46. #define APP_NAME "ASFRecorder"
  47.  
  48. #define APPREGKEY_ROOT    HKEY_CURRENT_USER
  49. #define APPREGKEY_BASE    "Software\\" APP_NAME
  50. #define APPREGKEY_URLLIST APPREGKEY_BASE "\\RecentURLList"
  51.  
  52. #define URLS_TO_REMEMBER 25
  53.  
  54. typedef struct
  55. {
  56.     char szAppName[ 32 ];
  57.     HANDLE hInstance;
  58.     HWND hwndMainFrame;
  59.     BOOL bFatalError;
  60.     char *szProgramExecutable;
  61. } AppVars;
  62.  
  63.  
  64. /* Prototype for GUI code in external module */
  65.  
  66. int  gui_initialize(void);
  67. void gui_uninitialize(void);
  68. void gui_setbatchmode(int flag);
  69. int  gui_startedfromdesktop(void);
  70.  
  71. int  gui_start_transmission(char *url, char *filename, int filenamesize, unsigned int totaltime, unsigned int maxtime);
  72. void gui_finished_transmission();
  73. void gui_progressinfo(int bytes, char *timecode, int progress, int seqno, int currenttime);
  74. void gui_modify_duration(unsigned int totaltime);
  75.  
  76. void gui_prepareasyncsocket(SOCKET s);
  77. void gui_restoresyncsocket(SOCKET s);
  78. void gui_return_on_network_activity();
  79. void gui_return_on_network_connect(int *retval);
  80. int  gui_nonblocking_socket_check(int num);
  81. void gui_waitforuseraction(void);
  82.  
  83. void gui_showtext(char *text, ...);
  84. void gui_setstatus(char *statustext, ...);
  85. void gui_seterror(char *errortext, ...);
  86. void gui_criticalerror(char *errortext, ...);
  87. void gui_logtext(char *text, ...);
  88. char *gui_translate_errorcode(int error);
  89.  
  90.  
  91. int PASCAL PseudoWinMain( HINSTANCE hInstance,
  92.                           HINSTANCE hPrevInstance,
  93.                           LPSTR lpszCmdParam,
  94.                           int nCmdShow );
  95.  
  96. int DoMainLoop(int network_mask);
  97.  
  98. void EndOfWinMain(void);
  99.  
  100.  
  101. HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor);
  102.  
  103. void PlayerMessageBox( UINT nResource );
  104.  
  105. BOOL FAR PASCAL AboutDlgProc( HWND hwnd, UINT message, UINT wParam, LONG lParam );
  106. void DoAboutDialog( HINSTANCE hInstance, HANDLE hwnd );
  107.  
  108. BOOL FAR PASCAL OpenURLDlgProc( HWND hwnd, UINT message, UINT wParam, LONG lParam );
  109. void DoOpenURLDialog( HINSTANCE hInstance, HANDLE hwnd );
  110.  
  111. BOOL InitFileOpenDialog( HWND hwnd );
  112. BOOL DoFileOpenDialog( HWND hwnd, LPSTR lpstrFileName, LPSTR lpstrTitleName );
  113.  
  114. BOOL InitFileSaveDialog( HWND hwnd );
  115. BOOL DoFileSaveDialog( HWND hwnd, LPSTR lpstrFileName, LPSTR lpstrTitleName );
  116.  
  117. typedef enum tagState {Uninitialized, Stopped, Paused, Playing } State;
  118.  
  119. typedef struct tagMedia
  120. {
  121.     State state;
  122.     IGraphBuilder *pGraph;
  123.     HANDLE hGraphNotifyEvent;
  124. } Media;
  125.  
  126. BOOL InitMedia(void);
  127. void SetTitle( HWND hwnd, char *szFile );
  128. BOOL OpenMediaFile( HWND hwnd, LPSTR szFile );
  129. HANDLE GetGraphEventHandle( void );
  130.  
  131. BOOL CanPreview(void);
  132. BOOL CanPlay(void);
  133. BOOL CanStop(void);
  134. BOOL CanPause(void);
  135. BOOL IsInitialized(void);
  136. void DeleteContents(void);
  137.  
  138. // Event handlers
  139.  
  140. BOOL GetStopPosition(REFTIME *rtstop, LONGLONG *llstop);
  141. BOOL SetStopPosition(int milliseconds);
  142. BOOL SetCurrentPosition(REFTIME position);
  143. BOOL OnMediaSeeking(BOOL Enable);
  144. BOOL OnMediaPlay(void);
  145. BOOL OnMediaPause(void);
  146. BOOL OnMediaStop(BOOL reallystop, BOOL rewind);
  147. BOOL OnMediaAbortStop(void);
  148. void OnGraphNotify(void);
  149.  
  150.  
  151. void UpdateToolbar(void);
  152. void DrawButton( HINSTANCE hInstance, DRAWITEMSTRUCT FAR * lpDrawItem );
  153. void CalcToolbarSize( SIZE *pSize );
  154. BOOL InitToolbar( HINSTANCE hInstance, HWND hwnd );
  155.  
  156. BOOL InitStatusbar( HINSTANCE hInstance, HWND hwndMainFrame );
  157. void SetStatusText(int partno, int drawmode, COLORREF cref, LPSTR text,...);
  158. void SetStatusTextArgs(int partno, int drawmode, COLORREF cref, LPSTR text, void *args);
  159. void CalcStatusSize ( SIZE *pSize, int *array );
  160. void AdjustStatusbar(HWND hwndStatus, HWND hwndParent, int *array);
  161. HWND DoCreateStatusbar(HWND hwndParent, int nStatusID, 
  162.                        HINSTANCE hinst, int *array);
  163. void CALLBACK StatusbarTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
  164.  
  165.  
  166. void CalcTrackbarSize ( SIZE *pSize );
  167. void AdjustTrackbar ( HWND hwndTrack, HWND hwndParent );
  168. BOOL InitTrackbar( HINSTANCE hInstance, HWND hwnd );
  169. void CALLBACK TrackbarTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
  170.  
  171. BOOL FileTypeRegistration(LPTSTR filetype, int mode);
  172. void OnRegisterFileTypes(void);
  173. void OnUnregisterFileTypes(void);
  174.