Annotation of mstools/samples/sdktools/perfmon/chosecom.c, revision 1.1.1.1

1.1       root        1: /*****************************************************************************
                      2:  *
                      3:  *  ChoseCom.c - This module handles the Dialog user interactions for the
                      4:  *    choose computers within a log file
                      5:  *
                      6:  *  Microsoft Confidential
                      7:  *  Copyright (c) 1992-1993 Microsoft Corporation
                      8:  *
                      9:  ****************************************************************************/
                     10: 
                     11:  
                     12: //==========================================================================//
                     13: //                                  Includes                                //
                     14: //==========================================================================//
                     15: 
                     16: 
                     17: #include "perfmon.h"       // basic defns, windows.h
                     18: 
                     19: #include "dlgs.h"          // common dialog control IDs
                     20: #include "playback.h"      // for PlayingBackLog
                     21: #include "pmhelpid.h"      // Help IDs
                     22: #include "utils.h"         // for CallWinHelp
                     23: 
                     24: static LPTSTR  lpChooseComputerText ;
                     25: static DWORD   TextLength ;
                     26: 
                     27: //==========================================================================//
                     28: //                              Message Handlers                            //
                     29: //==========================================================================//
                     30: 
                     31: 
                     32: void static OnInitDialog (HDLG hDlg)
                     33:    {
                     34:    // build the listbox of computers wintin the log file
                     35:    BuildLogComputerList (hDlg, IDD_CHOOSECOMPUTERLISTBOX) ;
                     36: 
                     37:    // set the scroll limit on the edit box
                     38:    EditSetLimit (GetDlgItem(hDlg, IDD_CHOOSECOMPUTERNAME), TextLength-1) ;
                     39: 
                     40:    dwCurrentDlgID = HC_PM_idDlgLogComputerList ;
                     41: 
                     42:    WindowCenter (hDlg) ;
                     43:    }  // OnInitDialog
                     44: 
                     45: void static OnOK (HDLG hDlg)
                     46:    {
                     47: 
                     48:    GetDlgItemText (hDlg,
                     49:       IDD_CHOOSECOMPUTERNAME,
                     50:       lpChooseComputerText,
                     51:       TextLength-1) ;
                     52: 
                     53:    }  // OnOK
                     54: 
                     55: void OnComputerSelectionChanged (HWND hDlg)
                     56:    {
                     57:    TCHAR localComputerName [MAX_COMPUTERNAME_LENGTH + 3] ;
                     58:    int   SelectedIndex ;
                     59:    HWND  hWndLB = GetDlgItem (hDlg, IDD_CHOOSECOMPUTERLISTBOX) ;
                     60: 
                     61:    // get the listbox selection and put it in the editbox
                     62:    SelectedIndex = LBSelection (hWndLB) ;
                     63:    if (SelectedIndex != LB_ERR)
                     64:       {
                     65:       localComputerName[0] = TEXT('\0') ;
                     66:       if (LBString (hWndLB, SelectedIndex, localComputerName) != LB_ERR &&
                     67:          localComputerName[0])
                     68:          {
                     69:          SetDlgItemText (hDlg, IDD_CHOOSECOMPUTERNAME, localComputerName) ;
                     70:          }
                     71:       }
                     72:    }  // OnComputerSelectionChanged
                     73: 
                     74: BOOL FAR PASCAL ChooseLogComputerDlgProc(HWND hDlg, WORD msg, DWORD wParam, LONG lParam)
                     75:    {
                     76: 
                     77:    switch (msg)
                     78:       {
                     79:       case WM_INITDIALOG:
                     80:          OnInitDialog (hDlg) ;
                     81:          break ;
                     82: 
                     83:       case WM_COMMAND:
                     84:          switch (LOWORD(wParam))
                     85:             {
                     86:             case IDOK:
                     87:                OnOK (hDlg) ;
                     88:                dwCurrentDlgID = 0 ;
                     89:                EndDialog (hDlg, TRUE) ;
                     90:                return (TRUE) ;
                     91:                break ;
                     92: 
                     93:             case IDCANCEL:
                     94:                dwCurrentDlgID = 0 ;
                     95:                EndDialog (hDlg, FALSE) ;
                     96:                return (TRUE) ;
                     97: 
                     98:             case ID_HELP:
                     99:                CallWinHelp (dwCurrentDlgID) ;
                    100:                break ;
                    101: 
                    102:             case IDD_CHOOSECOMPUTERLISTBOX:
                    103:                if (HIWORD (wParam) == LBN_SELCHANGE)
                    104:                   OnComputerSelectionChanged (hDlg) ;
                    105:                break ;
                    106: 
                    107:             default:
                    108:                break;
                    109: 
                    110:             }
                    111:          break ;
                    112: 
                    113: 
                    114:       default:
                    115:          break ;
                    116:       }
                    117: 
                    118:    return (FALSE) ;
                    119:    }  // ChooseLogComputerDlgProc
                    120: 
                    121: 
                    122: BOOL GetLogFileComputer (HWND hWndParent, LPTSTR lpComputerName, DWORD BufferSize)
                    123:    {
                    124:    BOOL  bSuccess ;
                    125:    DWORD LocalDlgID = dwCurrentDlgID ;
                    126: 
                    127:    // initialize some globals
                    128:    *lpComputerName = TEXT('\0') ;
                    129:    lpChooseComputerText = lpComputerName ;
                    130:    TextLength = BufferSize ;
                    131: 
                    132:    bSuccess = DialogBox (hInstance,
                    133:       idDlgChooseComputer,
                    134:       hWndParent,
                    135:       (DLGPROC)ChooseLogComputerDlgProc) ;
                    136: 
                    137:    dwCurrentDlgID = LocalDlgID ;
                    138: 
                    139:    if (*lpComputerName == '\0')
                    140:       {
                    141:       bSuccess = FALSE ;
                    142:       }
                    143: 
                    144:    return (bSuccess) ;
                    145:    }  // GetLogFileComputer
                    146: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.