Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

731 lines
28 KiB

  1. /*-----------------------------------------------------------------------------+
  2. | MPLAYER.H |
  3. | |
  4. | (C) Copyright Microsoft Corporation 1991. All rights reserved. |
  5. | |
  6. | Revision History |
  7. | Oct-1992 MikeTri Ported to WIN32 / WIN16 common code |
  8. | |
  9. +-----------------------------------------------------------------------------*/
  10. #if (DBG || defined(DEBUG_RETAIL))
  11. #ifndef DEBUG
  12. #define DEBUG
  13. #endif
  14. #endif
  15. #include <stdlib.h> // Make sure _MAX_PATH is defined if it's there
  16. #include <malloc.h>
  17. #include "dynalink.h"
  18. #include "menuids.h"
  19. #include "helpids.h"
  20. #include "mci.h"
  21. #include "unicode.h"
  22. #include "alloc.h"
  23. #ifndef CHICAGO_PRODUCT
  24. #ifndef RC_INVOKED
  25. #include <winuserp.h>
  26. #endif
  27. #endif
  28. #include <commctrl.h>
  29. #define TBM_SHOWTICS (WM_USER+30)
  30. /* Dialog style on Win4+
  31. */
  32. #ifndef DS_CONTEXTHELP
  33. #define DS_CONTEXTHELP 0
  34. #endif
  35. /* These macros were originally defined for 16-32 portability.
  36. * The code is now expected to build for Win32 only.
  37. */
  38. #define LONG2POINT(l, pt) ((pt).x = (SHORT)LOWORD(l), (pt).y = (SHORT)HIWORD(l))
  39. #define GETWINDOWUINT(hwnd, index) (UINT)GetWindowLongPtr(hwnd, index)
  40. #define GETWINDOWID(hwnd) GETWINDOWUINT((hwnd), GWL_ID)
  41. #define GETHWNDINSTANCE(hwnd) (HINSTANCE)GetWindowLongPtr((hwnd), GWLP_HINSTANCE)
  42. #define SETWINDOWUINT(hwnd, index, ui) (UINT)SetWindowLongPtr(hwnd, index, (LONG_PTR)(ui))
  43. #define MMoveTo(hdc, x, y) MoveToEx(hdc, x, y, NULL)
  44. #define MSetViewportExt(hdc, x, y) SetViewportExtEx(hdc, x, y, NULL)
  45. #define MSetViewportOrg(hdc, x, y) SetViewportOrgEx(hdc, x, y, NULL)
  46. #define MSetWindowExt(hdc, x, y) SetWindowExtEx(hdc, x, y, NULL)
  47. #define MSetWindowOrg(hdc, x, y) SetWindowOrgEx(hdc, x, y, NULL)
  48. #define MGetCurrentTask (HANDLE)ULongToPtr(GetCurrentThreadId())
  49. #define _EXPORT
  50. BOOL WINAPI MGetTextExtent(HDC hdc, LPSTR lpstr, INT cnt, INT *pcx, INT *pcy);
  51. #ifndef RC_INVOKED
  52. #pragma warning(disable: 4001) // nonstandard extension 'single line comment' was used
  53. #pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
  54. #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int
  55. #pragma warning(disable: 4103) // used #pragma pack to change alignment (on Chicago)
  56. #endif
  57. #ifdef OLE1_HACK
  58. /* Disgusting OLE1 hackery:
  59. */
  60. void Ole1UpdateObject(void);
  61. extern DWORD gDocVersion;
  62. #define DOC_VERSION_NONE 0
  63. #define DOC_VERSION_OLE1 1
  64. #define DOC_VERSION_OLE2 2
  65. VOID SetDocVersion( DWORD DocVersion );
  66. #endif /* OLE1_HACK */
  67. //
  68. // have the debug version show preview.
  69. //
  70. extern BOOL gfShowPreview;
  71. #define DEF_WIDTH ((GetACP()==932)?600:400)
  72. #define DEF_HEIGHT 124
  73. #define CAPTION_LEN 80 // max length of caption
  74. /* BOGUS constants for Layout() */
  75. #define FSARROW_WIDTH 20 // width of one arrow bitmap for SB
  76. #define FSARROW_HEIGHT 17 // height
  77. #define FSTRACK_HEIGHT 30 // height of the scrollbar
  78. #define LARGE_CONTROL_WIDTH 172 // Width of full transport toolbar
  79. #define SMALL_CONTROL_WIDTH 73 // width with only 3 buttons
  80. #define SB_XPOS 4 // how far in to put scrollbar
  81. #define SHOW_MARK_WIDTH 363 // when to drop mark buttons
  82. #define MAP_HEIGHT 14 // height of trackmap window
  83. #define FULL_TOOLBAR_WIDTH 307 // when to drop last 4 transport btns
  84. #define MARK_WIDTH 52 // width of mark button toolbar
  85. #define MAX_NORMAL_HEIGHT 73 // max size for non-windowed device
  86. #define MIN_NORMAL_HEIGHT 27 // min size for anybody
  87. #ifndef _MAX_PATH
  88. #define _MAX_PATH 144 /* max. length of full pathname */
  89. #endif
  90. #ifndef MAX_DEVICE
  91. #define MAX_DEVICE 40 /* max. length of full pathname */
  92. #endif
  93. #define TOOLBAR_HEIGHT 27
  94. #define BUTTONWIDTH 25
  95. #define BUTTONHEIGHT 23
  96. #define SZCODE TCHAR
  97. /* Strings that MUST be ANSI even if we're compiling Unicode
  98. * e.g. to pass to GetProcAddress, which is ANSI only:
  99. */
  100. #define ANSI_SZCODE CHAR
  101. #define ANSI_TEXT( quote ) quote
  102. /* Macro for string replacement parameter in printf etc:
  103. * (Anyone know of a better way to do this?)
  104. */
  105. #ifdef UNICODE
  106. #define TS L"ws"L
  107. #ifdef DEBUG
  108. #define DTS "ws" /* For unicode args to ASCII API */
  109. #endif
  110. #else
  111. #define TS "s"
  112. #ifdef DEBUG
  113. #define DTS "s"
  114. #endif
  115. #endif /* UNICODE */
  116. /* defines for set sel dlg box */
  117. #define IDC_EDITALL 220 // these 3 are a group
  118. #define IDC_EDITSOME 221
  119. #define IDC_EDITNONE 222
  120. #define IDC_EDITFROM 223
  121. #define IDC_EDITTO 224
  122. #define IDC_EDITNUM 225
  123. #define IDC_SELECTG 226 /* Needed for Context sensitive help */
  124. #define IDC_ETTEXT 227
  125. #define IDC_ESTEXT 228
  126. #define ARROWEDITDELTA 10 /* Add to arrow ID to get edit ID */
  127. #define IDC_XARROWS 180
  128. #define IDC_YARROWS 181
  129. #define IDC_WARROWS 182
  130. #define IDC_HARROWS 183
  131. #define IDC_FARROWS 183
  132. #define IDC_TARROWS 184
  133. #define IDC_NARROWS 210
  134. /* Controls for Selection range dialog */
  135. #define IDC_MARKIN 150
  136. #define IDC_MARKOUT 151
  137. #define DLG_MCICOMMAND 942
  138. #define IDC_MCICOMMAND 10
  139. #define IDC_RESULT 11
  140. /* Bit fields for the gwOptions */
  141. // bottom two bits = Scale Mode (01 = FRAMES) (10 = TIME) (11 = TRACK)
  142. #define OPT_SCALE 0x0003
  143. #define OPT_TITLE 0x0004
  144. #define OPT_BORDER 0x0008
  145. #define OPT_PLAY 0x0010
  146. #define OPT_BAR 0x0020
  147. #define OPT_DITHER 0x0040
  148. #define OPT_AUTORWD 0x0080
  149. #define OPT_AUTOREP 0x0100
  150. #define OPT_USEPALETTE 0x0200
  151. #define OPT_DEFAULT (ID_TIME|OPT_TITLE|OPT_BORDER|OPT_PLAY|OPT_BAR)
  152. #define OPT_FIRST OPT_TITLE
  153. #if 1
  154. #define OPT_LAST OPT_AUTOREP
  155. #else
  156. #define OPT_LAST OPT_USEPALETTE
  157. #endif
  158. #define IDC_CAPTIONTEXT 202
  159. #define IDC_OLEOBJECT 203
  160. #define IDC_TITLETEXT 160
  161. #define TITLE_HEIGHT TOOLBAR_HEIGHT // height of title bar part of object picture
  162. /* Options used when initial Open dialog is displayed:
  163. */
  164. #define OPEN_NONE (UINT)-1
  165. #define OPEN_VFW 0
  166. #define OPEN_MIDI 1
  167. #define OPEN_WAVE 2
  168. #define MCIWND_STYLE WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | \
  169. MCIWNDF_NOPLAYBAR | MCIWNDF_NOMENU | MCIWNDF_SHOWNAME | \
  170. MCIWNDF_NOTIFYALL
  171. /* Parameters for GetIconForCurrentDevice:
  172. */
  173. #define GI_LARGE 0
  174. #define GI_SMALL 1
  175. /* For mapping strings to device IDs
  176. */
  177. typedef struct _STRING_TO_ID_MAP
  178. {
  179. LPTSTR pString;
  180. UINT ID;
  181. }
  182. STRING_TO_ID_MAP, *PSTRING_TO_ID_MAP;
  183. /* global array of all mci devices */
  184. typedef struct {
  185. UINT wDeviceType; // flags, DTMCI_*
  186. PTSTR szDevice; // name used to open device e.g. "WaveAudio"
  187. PTSTR szDeviceName; // name to display to user e.g. "Wave Audio"
  188. PTSTR szFileExt; // file extensions used by device.
  189. } MCIDEVICE, *PMCIDEVICE;
  190. #define MAX_MCI_DEVICES 50
  191. extern UINT gwCurDevice; /* current device */
  192. extern UINT gwNumDevices; /* number of available devices */
  193. extern MCIDEVICE garMciDevices[]; /* array with info about a device */
  194. /* global variables */
  195. extern DWORD gwPlatformId; // Win95, NT etc
  196. extern BOOL gfEmbeddedObject; // TRUE if editing embedded OLE object
  197. extern BOOL gfPlayingInPlace; // TRUE if playing in place
  198. extern BOOL gfParentWasEnabled; // TRUE if parent was enabled
  199. extern BOOL gfShowWhilePlaying; //
  200. extern BOOL gfDirty; //
  201. extern int gfErrorBox; // TRUE if we have a message box active
  202. extern BOOL gfErrorDeath; // Die when errorbox is up
  203. extern BOOL gfOleInitialized;
  204. extern BOOL gfOle2Open;
  205. extern BOOL gfOle2IPEditing;
  206. extern BOOL gfOle2IPPlaying;
  207. extern RECT gInPlacePosRect;
  208. extern HWND ghwndCntr;
  209. extern HWND ghwndIPToolWindow;
  210. extern HWND ghwndIPScrollWindow;
  211. extern LPWSTR sz1Ole10Native;
  212. extern UINT gwOptions; /* play options */
  213. extern UINT gwOpenOption; /* Type of file to open */
  214. extern BOOL gfOpenDialog; // If TRUE, put up open dialog
  215. extern BOOL gfCloseAfterPlaying; // TRUE if we are to hide after play
  216. extern BOOL gfRunWithEmbeddingFlag; // TRUE if run with "-Embedding"
  217. extern HMENU ghMenu; /* normal menu */
  218. extern HICON hiconApp; /* the applicaiion's icon */
  219. extern HANDLE ghInst; /* the application's instance handle */
  220. extern DWORD gfdwFlagsEx; /* the application's RTL status */
  221. extern HANDLE ghInstPrev; /* the application's instance handle */
  222. extern HFONT ghfontMap; /* font used for drawing the track map */
  223. extern HWND ghwndApp; /* handle to the main dialog window */
  224. extern HWND ghwndMap; /* handle to the track map window */
  225. extern HWND ghwndTrackbar; /* handle to the horizontal track bar */
  226. extern HWND ghwndToolbar; /* handle to the toolbar */
  227. extern HWND ghwndMark; /* handle to the Mark buttons toolbar */
  228. extern HWND ghwndFSArrows; /* handle to the scrollbar arrows */
  229. extern HWND ghwndStatic; /* handle ot the static text window */
  230. extern HWND ghwndMCI; /* MCI window returned from MCIWndCreate */
  231. extern HBRUSH ghbrFillPat; /* The selection fill pattern. */
  232. extern UINT gwHeightAdjust; /* Difference between client & non-c height */
  233. extern LPTSTR gszCmdLine; /* null-terminated command line str. */
  234. extern int giCmdShow; /* show command */
  235. extern UINT gwDeviceID; /* current MCI device ID (or NULL) */
  236. extern UINT gwStatus; /* status of current MCI device */
  237. extern UINT gwNumTracks; /* current # of tracks in the medium */
  238. extern UINT gwFirstTrack; /* number of first track */
  239. extern BOOL gfValidMediaInfo; /* are we displaying valid media info? */
  240. extern BOOL gfValidCaption; /* are we displaying a valid caption? */
  241. extern BOOL gfPlayOnly; /* play only window? */
  242. extern BOOL gfJustPlayed; /* Just sent a PlayMCI() command */
  243. extern DWORD gdwLastSeekToPosition; /* Last requested seek position */
  244. extern DWORD gdwMediaLength; /* length of entire medium in msec. */
  245. extern DWORD gdwMediaStart; /* start of medium in msec. */
  246. extern DWORD NEAR * gadwTrackStart; /* array of track start positions */
  247. extern UINT gwOptions; /* the options from the dlg box */
  248. extern SZCODE aszIntl[]; /* string for international section */
  249. extern TCHAR gachAppName[]; /* string for holding the app. name */
  250. extern TCHAR gachClassRoot[]; /* string for holding the class root OLE "Media Clip"*/
  251. extern TCHAR chDecimal; /* Stores current decimal separator */
  252. extern TCHAR chTime; /* Stores the current Time separator */
  253. extern TCHAR chLzero; /* Stores if Leading Zero required for decimal numbers less than 1 */
  254. extern TCHAR aszNotReadyFormat[];
  255. extern TCHAR aszReadyFormat[];
  256. extern TCHAR gachFileDevice[_MAX_PATH]; /* string holding the current file or device name */
  257. extern TCHAR gachWindowTitle[_MAX_PATH]; /* string holding name */
  258. extern TCHAR gachCaption[_MAX_PATH]; /* string holding name */
  259. extern TCHAR gachOpenExtension[5]; /* Non-null if a device extension passed in */
  260. extern TCHAR gachOpenDevice[128]; /* Non-null if a device extension passed in */
  261. extern TCHAR gszHelpFileName[];/* name of the help file */
  262. extern TCHAR gszHtmlHelpFileName[];/* name of the html help file */
  263. extern DWORD gdwSeekPosition; /* Position to seek to after skipping track. */
  264. extern BOOL gfScrollTrack; /* is user dragging the scrollbar thumb? */
  265. extern UINT gwCurScale; /* scale is TIME/TRACKS/FRAMES */
  266. extern INT gwCurZoom; /* current zoom factor */
  267. extern HWND ghwndMCI; /* current window for window objects */
  268. extern RECT grcSize; /* size of MCI object */
  269. extern BOOL gfAppActive; /* Our app active? (incl. playback win) */
  270. extern LONG glSelStart; /* See if selection changes (dirty object)*/
  271. extern LONG glSelEnd; /* See if selection changes (dirty object)*/
  272. extern HPALETTE ghpalApp;
  273. extern BOOL gfInClose;
  274. extern BOOL gfCurrentCDNotAudio; /* TRUE when we have a CD that we can't play */
  275. extern BOOL gfWinIniChange;
  276. extern DWORD gdwPosition; /* The Seek position we emedded */
  277. extern BOOL gfSeenPBCloseMsg;
  278. extern int giHelpContext; /* Contains the context id for help */
  279. extern HANDLE heventDeviceMenuBuilt;/* Event will be signaled when device menu complete */
  280. extern HANDLE heventCmdLineScanned; /* Event will be signaled when command line scanned */
  281. // strings for registration database
  282. extern SZCODE aszKeyMID[];
  283. extern SZCODE aszKeyRMI[];
  284. extern SZCODE aszKeyAVI[];
  285. extern SZCODE aszKeyMMM[];
  286. extern SZCODE aszKeyWAV[];
  287. extern SZCODE szCDAudio[];
  288. extern SZCODE szVideoDisc[];
  289. extern SZCODE szSequencer[];
  290. extern SZCODE szVCR[];
  291. extern SZCODE szWaveAudio[];
  292. extern SZCODE szAVIVideo[];
  293. /* constants */
  294. #define DEVNAME_MAXLEN 40 /* the maximum length of a device name */
  295. /* IDs of icons and dialog boxes */
  296. #define APPICON 10 /* ID of the application's icon */
  297. #define IDI_DDEFAULT 11
  298. #define IDI_DSOUND 12
  299. #define IDI_DVIDEO 13
  300. #define IDI_DANI 14
  301. #define IDI_DMIDI 15
  302. #define IDI_DCDA 16
  303. #define IDC_DRAG 17
  304. #define MPLAYERBOX 11 /* ID of the main "MPlayer" dialog box */
  305. #define MPLAYERACCEL 1
  306. /* IDs of the MPLAYERBOX (main dialog box) controls */
  307. #define ID_MAP 20 /* ID of thetrack map */
  308. #define ID_SB 21 /* ID of the horizontal scrollbar */
  309. #define ID_STATIC 22 /* ID of the static text control */
  310. #define ID_PLAY 23 /* Command 'Play' */
  311. #define ID_PAUSE 24 /* Command 'Pause' */
  312. #define ID_STOP 25 /* Command 'Stop' */
  313. #define ID_PLAYSEL 26 /* Command 'Play Selection' */
  314. #define ID_PLAYTOGGLE 27 /* For accelerator to toggle play/pause*/
  315. #define ID_EJECT 28 /* Command 'Eject' */
  316. #define ID_ESCAPE 29 /* Escape key was hit */
  317. /* IDs of the string resources */
  318. #define IDS_APPNAME 100 /* ID of the application name string */
  319. #define IDS_OPENTITLE 101 /* ID of the "Open Media File" str. */
  320. #define IDS_OUTOFMEMORY 102 /* ID of the "Out of memory" string */
  321. #define IDS_CANTOPENFILEDEV 103 /* ID of the "Cannot open file/dev" str*/
  322. #define IDS_DEVICEINUSE 104 /* ID of the "Device is in use" string */
  323. #define IDS_CANTOPENFILE 105 /* ID of the "Cannot open file" string */
  324. #define IDS_CANTACCESSFILEDEV 106 /* ID of the "Cannot access..." str. */
  325. #define IDS_DEVICECANNOTPLAY 107 /* ID of the "Cannot play..." str. */
  326. #define IDS_SCALE 108 /* ID of the "Scale" string */
  327. #define IDS_CANTPLAY 109
  328. #define IDS_CANTEDIT 110
  329. #define IDS_CANTCOPY 111
  330. #define IDS_FINDFILE 112
  331. #define IDS_DEVICENOTINSTALLED 113
  332. #define IDS_DEVICEERROR 114 /* ID of the "Device error" str. */
  333. #define IDS_CANTPLAYSOUND 115
  334. #define IDS_CANTPLAYVIDEO 116
  335. #define IDS_CANTPLAYMIDI 117
  336. #define IDS_NOTSOUNDFILE 118
  337. #define IDS_NOTVIDEOFILE 119
  338. #define IDS_NOTMIDIFILE 120
  339. #define IDS_TIMEMODE 121 /* Moved "Set Selection" strings from */
  340. #define IDS_FRAMEMODE 122 /* being embedded in DLGS.C ! */
  341. #define IDS_TRACKMODE 123
  342. #define IDS_SEC 124 /* "hrs", "min", "sec" and "msec" string ids. */
  343. #define IDS_MIN 125
  344. #define IDS_HRS 126
  345. #define IDS_MSEC 127
  346. #define IDS_FRAME 128 /* "frame" string id. */
  347. #define IDS_UPDATEOBJECT 129
  348. #define IDS_NOTREADYFORMAT 132
  349. #define IDS_READYFORMAT 133
  350. #define IDS_DEVICEMENUCOMPOUNDFORMAT 134
  351. #define IDS_DEVICEMENUSIMPLEFORMAT 135
  352. #define IDS_ALLFILES 136
  353. #define IDS_ANYDEVICE 137
  354. #define IDS_CLASSROOT 138
  355. #define IDS_NOGOODTIMEFORMATS 139
  356. #define IDS_FRAMERANGE 140
  357. #define IDS_INIFILE 141 /* ID of the private INI file name */
  358. #define IDS_HELPFILE 142 /* ID of help file name */
  359. #define IDS_HTMLHELPFILE 147 /* ID of HTML help file */
  360. #define IDS_NOMCIDEVICES 143 /* no MCI devices are installed. */
  361. #define IDS_PLAYVERB 144
  362. #define IDS_EDITVERB 145
  363. #define IDS_CANTSTARTOLE 146
  364. #define IDS_UNTITLED 149
  365. #define IDS_CANTLOADLIB 151
  366. #define IDS_CANTFINDPROC 152
  367. #define IDS_MPLAYERWIDTH 200
  368. #define IDS_CANTACCESSFILE 250
  369. /* These macros and typedefs can be used to clarify whether we're talking about
  370. * numbers of characters or numbers of bytes in a given buffer.
  371. * Unfortunately C doesn't give us type checking to do this properly.
  372. */
  373. #undef BYTE_COUNT
  374. #define BYTE_COUNT( buf ) sizeof(buf)
  375. #undef CHAR_COUNT
  376. #define CHAR_COUNT( buf ) (sizeof(buf) / sizeof(TCHAR))
  377. /* Find how many bytes are in a given string:
  378. */
  379. #define STRING_BYTE_COUNT( str ) (STRLEN(str) * sizeof(TCHAR) + sizeof(TCHAR))
  380. #define ANSI_STRING_BYTE_COUNT( str ) (strlen(str) * sizeof(CHAR) + sizeof(CHAR))
  381. /* Check the length of a string or number of bytes where NULL is a valid
  382. * pointer which should give a length of 0:
  383. */
  384. #define STRLEN_NULLOK( str ) ((str) ? STRLEN(str) : 0)
  385. #define STRING_BYTE_COUNT_NULLOK( str ) ((str) ? STRING_BYTE_COUNT(str) : 0)
  386. /* Use this macro for loading strings. It make the parameter list tidier
  387. * and ensures we pass the buffer size in CHARACTERS, not bytes.
  388. * This assumes that the buffer is static, not dynamically allocated.
  389. */
  390. #define LOADSTRING( id, buf ) LoadString(ghInst, (UINT)id, buf, CHAR_COUNT(buf))
  391. #define LOADSTRINGFROM( inst, id, buf ) LoadString(inst, id, buf, CHAR_COUNT(buf))
  392. /* track map scale values */
  393. #define SCALE_HOURS 153 /* draw the scale in hours */
  394. #define SCALE_MINUTES 154 /* draw the scale in minutes */
  395. #define SCALE_SECONDS 155 /* draw the scale in seconds */
  396. #define SCALE_MSEC 156 /* draw it in milli vanilliseconds */
  397. #define SCALE_FRAMES 157 /* draw scale in 'frames' */
  398. #define SCALE_TRACKS 158
  399. #define SCALE_NOTRACKS 159
  400. #define IDS_CLOSE 160
  401. #define IDS_UPDATE 161
  402. #define IDS_NOPICTURE 162
  403. #define IDS_EXIT 163
  404. #define IDS_EXITRETURN 164
  405. #define IDS_SSNOTREADY 170
  406. #define IDS_SSPAUSED 171
  407. #define IDS_SSPLAYING 172
  408. #define IDS_SSSTOPPED 173
  409. #define IDS_SSOPEN 174
  410. #define IDS_SSPARKED 175
  411. #define IDS_SSRECORDING 176
  412. #define IDS_SSSEEKING 177
  413. #define IDS_SSUNKNOWN 178
  414. #define IDS_OLEVER 180
  415. #define IDS_OLEINIT 181
  416. #define IDS_OLENOMEM 182
  417. //InPlace menu names.
  418. #define IDS_EDITMENU 185
  419. #define IDS_INSERTMENU 186
  420. #define IDS_SCALEMENU 187
  421. #define IDS_COMMANDMENU 188
  422. #define IDS_HELPMENU 189
  423. #define IDS_NONE 190
  424. #define IDS_MSGFORMAT 191
  425. #define IDS_FORMATEMBEDDEDTITLE 192
  426. #define IDS_IS_RTL 193
  427. // String for registry fix-up message
  428. #define IDS_BADREG 195
  429. #define IDS_FIXREGERROR 196
  430. #define IDS_NETWORKERROR 197
  431. #define IDS_UNKNOWNNETWORKERROR 198
  432. #define IDS_INSERTAUDIODISC 199
  433. /* macros for displaying error messages */
  434. #define MB_ERROR (MB_ICONEXCLAMATION | MB_OK)
  435. #define Error(hwnd, idsFmt) \
  436. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt)), FALSE )
  437. #define Error1(hwnd, idsFmt, arg1) \
  438. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt), (arg1)), \
  439. FALSE )
  440. #define Error2(hwnd, idsFmt, arg1, arg2) \
  441. ( ErrorResBox(hwnd, ghInst, MB_ERROR, IDS_APPNAME, (idsFmt), (arg1), \
  442. (arg2)), FALSE )
  443. /* app tabbing code */
  444. BOOL IsDannyDialogMessage(HWND hwndApp, MSG msg);
  445. /* calc where the tics belong on the scrollbar */
  446. void FAR PASCAL CalcTicsOfDoom(void);
  447. /* Layout the main window and the children */
  448. void FAR PASCAL Layout(void);
  449. /* prototypes from "errorbox.c" */
  450. short FAR cdecl ErrorResBox(HWND hwnd, HANDLE hInst, UINT flags,
  451. UINT idAppName, UINT idErrorStr, ...);
  452. /* function prototypes from "framebox.c" */
  453. BOOL FAR PASCAL frameboxInit(HANDLE hInst, HANDLE hPrev);
  454. /* function prototypes from "dlgs.c" */
  455. BOOL FAR PASCAL mciDialog(HWND hwnd);
  456. BOOL FAR PASCAL setselDialog(HWND hwnd);
  457. BOOL FAR PASCAL optionsDialog(HWND hwnd);
  458. /* function prototypes from "arrow.c" */
  459. BOOL FAR PASCAL ArrowInit(HANDLE hInst);
  460. /* function prototypes from "mplayer.c" */
  461. void FAR PASCAL FormatTime(DWORD_PTR dwPosition, LPTSTR szNum, LPTSTR szBuf, BOOL fRound);
  462. void FAR PASCAL UpdateDisplay(void);
  463. void FAR PASCAL EnableTimer(BOOL fEnable);
  464. LRESULT FAR PASCAL MPlayerWndProc(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
  465. HICON GetIconForCurrentDevice(UINT Size, UINT DefaultID);
  466. void SetMPlayerIcon(void);
  467. /* function prototypes from "init.c" */
  468. BOOL FAR PASCAL AppInit(HANDLE hInst, HANDLE hPrev, LPTSTR szCmdLine);
  469. void FAR PASCAL InitMPlayerDialog(HWND hwnd);
  470. BOOL FAR PASCAL GetIntlSpecs(void);
  471. void FAR PASCAL SmartWindowPosition (HWND hWndDlg, HWND hWndShow, BOOL fForce);
  472. void FAR PASCAL SizeMPlayer(void);
  473. void FAR PASCAL SetMPlayerSize(LPRECT prc);
  474. void FAR PASCAL InitDeviceMenu(void);
  475. void WaitForDeviceMenu(void);
  476. VOID FAR PASCAL CompleteOpenDialog(BOOL FileSelected);
  477. /* function prototypes from "open.c" */
  478. INT_PTR FAR PASCAL DoOpen(UINT wCurDevice, LPTSTR SzFileName);
  479. BOOL FAR PASCAL DoChooseDevice(UINT wID);
  480. void FAR PASCAL CheckDeviceMenu(void);
  481. BOOL FAR PASCAL OpenMciDevice(LPCTSTR szFile, LPCTSTR szDevice);
  482. UINT FAR PASCAL IsMCIDevice(LPCTSTR szDevice);
  483. /* function prototype from "trackmap.c" */
  484. LRESULT FAR PASCAL fnMPlayerTrackMap(HWND hwnd, UINT wMsg, WPARAM wParam,
  485. LPARAM lParam);
  486. /* function prototype from init.c */
  487. void FAR PASCAL WriteOutPosition(void);
  488. void FAR PASCAL WriteOutOptions(void);
  489. void FAR PASCAL ReadOptions(void);
  490. void MapStatusString(LPTSTR lpstatusstr);
  491. /* function prototype from "math.asm", if needed */
  492. #define MULDIV32( number, numerator, denominator ) \
  493. MulDiv( (int)number, (int)numerator, (int)denominator )
  494. /* function prototype from "doverb.c" */
  495. LPTSTR FAR FileName(LPCTSTR);
  496. /* constants */
  497. #define WM_USER_DESTROY (WM_USER+120)
  498. #define WM_SEND_OLE_CHANGE (WM_USER+122)
  499. #define WM_STARTTRACK (WM_USER+123)
  500. #define WM_ENDTRACK (WM_USER+124)
  501. #define WM_BADREG (WM_USER+125)
  502. #define WM_DOLAYOUT (WM_USER+126)
  503. #define WM_GETDIB (WM_USER+127)
  504. #define WM_NOMCIDEVICES (WM_USER+128)
  505. /* constants */
  506. #define SCROLL_GRANULARITY ((gdwMediaLength+127)/128) /* granularity of the scrollbar */
  507. #define SCROLL_BIGGRAN ((gdwMediaLength+15)/16) /* gran. for page up/down in time mode */
  508. #define UPDATE_TIMER 1 /* # of the timer being used */
  509. #define UPDATE_MSEC 500 /* msec between display updates */
  510. #define UPDATE_INACTIVE_MSEC 2000 /* msec betw. upds. when inactive*/
  511. #define SKIPTRACKDELAY_MSEC 3000 /* max msec for double-page-left */
  512. #define SetDlgFocus(hwnd) SendMessage(ghwndApp, WM_NEXTDLGCTL, (WPARAM)(hwnd), 1L)
  513. #ifdef DEBUG
  514. #define STATICDT
  515. #define STATICFN
  516. int __iDebugLevel;
  517. extern void cdecl dprintf(LPSTR, ...);
  518. #define DPF0 dprintf
  519. #define DPF if (__iDebugLevel > 0) dprintf
  520. #define DPFI if (__iDebugLevel >= 1) dprintf
  521. #define DPF1 if (__iDebugLevel >= 1) dprintf
  522. #define DPF2 if (__iDebugLevel >= 2) dprintf
  523. #define DPF3 if (__iDebugLevel >= 3) dprintf
  524. #define DPF4 if (__iDebugLevel >= 4) dprintf
  525. #define CPF
  526. #else
  527. #define STATICDT static
  528. #define STATICFN static
  529. #define DPF0 ; / ## /
  530. #define DPFI ; / ## /
  531. #define DPF ; / ## /
  532. #define DPF1 ; / ## /
  533. #define DPF2 ; / ## /
  534. #define DPF3 ; / ## /
  535. #define DPF4 ; / ## /
  536. #define CPF / ## /
  537. #endif
  538. #ifdef DEBUG
  539. LPVOID DbgGlobalLock(HGLOBAL hglbMem);
  540. BOOL DbgGlobalUnlock(HGLOBAL hglbMem);
  541. HGLOBAL DbgGlobalFree(HGLOBAL hglbMem);
  542. #define GLOBALLOCK(hglbMem) DbgGlobalLock(hglbMem)
  543. #define GLOBALUNLOCK(hglbMem) DbgGlobalUnlock(hglbMem);
  544. #define GLOBALFREE(hglbMem) DbgGlobalFree(hglbMem)
  545. #else
  546. #define GLOBALLOCK(hglbMem) GlobalLock(hglbMem)
  547. #define GLOBALUNLOCK(hglbMem) GlobalUnlock(hglbMem);
  548. #define GLOBALFREE(hglbMem) GlobalFree(hglbMem)
  549. #endif
  550. /*----Constants--------------------------------------------------------------*/
  551. /* Push buttons */
  552. #define psh15 0x040e
  553. #define pshHelp psh15
  554. /* Checkboxes */
  555. #define chx1 0x0410
  556. /* Static text */
  557. #define stc1 0x0440
  558. #define stc2 0x0441
  559. #define stc3 0x0442
  560. #define stc4 0x0443
  561. /* Listboxes */
  562. #define lst1 0x0460
  563. #define lst2 0x0461
  564. /* Combo boxes */
  565. #define cmb1 0x0470
  566. #define cmb2 0x0471
  567. /* Edit controls */
  568. #define edt1 0x0480
  569. /**************************************************************************
  570. ***************************************************************************/
  571. #define GetWS(hwnd) GetWindowLongPtr(hwnd, GWL_STYLE)
  572. #define PutWS(hwnd, f) SetWindowLongPtr(hwnd, GWL_STYLE, f)
  573. #define TestWS(hwnd,f) (GetWS(hwnd) & f)
  574. #define SetWS(hwnd, f) ((PutWS(hwnd, GetWS(hwnd) | f) & (f)) != (f))
  575. #define ClrWS(hwnd, f) ((PutWS(hwnd, GetWS(hwnd) & ~(f)) & (f)) != 0)
  576. #define GetWSEx(hwnd) GetWindowLongPtr(hwnd, GWL_EXSTYLE)
  577. #define PutWSEx(hwnd, f) SetWindowLongPtr(hwnd, GWL_EXSTYLE, f)
  578. #define SetWSEx(hwnd, f) ((PutWSEx(hwnd, GetWSEx(hwnd) | f) & (f)) != (f))
  579. #define ClrWSEx(hwnd, f) ((PutWSEx(hwnd, GetWSEx(hwnd) & ~(f)) & (f)) != 0)
  580. // server related stuff.
  581. void FAR PASCAL ServerUnblock(void);
  582. void FAR PASCAL BlockServer(void);
  583. void FAR PASCAL UnblockServer(void);
  584. void FAR PASCAL PlayInPlace(HWND hwndApp, HWND hwndClient, LPRECT prc);
  585. void FAR PASCAL EditInPlace(HWND hwndApp, HWND hwndClient, LPRECT prc);
  586. void FAR PASCAL EndPlayInPlace(HWND hwndApp);
  587. void FAR PASCAL EndEditInPlace(HWND hwndApp);
  588. void FAR PASCAL DelayedFixLink(UINT verb, BOOL fShow, BOOL fActivate);
  589. void DirtyObject(BOOL fDocStgChangeOnly);
  590. void CleanObject(void);
  591. void UpdateObject(void);
  592. BOOL FAR PASCAL IsObjectDirty(void);
  593. void FAR PASCAL TerminateServer(void);
  594. void FAR PASCAL SetEmbeddedObjectFlag(BOOL flag);
  595. HMENU GetInPlaceMenu(void);
  596. void PostCloseMessage();
  597. void FAR PASCAL InitDoc(BOOL fUntitled);