#include "windows.h" /* required for all Windows applications */ #include "windowsx.h" /* required for all Windows applications */ #include <shellapi.h> #include <string.h> #include <stdlib.h> #include <sys\stat.h> #include <sys\timeb.h> // For extended timer definitions #include <time.h> #include <stdio.h> #include <io.h> #include "winrouti.h" #define SPACE " " void VIERTO32(int); extern BYTE BitMapBits[24][1024]; extern HBITMAP hBitmap[24]; extern BITMAPINFOHEADER Bi; extern LPBITMAPINFOHEADER lpbi; extern HANDLE hDIB[24]; extern HWND hwnd; extern unsigned long kleurtbl[]; extern int xco, yco; extern int dHeight; extern unsigned char rvenster_ylo, rvenster_xrb; extern char scherm[50][99]; extern BOOL bPlane[24]; extern HFONT hFont; extern unsigned int VTO32L, VTO32H; extern unsigned long VTO32; void SetByte(unsigned int offset, BYTE waarde, int mode) { HDC hdc; unsigned int data1, data2; int welke; char tekst[80]; // if (waarde != 0) // strcpy(tekst, "_"); switch (mode) { case 0x10: // beeld vergroten tot x * 2 en y * 3 // 128 * 64 punten data1 = ACHTTO32L(waarde); data2 = ACHTTO32H(waarde); welke = offset / 256; offset = offset % 256; offset *= 4; bPlane[welke] = TRUE; lpbi = (BITMAPINFOHEADER FAR *) GlobalLock(hDIB[welke]); BitMapBits[welke][offset] = HIBYTE(data1); BitMapBits[welke][offset+1] = LOBYTE(data1); BitMapBits[welke][offset+2] = HIBYTE(data2); BitMapBits[welke][offset+3] = LOBYTE(data2); GlobalUnlock(hDIB[welke]); break; case 0x40: data1 = ACHTTO32L(waarde); data2 = ACHTTO32H(waarde); welke = offset / 256; offset = offset % 256; offset *= 4; bPlane[welke] = TRUE; lpbi = (BITMAPINFOHEADER FAR *) GlobalLock(hDIB[welke]); BitMapBits[welke][offset] = HIBYTE(data1); BitMapBits[welke][offset+1] = LOBYTE(data1); BitMapBits[welke][offset+2] = HIBYTE(data2); BitMapBits[welke][offset+3] = LOBYTE(data2); GlobalUnlock(hDIB[welke]); break; case 0x4a: VIERTO32(waarde); welke = offset / 256; offset = offset % 256; offset *= 4; bPlane[welke] = TRUE; lpbi = (BITMAPINFOHEADER FAR *) GlobalLock(hDIB[welke]); BitMapBits[welke][offset] = LOBYTE(VTO32L); BitMapBits[welke][offset+1] = HIBYTE(VTO32L); BitMapBits[welke][offset+2] = LOBYTE(VTO32H); BitMapBits[welke][offset+3] = HIBYTE(VTO32H); // BitMapBits[welke][offset] = (unsigned long) VTO32; GlobalUnlock(hDIB[welke]); break; case 0x3a: VIERTO32(waarde); welke = offset / 256; offset = offset % 256; offset *= 4; bPlane[welke] = TRUE; lpbi = (BITMAPINFOHEADER FAR *) GlobalLock(hDIB[welke]); BitMapBits[welke][offset] = LOBYTE(VTO32L); BitMapBits[welke][offset+1] = HIBYTE(VTO32L); BitMapBits[welke][offset+2] = LOBYTE(VTO32H); BitMapBits[welke][offset+3] = HIBYTE(VTO32H); // BitMapBits[welke][offset] = (unsigned long) VTO32; GlobalUnlock(hDIB[welke]); break; } } void clear0w() { wClear(); } Void wait160() { DWORD dTime; MSG usermsg; dTime = GetTickCount(); while ((GetTickCount() - dTime) < 60) { if (PeekMessage(&usermsg, NULL, 0, 0, PM_REMOVE)) { if (usermsg.message == WM_CHAR) break; TranslateMessage (&usermsg) ; DispatchMessage (&usermsg) ; } } } int Audit(char *functie, char *data, int status, int regel) { int return_code; FILE *file1; char buffer1[250]; char buffer2[100]; time_t timer; struct tm htm; char logname[12]; timer = time(NULL); htm = *(localtime(&timer)); itoa(htm.tm_yday, logname, 10); strcat(logname, ".log"); if ((file1 = fopen(logname, "a+")) == NULL) { return FALSE; } else { sprintf(buffer2, "Stamp: %02d:%02d:%02d 19%02d", htm.tm_hour, htm.tm_min, htm.tm_sec, htm.tm_year); sprintf(buffer1, "%s: %s: %s Status: %2d Regel: %5d.\n", buffer2, functie, data, status, regel); fwrite(buffer1, strlen(buffer1), 1, file1); fclose(file1); } return TRUE; } void wClear() { HDC hdc; DWORD bkcolor, fgcolor; HFONT hOldFont; HideCaret (hwnd) ; hdc = GetDC (hwnd) ; bkcolor = GetBkColor(hdc); fgcolor = GetTextColor(hdc); SetBkColor(hdc, kleurtbl[0]); SetTextColor(hdc, kleurtbl[7]); hOldFont =(HFONT)SelectObject(hdc, hFont); for (yco=0; yco<rvenster_ylo; yco++) { TextOut (hdc, 0, yco * dHeight, SPACE, rvenster_xrb); memset(scherm[0], ' ', sizeof(scherm)); } SetBkColor(hdc, bkcolor); SetTextColor(hdc, fgcolor); SelectObject(hdc, hOldFont); ReleaseDC (hwnd, hdc) ; } void WinBiep(int hoogte, int duur) { // MessageBeep(0); } void settimers(HWND hWnd) { if (SetTimer(hWnd, 1, 50, NULL) == 0) { MessageBox(hWnd, "Geen timers over voor grafische modes", "Error", MB_OK); } } void resettimer(HWND hWnd) { KillTimer(hWnd, 1); } |