home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / windows / winterm / info.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-11  |  2.1 KB  |  81 lines

  1. /*** info.c ***/
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include "windows.h"
  6. #include "info.h"
  7.  
  8. extern HWND hInfoWnd;
  9.  
  10. static char Temp[20];
  11.  
  12. static char ASstring[19] = " Bytes:            ";
  13. static char XYstring[19] = "Packet:            ";
  14. static struct
  15.   {char FileName[19];
  16.    char FileSize[19];
  17.    char Packet[19];
  18.    char Errors[19];
  19.    char Status[19];
  20.   } InfoData = {"F'Name:            ",
  21.                 "F'Size:            ",
  22.                 "Packet:            ",
  23.                 "Errors:            ",
  24.                 "Status:            "};
  25.  
  26. void InfoChoose(char Which)
  27. {if(Which=='A')
  28.  strcpy(&InfoData.Packet[0],ASstring);
  29.  else strcpy(&InfoData.Packet[0],XYstring);
  30. }
  31.  
  32. void InfoFileName(char *Ptr)
  33. {lstrcpy(&InfoData.FileName[8],Ptr);
  34. }
  35.  
  36. void InfoFileSize(long Size)
  37. {sprintf(Temp,"%ld  ",Size);
  38.  lstrcpy(&InfoData.FileSize[8],Temp);
  39. }
  40.  
  41. void InfoPacket(unsigned int Packet)
  42. {sprintf(Temp,"%u  ",Packet);
  43.  lstrcpy(&InfoData.Packet[8],Temp);
  44. }
  45.  
  46. void InfoBytes(unsigned int Bytes)
  47. {InfoPacket(Bytes);
  48. }
  49.  
  50. void InfoErrors(int Errors)
  51. {sprintf(Temp,"%d  ",Errors);
  52.  lstrcpy(&InfoData.Errors[8],Temp);
  53. }
  54.  
  55. void InfoStatus(char *Ptr)
  56. {lstrcpy(&InfoData.Status[8],Ptr);
  57. }
  58.  
  59. long FAR PASCAL InfoWndProc(HWND hWnd,UINT iMessage, UINT wParam, LONG lParam)
  60. {HDC  hDC;
  61.  hInfoWnd = hWnd;
  62.  switch(iMessage)
  63.    {case WM_USER:
  64.       hDC = GetDC(hInfoWnd);
  65.       SetMapMode(hDC,MM_ANISOTROPIC);
  66.       SelectObject(hDC, GetStockObject(OEM_FIXED_FONT) );
  67.       TextOut(hDC, 0,  0, InfoData.FileName, strlen(InfoData.FileName) );
  68.       TextOut(hDC, 0, 15, InfoData.FileSize, strlen(InfoData.FileSize) );
  69.       TextOut(hDC, 0, 30, InfoData.Packet,   strlen(InfoData.Packet) );
  70.       TextOut(hDC, 0, 45, InfoData.Errors,   strlen(InfoData.Errors) );
  71.       TextOut(hDC, 0, 60, InfoData.Status,   strlen(InfoData.Status) );
  72.       ReleaseDC(hInfoWnd,hDC);
  73.       break;
  74.     case WM_DESTROY:
  75.       PostQuitMessage(0);
  76.       break;
  77.     default:
  78.       return DefWindowProc(hInfoWnd,iMessage,wParam,lParam);
  79.    } /* end switch */
  80.  return 0L;
  81. } /* end InfoWndProc */