home *** CD-ROM | disk | FTP | other *** search
/ ftp.sberbank.sumy.ua / 2014.11.ftp.sberbank.sumy.ua.tar / ftp.sberbank.sumy.ua / incoming / 1 / KEYSEQT.c < prev    next >
C/C++ Source or Header  |  2014-02-08  |  7KB  |  338 lines

  1. #include <windows.h>
  2. #include <time.h>
  3. #include <stdio.h>
  4. #include <io.h>
  5.  
  6.  
  7. LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
  8.  
  9.  
  10.  
  11. char szClassName[ ] = "EvgeneyVictorovichKupin-27-06-1982-WindowsApp";
  12.  
  13. int MIN = 27163000;
  14. int MAX = 27163001;
  15. int Stop;
  16. HDC hDC;
  17. int Base = 0;
  18. int Format;
  19.  
  20. void Display320x240d24BitDibBmp()
  21. {
  22.  int x, y, number;
  23.  int RGB;
  24.  FILE *pFile;
  25.  int hFile;
  26.  struct _finddata_t c_file;
  27.  char buffer[128];
  28.  
  29.  
  30.    Stop = 0xffffffff;
  31.  
  32.  for( number = MIN; (number < MAX) && (Stop != 0); number++)
  33.   {
  34.    sprintf( buffer, "%08d%s", number, ".bmp");
  35.  
  36.    hFile = _findfirst( buffer, &c_file);
  37.    if(hFile == -1L) continue;
  38.    _findclose(hFile);
  39.  
  40.  
  41.    pFile = fopen( buffer,"rb");
  42.  
  43.    if( pFile == 0) continue;
  44.  
  45.    fseek( pFile , 54, SEEK_SET);
  46.  
  47.    for( y = 240-1; y >=0 ; y--)
  48.     for( x = 0; x < 320; x++)
  49.      {
  50.       fread ( &RGB, 1, 3, pFile);
  51.   //    Beep( RGB, 1);
  52.       RGB = RGB & 0xffffff;
  53.       SetPixel( hDC, x, y, RGB);
  54.        }
  55.  
  56.    fclose (pFile);
  57.  }
  58.    return;
  59.  }
  60.  
  61. void Display320x240d24BitBmp()
  62. {
  63.  int x, y, number;
  64.  int RGB;
  65.  FILE *pFile;
  66.  int hFile;
  67.  struct _finddata_t c_file;
  68.  char buffer[128];
  69.  
  70.  
  71.    Stop = 0xffffffff;
  72.  
  73.  for( number = MIN; (number < MAX) && (Stop != 0); number++)
  74.   {
  75.    sprintf( buffer, "%08d%s", number, ".bmp");
  76.  
  77.    hFile = _findfirst( buffer, &c_file);
  78.    if(hFile == -1L) continue;
  79.    _findclose(hFile);
  80.  
  81.  
  82.    pFile = fopen( buffer,"rb");
  83.  
  84.    if( pFile == 0) continue;
  85.  
  86.    fseek( pFile , 54, SEEK_SET);
  87.  
  88.    for( y = 0; y < 240; y++)
  89.     for( x = 0; x < 320; x++)
  90.      {
  91.       fread ( &RGB, 1, 3, pFile);
  92.   //    Beep( RGB, 1);
  93.       RGB = RGB & 0xffffff;
  94.       SetPixel( hDC, x, y, RGB);
  95.        }
  96.  
  97.    fclose (pFile);
  98.  }
  99.  
  100.    return;
  101.  }
  102.  
  103. void Display640x480d24BitDibBmp()
  104. {
  105.  int x, y, number;
  106.  int RGB;
  107.  FILE *pFile;
  108.  int hFile;
  109.  struct _finddata_t c_file;
  110.  char buffer[128];
  111.  
  112.  
  113.    Stop = 0xffffffff;
  114.  
  115.  for( number = MIN; (number < MAX) && (Stop != 0); number++)
  116.   {
  117.    sprintf( buffer, "%08d%s", number, ".bmp");
  118.  
  119.    hFile = _findfirst( buffer, &c_file);
  120.    if(hFile == -1L) continue;
  121.    _findclose(hFile);
  122.  
  123.  
  124.    pFile = fopen( buffer,"rb");
  125.  
  126.    if( pFile == 0) continue;
  127.  
  128.    fseek( pFile , 54, SEEK_SET);
  129.  
  130.    for( y = 480-1; y >= 0; y--)
  131.     for( x = 0; x < 640; x++)
  132.      {
  133.       fread( &RGB, 1, 3, pFile);
  134.   //    Beep( RGB, 1);
  135.       RGB = RGB & 0xffffff;
  136.       SetPixel( hDC, x, y, RGB);
  137.        }
  138.  
  139.    fclose (pFile);
  140.   }
  141.  
  142.    return;
  143.  }
  144.  
  145. void Display640x480d24BitBmp()
  146. {
  147.  int x, y, number;
  148.  int RGB;
  149.  FILE *pFile;
  150.  int hFile;
  151.  struct _finddata_t c_file;
  152.  char buffer[128];
  153.  
  154.  
  155.    Stop = 0xffffffff;
  156.  
  157.  for( number = MIN; (number < MAX) && (Stop != 0); number++)
  158.   {
  159.    sprintf( buffer, "%08d%s", number, ".bmp");
  160.  
  161.    hFile = _findfirst( buffer, &c_file);
  162.    if(hFile == -1L) continue;
  163.    _findclose(hFile);
  164.  
  165.  
  166.    pFile = fopen( buffer,"rb");
  167.  
  168.    if( pFile == 0) continue;
  169.  
  170.    fseek( pFile , 54, SEEK_SET);
  171.  
  172.    for( y = 0; y < 480; y++)
  173.     for( x = 0; x < 640; x++)
  174.      {
  175.       fread ( &RGB, 1, 3, pFile);
  176.     //  Beep( RGB, 1);
  177.       RGB = RGB & 0xffffff;
  178.       SetPixel( hDC, x, y, RGB);
  179.        }
  180.  
  181.    fclose (pFile);
  182.  }
  183.    return;
  184.  }
  185.  
  186.  
  187. int WINAPI WinMain (HINSTANCE hThisInstance,
  188.                     HINSTANCE hPrevInstance,
  189.                     LPSTR lpszArgument,
  190.                     int nFunsterStil)
  191.  
  192. {
  193.     HWND hwnd;
  194.     MSG messages;
  195.     WNDCLASSEX wincl;
  196.  
  197.     Base = 0;
  198.     wincl.hInstance = hThisInstance;
  199.     wincl.lpszClassName = szClassName;
  200.     wincl.lpfnWndProc = WindowProcedure;
  201.     wincl.style = CS_DBLCLKS;
  202.     wincl.cbSize = sizeof (WNDCLASSEX);
  203.  
  204.  
  205.     wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
  206.     wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
  207.     wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
  208.     wincl.lpszMenuName = NULL;                 /* No menu */
  209.     wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
  210.     wincl.cbWndExtra = 0;                      /* structure or the window instance */
  211.  
  212.     wincl.hbrBackground = (HBRUSH) COLOR_WINDOW;
  213.  
  214.  
  215.     if (!RegisterClassEx (&wincl))
  216.         return 0;
  217.  
  218.  
  219.     hwnd = CreateWindowEx (
  220.            0,                   /* Extended possibilites for variation */
  221.            szClassName,         /* Classname */
  222.            "<o>",       /* Title Text */
  223.            WS_OVERLAPPEDWINDOW, /* default window */
  224.            CW_USEDEFAULT,       /* Windows decides the position */
  225.            CW_USEDEFAULT,       /* where the window ends up on the screen */
  226.            660,                 /* The programs width */
  227.            550,                 /* and height in pixels */
  228.            HWND_DESKTOP,        /* The window is a child-window to desktop */
  229.            NULL,                /* No menu */
  230.            hThisInstance,       /* Program Instance handler */
  231.            NULL                 /* No Window Creation data */
  232.            );
  233.  
  234.     ShowWindow (hwnd, nFunsterStil);
  235.  
  236.      while (GetMessage (&messages, NULL, 0, 0))
  237.     {
  238.         TranslateMessage(&messages);
  239.         DispatchMessage(&messages);
  240.     }
  241.  
  242.  
  243.     return messages.wParam;
  244. }
  245.  
  246.  
  247. LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  248. {
  249.  PAINTSTRUCT ps;
  250.  FILE *pFile;
  251.  char buffer[20];
  252.  int number, ss, i;
  253.  int m, d, y;
  254.  char cCurrDate;
  255.  
  256.     switch (message)
  257.     {
  258.         case WM_CREATE:
  259.  
  260.              strdate( buffer);
  261.  
  262.              buffer[2] = 0;
  263.              m = atol( buffer);
  264.              buffer[5] = 0;
  265.              d = atol( buffer+3);
  266.              buffer[8] = 0;
  267.              y = atol( buffer+6);
  268.              m = m + (( y / 10)*10);
  269.              y = y % 10;
  270.  
  271.  
  272.              MIN = (((d*1000)+(m*10)+y)*1000);
  273.  
  274.            //  sprintf( buffer, "%d", MIN);
  275.            //  MessageBox( hwnd, buffer, buffer, MB_OK );
  276.  
  277.              Format = 2;
  278.              MAX = MIN + 789;
  279.  
  280.         if( 6 != 6)
  281.           {
  282.             number = 0;
  283.             ss = 0;
  284.  
  285.           for( number = 0; number < 0xffffffff; number++)
  286.            {
  287.             sprintf( buffer, "%08d%s", number, ".txt");
  288.             pFile = fopen( buffer,"rb");
  289.  
  290.            if((pFile == 0) && ( ss != 0)) break;
  291.            if( pFile == 0) continue;
  292.            if( pFile != 0) ss = 78;
  293.  
  294.            for( i = 0; i < 20; i++) buffer[i] = 0;
  295.  
  296.             fread ( buffer, 1, 1, pFile);
  297.             Format = atoi( buffer);
  298.  
  299.             fread ( buffer, 1, 8, pFile);
  300.             MIN = atoi( buffer);
  301.          //   MessageBox( hwnd, buffer, buffer, MB_OK);
  302.             fread ( buffer, 1, 8, pFile);
  303.             MAX = atoi( buffer);
  304.  
  305.             fclose( pFile);
  306.             }
  307.            }
  308.  
  309.             return 0;
  310.  
  311.         case WM_PAINT:
  312.             hDC = BeginPaint( hwnd, &ps);
  313.  
  314.            if( Format == 1)
  315.             {
  316.              Display320x240d24BitDibBmp();
  317.              Display320x240d24BitBmp();
  318.              }
  319.  
  320.            if( Format == 2)
  321.             {
  322.              Display640x480d24BitDibBmp();
  323.              Display640x480d24BitBmp();
  324.              }
  325.  
  326.             EndPaint( hwnd, &ps);
  327.             return 0;
  328.  
  329.         case WM_DESTROY:
  330.             PostQuitMessage (0);
  331.             break;
  332.         default:
  333.             return DefWindowProc (hwnd, message, wParam, lParam);
  334.     }
  335.  
  336.     return 0;
  337. }
  338.