/*++ Copyright (c) 1996 Microsoft Corporation Module Name: dlgdvsel.c Abstract: This file implements the dialog proc for the workstation device selection page. Environment: WIN32 User Mode Author: Wesley Witt (wesw) 17-Feb-1996 --*/ #include "wizard.h" #pragma hdrstop LRESULT DeviceSelectionDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { static HWND hwndList; static DWORD TotalDevicesSelected; switch( msg ) { case WM_INITDIALOG: { HIMAGELIST himlState; int iItem = 0; DWORD i; LV_ITEM lvi; LV_COLUMN lvc = {0}; for (i=0,lvi.iItem=0,TotalDevicesSelected=0; icode ) { case PSN_SETACTIVE: if (Unattended) { SetWindowLong( hwnd, DWL_MSGRESULT, -1 ); return TRUE; } if (InstallMode & INSTALL_UPGRADE || InstallMode & INSTALL_REMOVE || FaxDevices == 1) { SetWindowLong( hwnd, DWL_MSGRESULT, -1 ); return TRUE; } break; case NM_CLICK: { DWORD dwpos; LV_HITTESTINFO lvhti; int iItemClicked; UINT state; // // Find out where the cursor was // dwpos = GetMessagePos(); lvhti.pt.x = LOWORD(dwpos); lvhti.pt.y = HIWORD(dwpos); MapWindowPoints( HWND_DESKTOP, hwndList, &lvhti.pt, 1 ); // // Now do a hittest with this point. // iItemClicked = ListView_HitTest( hwndList, &lvhti ); if (lvhti.flags & LVHT_ONITEMSTATEICON) { // // Now lets get the state from the item and toggle it. // state = ListView_GetItemState( hwndList, iItemClicked, LVIS_STATEIMAGEMASK ); if (state == LVIS_GCCHECK) { // // de-selecting a device // if (TotalDevicesSelected == 1) { MessageBeep(0); break; } TotalDevicesSelected -= 1; LineInfo[iItemClicked].Selected = FALSE; ListView_SetItemState( hwndList, iItemClicked, LVIS_GCNOCHECK, LVIS_STATEIMAGEMASK ); } else { // // selecting a new device // if (RequestedSetupType & FAX_INSTALL_WORKSTATION && TotalDevicesSelected == MAX_DEVICES_NTW) { MessageBeep(0); break; } TotalDevicesSelected += 1; LineInfo[iItemClicked].Selected = TRUE; ListView_SetItemState( hwndList, iItemClicked, LVIS_GCNOCHECK, LVIS_STATEIMAGEMASK ); } } } } break; } return FALSE; }