Source code of Windows XP (NT5)
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.

841 lines
19 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: ledwnd.c
  3. *
  4. * Implementation of the LED window.
  5. *
  6. *
  7. * Created: 18-11-93
  8. * Author: Stephen Estrop [StephenE]
  9. *
  10. * Copyright (c) 1993 Microsoft Corporation
  11. \**************************************************************************/
  12. #pragma warning( once : 4201 4214 )
  13. #define NOOLE
  14. #include <windows.h> /* required for all Windows applications */
  15. #include <windowsx.h>
  16. #include <string.h>
  17. #include <tchar.h> /* contains portable ascii/unicode macros */
  18. #include "resource.h"
  19. #include "cdplayer.h"
  20. #include "cdapi.h"
  21. #include "buttons.h"
  22. #include "literals.h"
  23. #define DECLARE_DATA
  24. #include "ledwnd.h"
  25. /* -------------------------------------------------------------------------
  26. ** Private functions for the LED class
  27. ** -------------------------------------------------------------------------
  28. */
  29. BOOL
  30. LED_OnCreate(
  31. HWND hwnd,
  32. LPCREATESTRUCT lpCreateStruct
  33. );
  34. void
  35. LED_OnPaint(
  36. HWND hwnd
  37. );
  38. void
  39. LED_OnLButtonUp(
  40. HWND hwnd,
  41. int x,
  42. int y,
  43. UINT keyFlags
  44. );
  45. void
  46. LED_OnRButtonUp(
  47. HWND hwnd,
  48. int x,
  49. int y,
  50. UINT keyFlags
  51. );
  52. void
  53. LED_OnSetText(
  54. HWND hwnd,
  55. LPCTSTR lpszText
  56. );
  57. void
  58. LED_DrawText(
  59. HWND hwnd,
  60. LPCTSTR s,
  61. int sLen
  62. );
  63. void
  64. LED_CreateLEDFonts(
  65. HDC hdc
  66. );
  67. /******************************Public*Routine******************************\
  68. * InitLEDClass
  69. *
  70. * Called to register the LED window class and create a font for the LED
  71. * window to use. This function must be called before the CD Player dialog
  72. * box is created.
  73. *
  74. * History:
  75. * 18-11-93 - StephenE - Created
  76. *
  77. \**************************************************************************/
  78. BOOL
  79. InitLEDClass(
  80. HINSTANCE hInst
  81. )
  82. {
  83. WNDCLASS LEDwndclass;
  84. HDC hdc;
  85. ZeroMemory( &LEDwndclass, sizeof(LEDwndclass) );
  86. /*
  87. ** Register the LED window.
  88. */
  89. LEDwndclass.lpfnWndProc = LEDWndProc;
  90. LEDwndclass.hInstance = hInst;
  91. LEDwndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
  92. LEDwndclass.hbrBackground = GetStockObject( BLACK_BRUSH );
  93. LEDwndclass.lpszClassName = g_szLEDClassName;
  94. LEDwndclass.style = CS_OWNDC;
  95. hdc = GetDC( GetDesktopWindow() );
  96. LED_CreateLEDFonts( hdc );
  97. ReleaseDC( GetDesktopWindow(), hdc );
  98. return RegisterClass( &LEDwndclass );
  99. }
  100. /******************************Public*Routine******************************\
  101. * LEDWndProc
  102. *
  103. * This routine handles the WM_PAINT and WM_SETTEXT messages
  104. * for the "LED" display window.
  105. *
  106. * History:
  107. * 18-11-93 - StephenE - Created
  108. *
  109. \**************************************************************************/
  110. LRESULT CALLBACK
  111. LEDWndProc(
  112. HWND hwnd,
  113. UINT message,
  114. WPARAM wParam,
  115. LPARAM lParam
  116. )
  117. {
  118. switch( message ) {
  119. HANDLE_MSG( hwnd, WM_CREATE, LED_OnCreate );
  120. HANDLE_MSG( hwnd, WM_PAINT, LED_OnPaint );
  121. HANDLE_MSG( hwnd, WM_LBUTTONUP, LED_OnLButtonUp );
  122. HANDLE_MSG( hwnd, WM_RBUTTONUP, LED_OnRButtonUp );
  123. HANDLE_MSG( hwnd, WM_SETTEXT, LED_OnSetText );
  124. }
  125. return DefWindowProc( hwnd, message, wParam, lParam );
  126. }
  127. /*****************************Private*Routine******************************\
  128. * LED_OnCreate
  129. *
  130. *
  131. *
  132. * History:
  133. * 18-11-93 - StephenE - Created
  134. *
  135. \**************************************************************************/
  136. BOOL
  137. LED_OnCreate(
  138. HWND hwnd,
  139. LPCREATESTRUCT lpCreateStruct
  140. )
  141. {
  142. HDC hdcLed;
  143. hdcLed = GetDC( hwnd );
  144. SelectObject( hdcLed, g_fSmallLedFont ? hLEDFontS : hLEDFontL );
  145. SetTextColor( hdcLed, RGB(0x80,0x80,0x00) );
  146. ReleaseDC( hwnd, hdcLed );
  147. return TRUE;
  148. }
  149. /*****************************Private*Routine******************************\
  150. * LED_OnPaint
  151. *
  152. *
  153. *
  154. * History:
  155. * 18-11-93 - StephenE - Created
  156. *
  157. \**************************************************************************/
  158. void
  159. LED_OnPaint(
  160. HWND hwnd
  161. )
  162. {
  163. PAINTSTRUCT ps;
  164. TCHAR s[50];
  165. int sLen;
  166. RECT rcLed;
  167. HDC hdcLed;
  168. hdcLed = BeginPaint( hwnd, &ps );
  169. #ifdef DAYTONA
  170. /*
  171. ** For some (unknown) reason Daytona does not redraw the
  172. ** screen correctly after the screen save has exited. Chicago does !!
  173. */
  174. DefWindowProc( hwnd, WM_ERASEBKGND, (WPARAM)hdcLed, 0 );
  175. #endif
  176. GetClientRect( hwnd, &rcLed );
  177. sLen = GetWindowText( hwnd, s, 50 );
  178. /*
  179. ** Draw the LED display text
  180. */
  181. LED_DrawText( hwnd, s, sLen );
  182. /*
  183. ** Draw a shaded frame around the LED display
  184. */
  185. DrawEdge( hdcLed, &rcLed, EDGE_SUNKEN, BF_RECT );
  186. EndPaint( hwnd, &ps );
  187. }
  188. /*****************************Private*Routine******************************\
  189. * LED_OnLButtonUp
  190. *
  191. * Rotate the time remaing buttons and then set the display accordingly.
  192. *
  193. * History:
  194. * 18-11-93 - StephenE - Created
  195. *
  196. \**************************************************************************/
  197. void
  198. LED_OnLButtonUp(
  199. HWND hwnd,
  200. int x,
  201. int y,
  202. UINT keyFlags
  203. )
  204. {
  205. BOOL b;
  206. /*
  207. ** If this window is not the master display LED just return
  208. */
  209. if ( GetWindowLong(hwnd, GWL_ID) != IDC_LED ) {
  210. return;
  211. }
  212. b = g_fDisplayDr;
  213. g_fDisplayDr = g_fDisplayTr;
  214. g_fDisplayTr = g_fDisplayT;
  215. g_fDisplayT = b;
  216. UpdateToolbarTimeButtons();
  217. UpdateDisplay( DISPLAY_UPD_LED );
  218. }
  219. /*****************************Private*Routine******************************\
  220. * LED_OnRButtonUp
  221. *
  222. * Determine if we should do something interesting with the LED display.
  223. *
  224. * History:
  225. * dd-mm-94 - StephenE - Created
  226. *
  227. \**************************************************************************/
  228. void
  229. LED_OnRButtonUp(
  230. HWND hwnd,
  231. int x,
  232. int y,
  233. UINT keyFlags
  234. )
  235. {
  236. DWORD dwTime;
  237. static DWORD dwTimeSave;
  238. extern BOOL g_fTitlebarShowing;
  239. /*
  240. ** If we are in mini mode and there is no cd loaded and the Shift and
  241. ** control keys are down and it is more than 500 ms and less than 1500 ms
  242. ** since an identical sequence was performed then display the credits.
  243. */
  244. if ( !g_fTitlebarShowing && (g_State & CD_NO_CD) ) {
  245. dwTime = GetCurrentTime();
  246. switch ( keyFlags & (MK_SHIFT | MK_CONTROL) ) {
  247. case (MK_SHIFT | MK_CONTROL):
  248. dwTimeSave = dwTime;
  249. break;
  250. case 0:
  251. if ( (dwTime - dwTimeSave) > 500 && (dwTime - dwTimeSave) < 1500 ) {
  252. void DoC(HWND hwnd);
  253. DoC( hwnd );
  254. }
  255. break;
  256. }
  257. }
  258. }
  259. /*****************************Private*Routine******************************\
  260. * DoC
  261. *
  262. * Do interesting things to the LED display
  263. *
  264. * History:
  265. * 18-11-93 - StephenE - Created
  266. *
  267. \**************************************************************************/
  268. void
  269. DoC(
  270. HWND hwnd
  271. )
  272. {
  273. RECT rc;
  274. RECT rcUpdate;
  275. HDC hdc;
  276. MSG msg;
  277. int dyLine;
  278. int yLine;
  279. TEXTMETRIC tm;
  280. DWORD dwNextTime;
  281. long lScroll;
  282. DWORD rgb;
  283. HWND hwndFocusSave;
  284. LPSTR pchSrc, pchDst;
  285. char achLine[100];
  286. int iEncrypt;
  287. const int dxEdge = 2, dyEdge = 2;
  288. #define EOFCHAR '@' // end of stream
  289. pchSrc = &cr[0];
  290. /* we want to get all mouse and keyboard events, to make
  291. ** sure we stop the animation when the user clicks or
  292. ** hits a key
  293. */
  294. hwndFocusSave = SetFocus(hwnd);
  295. SetCapture(hwnd);
  296. /* Scroll the crs up, one pixel at a time. pchSrc
  297. ** points to the encrypted data; achLine contains a decrypted
  298. ** line (null-terminated). dyLine is the height of each
  299. ** line (constant), and yLine is between 0 and dyLine,
  300. ** indicating how many pixels of the line have been scrolled
  301. ** in vertically from the bottom
  302. */
  303. hdc = GetDC(hwnd);
  304. SaveDC(hdc);
  305. SelectObject(hdc, GetStockObject(ANSI_VAR_FONT));
  306. GetClientRect(hwnd, &rc);
  307. SetTextAlign(hdc, TA_CENTER);
  308. SetBkColor(hdc, RGB(0, 0, 0));
  309. SetRect(&rcUpdate, dxEdge, rc.bottom - (dyEdge + 1),
  310. rc.right - dxEdge, rc.bottom - dyEdge);
  311. GetTextMetrics(hdc, &tm);
  312. if ((dyLine = tm.tmHeight + tm.tmExternalLeading) == 0) {
  313. dyLine = 1;
  314. }
  315. yLine = dyLine;
  316. dwNextTime = GetCurrentTime(); // time to do the next scroll
  317. lScroll = 0;
  318. iEncrypt = 0;
  319. for ( ;; ) {
  320. /*
  321. ** If the user clicks the mouse or hits a key, exit.
  322. */
  323. if (PeekMessage( &msg, hwnd, WM_KEYFIRST, WM_KEYLAST,
  324. PM_NOREMOVE | PM_NOYIELD)) {
  325. break; // exit on key hit
  326. }
  327. if (PeekMessage(&msg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST,
  328. PM_NOREMOVE | PM_NOYIELD)) {
  329. if ( (msg.message == WM_MOUSEMOVE) ||
  330. (msg.message == WM_NCMOUSEMOVE) ) {
  331. /* remove and ignore message */
  332. PeekMessage(&msg, hwnd, msg.message, msg.message,
  333. PM_REMOVE | PM_NOYIELD);
  334. }
  335. else {
  336. break; // exit on click
  337. }
  338. }
  339. /* scroll at a fixed no. of vertical pixels per sec. */
  340. if (dwNextTime > GetCurrentTime()) {
  341. continue;
  342. }
  343. dwNextTime += 50L; // millseconds per scroll
  344. if (yLine == dyLine) {
  345. /* decrypt a line and copy to achLine */
  346. pchDst = achLine;
  347. while (TRUE) {
  348. *pchDst = (char)(*pchSrc++ ^(128 | (iEncrypt++ & 127)));
  349. if ((*pchDst == '\r') || (*pchDst == EOFCHAR)) {
  350. break;
  351. }
  352. pchDst++;
  353. }
  354. if (*pchDst == EOFCHAR) {
  355. break; // no more lines
  356. }
  357. *pchDst = 0; // null-terminate
  358. pchSrc++, iEncrypt++; // skip '\n'
  359. yLine = 0;
  360. }
  361. /* scroll screen up one pixel */
  362. BitBlt( hdc, dxEdge, dyEdge,
  363. rcUpdate.right - dxEdge, rcUpdate.top - dxEdge,
  364. hdc, dxEdge, dyEdge + 1, SRCCOPY);
  365. /* vary the text colors through a "rainbow" */
  366. switch ( (int)(lScroll++ / 4) % 5 ) {
  367. case 0: rgb = RGB(255, 0, 0); break;
  368. case 1: rgb = RGB(255, 255, 0); break;
  369. case 2: rgb = RGB( 0, 255, 0); break;
  370. case 3: rgb = RGB( 0, 255, 255); break;
  371. case 4: rgb = RGB(255, 0, 255); break;
  372. }
  373. SetTextColor(hdc, rgb);
  374. /* fill in the bottom pixel */
  375. SaveDC(hdc);
  376. yLine++;
  377. IntersectClipRect(hdc, rcUpdate.left, rcUpdate.top,
  378. rcUpdate.right, rcUpdate.bottom);
  379. ExtTextOutA(hdc, rc.right / 2, rc.bottom - yLine,
  380. ETO_OPAQUE, &rcUpdate,
  381. achLine, lstrlenA(achLine), NULL);
  382. RestoreDC(hdc, -1);
  383. }
  384. RestoreDC(hdc, -1);
  385. ReleaseDC(hwnd, hdc);
  386. ReleaseCapture();
  387. InvalidateRect(hwnd, NULL, TRUE);
  388. SetFocus(hwndFocusSave);
  389. }
  390. /*****************************Private*Routine******************************\
  391. * LED_ToggleDisplayFont
  392. *
  393. * Toggles between the large and the small display font and erases the
  394. * background of the led display. This removes any sign of the old font.
  395. *
  396. * History:
  397. * 18-11-93 - StephenE - Created
  398. *
  399. \**************************************************************************/
  400. void
  401. LED_ToggleDisplayFont(
  402. HWND hwnd,
  403. BOOL fFont
  404. )
  405. {
  406. RECT rcLed;
  407. HDC hdcLed;
  408. hdcLed = GetDC( hwnd );
  409. GetClientRect( hwnd, &rcLed );
  410. SelectObject( hdcLed, fFont ? hLEDFontS : hLEDFontL );
  411. ReleaseDC( hwnd, hdcLed );
  412. InvalidateRect(hwnd, NULL, TRUE);
  413. UpdateWindow(hwnd);
  414. }
  415. /*****************************Private*Routine******************************\
  416. * LED_DrawText
  417. *
  418. * Draws the LED display screen text (quickly). The text is centered
  419. * vertically and horizontally. Only the backround is drawn if the g_fFlashed
  420. * flag is set.
  421. *
  422. * History:
  423. * 18-11-93 - StephenE - Created
  424. *
  425. \**************************************************************************/
  426. void
  427. LED_DrawText(
  428. HWND hwnd,
  429. LPCTSTR s,
  430. int sLen
  431. )
  432. {
  433. HDC hdcLed;
  434. RECT rc;
  435. RECT rcLed;
  436. SIZE sz;
  437. int xOrigin;
  438. int yOrigin;
  439. hdcLed = GetDC( hwnd );
  440. GetTextExtentPoint( hdcLed, s, sLen, &sz );
  441. GetClientRect( hwnd, &rcLed );
  442. xOrigin = (rcLed.right - sz.cx) / 2;
  443. yOrigin = (rcLed.bottom - sz.cy) / 2;
  444. rc.top = yOrigin;
  445. rc.bottom = rc.top + sz.cy;
  446. rc.left = 2;
  447. rc.right = rcLed.right - 3;
  448. SetBkColor( hdcLed, RGB(0x00,0x00,0x00) );
  449. if ( g_fFlashLed ) {
  450. ExtTextOut( hdcLed, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
  451. }
  452. else {
  453. ExtTextOut( hdcLed, xOrigin, yOrigin, ETO_OPAQUE, &rc, s, sLen, NULL);
  454. }
  455. ReleaseDC( hwnd, hdcLed );
  456. }
  457. /*****************************Private*Routine******************************\
  458. * LED_OnSetText
  459. *
  460. * Change the LED display text. Calling DefWindowProc ensures that the
  461. * window text is saved correctly.
  462. *
  463. * History:
  464. * 18-11-93 - StephenE - Created
  465. *
  466. \**************************************************************************/
  467. void
  468. LED_OnSetText(
  469. HWND hwnd,
  470. LPCTSTR lpszText
  471. )
  472. {
  473. DefWindowProc( hwnd, WM_SETTEXT, 0, (LPARAM)lpszText);
  474. LED_DrawText( hwnd, lpszText, _tcslen(lpszText) );
  475. }
  476. /*****************************Private*Routine******************************\
  477. * LED_CreateLEDFonts
  478. *
  479. * Small font is 12pt MS Sans Serif
  480. * Large font is 18pt MS Sans Serif
  481. *
  482. * History:
  483. * dd-mm-94 - StephenE - Created
  484. *
  485. \**************************************************************************/
  486. void
  487. LED_CreateLEDFonts(
  488. HDC hdc
  489. )
  490. {
  491. LOGFONT lf;
  492. int iLogPelsY;
  493. iLogPelsY = GetDeviceCaps( hdc, LOGPIXELSY );
  494. ZeroMemory( &lf, sizeof(lf) );
  495. lf.lfHeight = (-12 * iLogPelsY) / 72; /* 12pt */
  496. lf.lfWeight = 700; /* bold */
  497. lf.lfCharSet = ANSI_CHARSET;
  498. lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
  499. lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  500. lf.lfQuality = PROOF_QUALITY;
  501. lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
  502. _tcscpy( lf.lfFaceName, g_szAppFontName );
  503. hLEDFontS = CreateFontIndirect(&lf);
  504. lf.lfHeight = (-18 * iLogPelsY) / 72; /* 18 pt */
  505. lf.lfWeight = 400; /* normal */
  506. hLEDFontL = CreateFontIndirect(&lf);
  507. /*
  508. ** If can't create either font set up some sensible defaults.
  509. */
  510. if ( hLEDFontL == NULL || hLEDFontS == NULL ) {
  511. if ( hLEDFontL != NULL ) {
  512. DeleteObject( hLEDFontL );
  513. }
  514. if ( hLEDFontS != NULL ) {
  515. DeleteObject( hLEDFontS );
  516. }
  517. hLEDFontS = hLEDFontL = GetStockObject( ANSI_VAR_FONT );
  518. }
  519. }
  520. /* -------------------------------------------------------------------------
  521. ** Private functions for the Text class
  522. ** -------------------------------------------------------------------------
  523. */
  524. void
  525. Text_OnPaint(
  526. HWND hwnd
  527. );
  528. LRESULT CALLBACK
  529. TextWndProc(
  530. HWND hwnd,
  531. UINT message,
  532. WPARAM wParam,
  533. LPARAM lParam
  534. );
  535. void
  536. Text_OnSetText(
  537. HWND hwnd,
  538. LPCTSTR lpszText
  539. );
  540. void
  541. Text_OnSetFont(
  542. HWND hwndCtl,
  543. HFONT hfont,
  544. BOOL fRedraw
  545. );
  546. /******************************Public*Routine******************************\
  547. * Init_SJE_TextClass
  548. *
  549. * Called to register the text window class .
  550. * This function must be called before the CD Player dialog box is created.
  551. *
  552. * History:
  553. * 18-11-93 - StephenE - Created
  554. *
  555. \**************************************************************************/
  556. BOOL
  557. Init_SJE_TextClass(
  558. HINSTANCE hInst
  559. )
  560. {
  561. WNDCLASS wndclass;
  562. ZeroMemory( &wndclass, sizeof(wndclass) );
  563. /*
  564. ** Register the Text window.
  565. */
  566. wndclass.lpfnWndProc = TextWndProc;
  567. wndclass.hInstance = hInst;
  568. wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
  569. wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  570. wndclass.lpszClassName = g_szTextClassName;
  571. return RegisterClass( &wndclass );
  572. }
  573. /******************************Public*Routine******************************\
  574. * TextWndProc
  575. *
  576. * This routine handles the WM_PAINT and WM_SETTEXT messages
  577. * for the "Text" display window.
  578. *
  579. * History:
  580. * 18-11-93 - StephenE - Created
  581. *
  582. \**************************************************************************/
  583. LRESULT CALLBACK
  584. TextWndProc(
  585. HWND hwnd,
  586. UINT message,
  587. WPARAM wParam,
  588. LPARAM lParam
  589. )
  590. {
  591. switch( message ) {
  592. HANDLE_MSG( hwnd, WM_PAINT, Text_OnPaint );
  593. HANDLE_MSG( hwnd, WM_SETTEXT, Text_OnSetText );
  594. HANDLE_MSG( hwnd, WM_SETFONT, Text_OnSetFont );
  595. }
  596. return DefWindowProc( hwnd, message, wParam, lParam );
  597. }
  598. /*****************************Private*Routine******************************\
  599. * Text_OnPaint
  600. *
  601. *
  602. *
  603. * History:
  604. * 18-11-93 - StephenE - Created
  605. *
  606. \**************************************************************************/
  607. void
  608. Text_OnPaint(
  609. HWND hwnd
  610. )
  611. {
  612. PAINTSTRUCT ps;
  613. TCHAR s[128];
  614. int sLen;
  615. HDC hdc;
  616. RECT rc;
  617. HFONT hfont;
  618. HFONT hfontOrg;
  619. LONG lStyle;
  620. hdc = BeginPaint( hwnd, &ps );
  621. GetWindowRect( hwnd, &rc );
  622. MapWindowRect( GetDesktopWindow(), hwnd, &rc );
  623. lStyle = GetWindowLong( hwnd, GWL_STYLE );
  624. if ( lStyle & SS_GRAYRECT ) {
  625. PatB( hdc, 0, 0, rc.right , 1, rgbShadow );
  626. PatB( hdc, 0, 1, rc.right , 1, rgbHilight );
  627. }
  628. else {
  629. sLen = GetWindowText( hwnd, s, 128 );
  630. hfont = (HFONT)GetWindowLong( hwnd, GWL_USERDATA );
  631. if ( hfont ) {
  632. hfontOrg = SelectObject( hdc, hfont );
  633. }
  634. /*
  635. ** Draw a frame around the window
  636. */
  637. DrawEdge( hdc, &rc, EDGE_SUNKEN, BF_RECT );
  638. /*
  639. ** Draw the text
  640. */
  641. SetBkColor( hdc, GetSysColor( COLOR_BTNFACE ) );
  642. SetTextColor( hdc, GetSysColor( COLOR_WINDOWTEXT ) );
  643. rc.left = 1 + (2 * GetSystemMetrics(SM_CXBORDER));
  644. DrawText( hdc, s, sLen, &rc,
  645. DT_NOPREFIX | DT_LEFT | DT_VCENTER |
  646. DT_NOCLIP | DT_SINGLELINE );
  647. if ( hfontOrg ) {
  648. SelectObject( hdc, hfontOrg );
  649. }
  650. }
  651. EndPaint( hwnd, &ps );
  652. }
  653. /*****************************Private*Routine******************************\
  654. * Text_OnSetText
  655. *
  656. * Change the text. Calling DefWindowProc ensures that the
  657. * window text is saved correctly.
  658. *
  659. * History:
  660. * 18-11-93 - StephenE - Created
  661. *
  662. \**************************************************************************/
  663. void
  664. Text_OnSetText(
  665. HWND hwnd,
  666. LPCTSTR lpszText
  667. )
  668. {
  669. DefWindowProc( hwnd, WM_SETTEXT, 0, (LPARAM)lpszText);
  670. InvalidateRect( hwnd, NULL, TRUE );
  671. UpdateWindow( hwnd );
  672. }
  673. /*****************************Private*Routine******************************\
  674. * Text_OnSetFont
  675. *
  676. * Sets the windows font
  677. *
  678. * History:
  679. * 18-11-93 - StephenE - Created
  680. *
  681. \**************************************************************************/
  682. void
  683. Text_OnSetFont(
  684. HWND hwnd,
  685. HFONT hfont,
  686. BOOL fRedraw
  687. )
  688. {
  689. SetWindowLong( hwnd, GWL_USERDATA, (LONG)hfont );
  690. if ( fRedraw ) {
  691. InvalidateRect( hwnd, NULL, TRUE );
  692. UpdateWindow( hwnd );
  693. }
  694. }