home *** CD-ROM | disk | FTP | other *** search
/ What PC? 1996 April / WHAT_PC_APR_96.ISO / internet / twinsock / src / showprot.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-21  |  1.8 KB  |  82 lines

  1. /*
  2.  *  TwinSock - "Troy's Windows Sockets"
  3.  *
  4.  *  Copyright (C) 1994-1995  Troy Rollo <troy@cbme.unsw.EDU.AU>
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the license in the file LICENSE.TXT included
  8.  *  with the TwinSock distribution.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
  13.  */
  14. #include <windows.h>
  15. #include <stdio.h>
  16.  
  17. extern    short    nInSeq;
  18. extern    short    nOutSeq;
  19.  
  20. extern    long    nCRCErrors;
  21. extern    long    nRetransmits;
  22. extern    long    nTimeouts;
  23. extern    long    nInsane;
  24. extern    long    nIncomplete;
  25.  
  26. extern    long    nBytesRecvd;
  27. extern    long    nDiscarded;
  28.  
  29. extern    HINSTANCE hinst;
  30.  
  31. void    SetValue(HWND hDlg,
  32.          int idControl,
  33.          long iValue)
  34. {
  35.     char    achTemp[40];
  36.  
  37.     sprintf(achTemp, "%ld", iValue);
  38.     SetDlgItemText(hDlg, idControl, achTemp);
  39. }
  40.          
  41.  
  42. BOOL    CALLBACK
  43. ProtoDlgProc(    HWND    hDlg,
  44.         UINT    wMsg,
  45.         WPARAM    wParam,
  46.         LPARAM    lParam)
  47. {
  48.     if (wMsg == WM_COMMAND &&
  49.         (wParam == IDOK || wParam == IDCANCEL))
  50.     {
  51.         EndDialog(hDlg, TRUE);
  52.         return TRUE;
  53.     }
  54.     else if (wMsg == WM_INITDIALOG)
  55.     {
  56.         SetValue(hDlg, 100, nOutSeq);
  57.         SetValue(hDlg, 101, nInSeq);
  58.         SetValue(hDlg, 102, nCRCErrors);
  59.         SetValue(hDlg, 103, nRetransmits);
  60.         SetValue(hDlg, 104, nTimeouts);
  61.         SetValue(hDlg, 105, nInsane);
  62.         SetValue(hDlg, 106, nIncomplete);
  63.         SetValue(hDlg, 107, nBytesRecvd);
  64.         SetValue(hDlg, 108, nDiscarded);
  65.         return TRUE;
  66.     }
  67.     else
  68.     {
  69.         return FALSE;
  70.     }
  71. }
  72.  
  73. void
  74. ShowProtoInfo(HWND hwndParent)
  75. {
  76.     FARPROC    fpDlgProc;
  77.  
  78.     fpDlgProc = MakeProcInstance((FARPROC) ProtoDlgProc, hinst);
  79.     DialogBox(hinst, "PROTO_DLG", hwndParent, fpDlgProc);
  80.     FreeProcInstance(fpDlgProc);
  81. }
  82.