Annotation of truecrypt/format/redtick.c, revision 1.1.1.1

1.1       root        1: /* Copyright (C) 2004 TrueCrypt Team, truecrypt.org
                      2:    This product uses components written by Paul Le Roux <[email protected]> */
                      3: 
                      4: #include "TCdefs.h"
                      5: #include "redtick.h"
                      6: 
                      7: LRESULT CALLBACK
                      8: RedTick (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                      9: {
                     10:   if (uMsg == WM_CREATE)
                     11:     {
                     12:     }
                     13:   else if (uMsg == WM_DESTROY)
                     14:     {
                     15:     }
                     16:   else if (uMsg == WM_TIMER)
                     17:     {
                     18:     }
                     19:   else if (uMsg == WM_PAINT)
                     20:     {
                     21:       PAINTSTRUCT tmp;
                     22:       HPEN hPen;
                     23:       HDC hDC;
                     24:       BOOL bEndPaint;
                     25:       RECT Rect;
                     26: 
                     27:       if (GetUpdateRect (hwnd, NULL, FALSE))
                     28:        {
                     29:          hDC = BeginPaint (hwnd, &tmp);
                     30:          bEndPaint = TRUE;
                     31:          if (hDC == NULL)
                     32:            return DefWindowProc (hwnd, uMsg, wParam, lParam);
                     33:        }
                     34:       else
                     35:        {
                     36:          hDC = GetDC (hwnd);
                     37:          bEndPaint = FALSE;
                     38:        }
                     39: 
                     40:       GetClientRect (hwnd, &Rect);
                     41: 
                     42:       hPen = CreatePen (PS_SOLID, 2, RGB (0, 255, 0));
                     43:       if (hPen != NULL)
                     44:        {
                     45:          HGDIOBJ hObj = SelectObject (hDC, hPen);
                     46:          WORD bx = LOWORD (GetDialogBaseUnits ());
                     47:          WORD by = HIWORD (GetDialogBaseUnits ());
                     48: 
                     49:          MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
                     50:          LineTo (hDC, Rect.right, Rect.top);
                     51:          MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
                     52: 
                     53:          LineTo (hDC, (3 * bx) / 4, (2 * by) / 8);
                     54: 
                     55:          SelectObject (hDC, hObj);
                     56:          DeleteObject (hPen);
                     57:        }
                     58: 
                     59:       if (bEndPaint == TRUE)
                     60:        EndPaint (hwnd, &tmp);
                     61:       else
                     62:        ReleaseDC (hwnd, hDC);
                     63: 
                     64:       return TRUE;
                     65:     }
                     66: 
                     67:   return DefWindowProc (hwnd, uMsg, wParam, lParam);
                     68: }
                     69: 
                     70: BOOL
                     71: RegisterRedTick (HINSTANCE hInstance)
                     72: {
                     73:   WNDCLASS wc;
                     74:   ULONG rc;
                     75: 
                     76:   memset(&wc, 0 , sizeof wc);
                     77: 
                     78:   wc.style = CS_HREDRAW | CS_VREDRAW;
                     79:   wc.cbClsExtra = 0;
                     80:   wc.cbWndExtra = 4;
                     81:   wc.hInstance = hInstance;
                     82:   wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
                     83:   wc.hCursor = NULL;
                     84:   wc.hbrBackground = GetStockObject (LTGRAY_BRUSH);
                     85:   wc.lpszClassName = "REDTICK";
                     86:   wc.lpfnWndProc = &RedTick; 
                     87:   
                     88:   rc = (ULONG) RegisterClass (&wc);
                     89: 
                     90:   return rc == 0 ? FALSE : TRUE;
                     91: }
                     92: 
                     93: BOOL
                     94: UnregisterRedTick (HINSTANCE hInstance)
                     95: {
                     96:   return UnregisterClass ("REDTICK", hInstance);
                     97: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.