/* File gentab.c Implements the ui behind the general tab for the connections dialup server ui. Paul Mayfield, 10/2/97 */ #include "rassrv.h" #include // Help maps static const DWORD phmGenTab[] = { CID_GenTab_LV_Devices, IDH_GenTab_LV_Devices, CID_GenTab_CB_Multilink, IDH_GenTab_CB_Multilink, CID_GenTab_PB_Properties, IDH_GenTab_PB_Properties, CID_GenTab_CB_Vpn, IDH_GenTab_CB_Vpn, CID_GenTab_CB_ShowIcons, IDH_GenTab_CB_ShowIcons, 0, 0 }; // Fills in the property sheet structure with the information // required to display the general tab. // DWORD GenTabGetPropertyPage( IN LPPROPSHEETPAGE ppage, IN LPARAM lpUserData) { // Initialize ZeroMemory(ppage, sizeof(PROPSHEETPAGE)); // Fill in the values ppage->dwSize = sizeof(PROPSHEETPAGE); ppage->hInstance = Globals.hInstDll; ppage->pszTemplate = MAKEINTRESOURCE(PID_GenTab); ppage->pfnDlgProc = GenTabDialogProc; ppage->pfnCallback = RasSrvInitDestroyPropSheetCb; ppage->lParam = lpUserData; ppage->dwFlags = PSP_USECALLBACK; return NO_ERROR; } // Error reporting // VOID GenTabDisplayError( IN HWND hwnd, IN DWORD dwErr) { ErrDisplayError( hwnd, dwErr, ERR_GENERALTAB_CATAGORY, 0, Globals.dwErrorData); } // // Returns the index of an to display icon based on the type of incoming // connection and whether or not it should be checked. // INT GenTabGetIconIndex( IN DWORD dwType, IN BOOL bEnabled) { if (dwType == INCOMING_TYPE_PHONE) { return DI_Phone; } else { return DI_Direct; } } // // Fills in the device list with the list of the devices stored in the // device database. Also, initializes the checked/unchecked status // of each device. // DWORD GenTabFillDeviceList( IN HWND hwndDlg, IN HWND hwndLV, IN HANDLE hDevDatabase) { LV_ITEM lvi; LV_COLUMN lvc; DWORD dwCount, i, dwErr, dwType; HANDLE hDevice; PWCHAR pszName; char pszAName[1024]; BOOL bEnabled; // Get the count of all the users dwErr = devGetDeviceCount(hDevDatabase, &dwCount); if (dwErr != NO_ERROR) { GenTabDisplayError(hwndLV, ERR_DEVICE_DATABASE_CORRUPT); return dwErr; } // Initialize the list item ZeroMemory(&lvi, sizeof(LV_ITEM)); lvi.mask = LVIF_TEXT | LVIF_IMAGE; // If there are devices to display then populate the list box // with them if (dwCount > 0) { ListView_SetDeviceImageList(hwndLV, Globals.hInstDll); // Looop through all of the devices adding them to the list for (i=0; icode) { // // Note: PSN_APPLY and PSN_CANCEL are handled // by RasSrvMessageFilter // case PSN_SETACTIVE: // Initailize the dialog if it isn't already // if (! GetWindowLongPtr(hwndDlg, GWLP_USERDATA)) { GenTabInitializeDialog(hwndDlg, wParam, lParam); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)1); } if (GenTabSetActive (hwndDlg)) return TRUE; break; // The check of an item is changing case LVXN_SETCHECK: pLvNotifyData = (NM_LISTVIEW*)lParam; GenTabHandleDeviceCheck( hwndDlg, pLvNotifyData->iItem); break; case LVXN_DBLCLK: pLvNotifyData = (NM_LISTVIEW*)lParam; GenTabRaiseProperties( hwndDlg, pLvNotifyData->iItem); break; } } break; case WM_COMMAND: GenTabCommand(hwndDlg, wParam); break; } return FALSE; }