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 >
Wrap
C/C++ Source or Header
|
2014-02-08
|
7KB
|
338 lines
#include <windows.h>
#include <time.h>
#include <stdio.h>
#include <io.h>
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "EvgeneyVictorovichKupin-27-06-1982-WindowsApp";
int MIN = 27163000;
int MAX = 27163001;
int Stop;
HDC hDC;
int Base = 0;
int Format;
void Display320x240d24BitDibBmp()
{
int x, y, number;
int RGB;
FILE *pFile;
int hFile;
struct _finddata_t c_file;
char buffer[128];
Stop = 0xffffffff;
for( number = MIN; (number < MAX) && (Stop != 0); number++)
{
sprintf( buffer, "%08d%s", number, ".bmp");
hFile = _findfirst( buffer, &c_file);
if(hFile == -1L) continue;
_findclose(hFile);
pFile = fopen( buffer,"rb");
if( pFile == 0) continue;
fseek( pFile , 54, SEEK_SET);
for( y = 240-1; y >=0 ; y--)
for( x = 0; x < 320; x++)
{
fread ( &RGB, 1, 3, pFile);
// Beep( RGB, 1);
RGB = RGB & 0xffffff;
SetPixel( hDC, x, y, RGB);
}
fclose (pFile);
}
return;
}
void Display320x240d24BitBmp()
{
int x, y, number;
int RGB;
FILE *pFile;
int hFile;
struct _finddata_t c_file;
char buffer[128];
Stop = 0xffffffff;
for( number = MIN; (number < MAX) && (Stop != 0); number++)
{
sprintf( buffer, "%08d%s", number, ".bmp");
hFile = _findfirst( buffer, &c_file);
if(hFile == -1L) continue;
_findclose(hFile);
pFile = fopen( buffer,"rb");
if( pFile == 0) continue;
fseek( pFile , 54, SEEK_SET);
for( y = 0; y < 240; y++)
for( x = 0; x < 320; x++)
{
fread ( &RGB, 1, 3, pFile);
// Beep( RGB, 1);
RGB = RGB & 0xffffff;
SetPixel( hDC, x, y, RGB);
}
fclose (pFile);
}
return;
}
void Display640x480d24BitDibBmp()
{
int x, y, number;
int RGB;
FILE *pFile;
int hFile;
struct _finddata_t c_file;
char buffer[128];
Stop = 0xffffffff;
for( number = MIN; (number < MAX) && (Stop != 0); number++)
{
sprintf( buffer, "%08d%s", number, ".bmp");
hFile = _findfirst( buffer, &c_file);
if(hFile == -1L) continue;
_findclose(hFile);
pFile = fopen( buffer,"rb");
if( pFile == 0) continue;
fseek( pFile , 54, SEEK_SET);
for( y = 480-1; y >= 0; y--)
for( x = 0; x < 640; x++)
{
fread( &RGB, 1, 3, pFile);
// Beep( RGB, 1);
RGB = RGB & 0xffffff;
SetPixel( hDC, x, y, RGB);
}
fclose (pFile);
}
return;
}
void Display640x480d24BitBmp()
{
int x, y, number;
int RGB;
FILE *pFile;
int hFile;
struct _finddata_t c_file;
char buffer[128];
Stop = 0xffffffff;
for( number = MIN; (number < MAX) && (Stop != 0); number++)
{
sprintf( buffer, "%08d%s", number, ".bmp");
hFile = _findfirst( buffer, &c_file);
if(hFile == -1L) continue;
_findclose(hFile);
pFile = fopen( buffer,"rb");
if( pFile == 0) continue;
fseek( pFile , 54, SEEK_SET);
for( y = 0; y < 480; y++)
for( x = 0; x < 640; x++)
{
fread ( &RGB, 1, 3, pFile);
// Beep( RGB, 1);
RGB = RGB & 0xffffff;
SetPixel( hDC, x, y, RGB);
}
fclose (pFile);
}
return;
}
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
Base = 0;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
wincl.hbrBackground = (HBRUSH) COLOR_WINDOW;
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"<o>", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
660, /* The programs width */
550, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
ShowWindow (hwnd, nFunsterStil);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
FILE *pFile;
char buffer[20];
int number, ss, i;
int m, d, y;
char cCurrDate;
switch (message)
{
case WM_CREATE:
strdate( buffer);
buffer[2] = 0;
m = atol( buffer);
buffer[5] = 0;
d = atol( buffer+3);
buffer[8] = 0;
y = atol( buffer+6);
m = m + (( y / 10)*10);
y = y % 10;
MIN = (((d*1000)+(m*10)+y)*1000);
// sprintf( buffer, "%d", MIN);
// MessageBox( hwnd, buffer, buffer, MB_OK );
Format = 2;
MAX = MIN + 789;
if( 6 != 6)
{
number = 0;
ss = 0;
for( number = 0; number < 0xffffffff; number++)
{
sprintf( buffer, "%08d%s", number, ".txt");
pFile = fopen( buffer,"rb");
if((pFile == 0) && ( ss != 0)) break;
if( pFile == 0) continue;
if( pFile != 0) ss = 78;
for( i = 0; i < 20; i++) buffer[i] = 0;
fread ( buffer, 1, 1, pFile);
Format = atoi( buffer);
fread ( buffer, 1, 8, pFile);
MIN = atoi( buffer);
// MessageBox( hwnd, buffer, buffer, MB_OK);
fread ( buffer, 1, 8, pFile);
MAX = atoi( buffer);
fclose( pFile);
}
}
return 0;
case WM_PAINT:
hDC = BeginPaint( hwnd, &ps);
if( Format == 1)
{
Display320x240d24BitDibBmp();
Display320x240d24BitBmp();
}
if( Format == 2)
{
Display640x480d24BitDibBmp();
Display640x480d24BitBmp();
}
EndPaint( hwnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}