//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by mcp040.rc // #define IDC_MYICON 2 #define IDD_MCP040_DIALOG 102 #define IDS_APP_TITLE 103 #define IDD_ABOUTBOX 103 #define IDM_ABOUT 104 #define IDM_EXIT 105 #define IDI_MCP040 107 #define IDI_SMALL 108 #define IDC_MCP040 109
#define IDR_MAINFRAME 128
#define IDCANCELABOUT 1003 #define IDC_STATIC -1
#define IDD_OK_BUTTON 1025 #define IDC_TEXT_MEAL 1026 #define IDD_CANCEL_BUTTON 1027 #define IDD_ADD_DIALOG 1028 #define IDD_OK_BUTTON1 1029 #define IDC_TEXT_VST 1030 #define IDD_CANCEL_BUTTON1 1031 #define IDD_ADD_DIALOG1 1032 #define IDD_OK_BUTTON2 1033 #define IDC_TEXT_TNA 1034 #define IDD_CANCEL_BUTTON2 1035 #define IDD_ADD_DIALOG2 1036 #define IDD_OK_BUTTON3 1037 #define IDC_TEXT_PRS 1038 #define IDD_CANCEL_BUTTON3 1039 #define IDD_ADD_DIALOG3 1040 #define IDD_OK_BUTTON4 1041 #define IDC_TEXT_BAN 1042 #define IDD_CANCEL_BUTTON4 1043 #define IDD_ADD_DIALOG4 1044 #define IDD_OK_BUTTON5 1045 #define IDC_TEXT_ZONE 1046 #define IDD_CANCEL_BUTTON5 1047 #define IDD_ADD_DIALOG5 1048
#define IDC_HEADER_TEXT1 1054 #define IDC_CODE1 1055 #define IDC_NAME1 1056 #define IDC_AUTH_TYPE 1057 #define IDC_COMB_TYPE 1058 #define IDC_CHECK_FINGERPRINT 1059 #define IDC_CHECK_FP_CARD 1060 #define IDC_CHECK_PASSWORD 1061 #define IDC_CHECK_CARD 1162 #define IDC_CHECK_FACE 1063 #define IDC_CHECK_MOBILE_CARD 1064 #define IDC_CHECK_ZONE1 1422 #define IDC_ZONE1_TIME 1421 #define IDC_CHECK_ZONE2 1424 #define IDC_ZONE2_TIME 1423 #define IDC_CHECK_ZONE3 1426 #define IDC_ZONE3_TIME 1425 #define IDC_INITIALIZE_BTN1 1071 #define IDC_APPLY_BTN1 1072 #define IDC_CLOSE_BTN1 1073 #define IDC_TIMELINE1 1074 #define IDC_ZONE4_TIME 1427 #define IDC_ZONE5_TIME 1429 #define IDC_ZONE6_TIME 1431 #define IDC_ZONE7_TIME 1433 #define IDC_ZONE8_TIME 1435 #define IDC_ZONE9_TIME 1437 #define IDC_ZONE10_TIME 1439 #define IDC_ZONE11_TIME 1441 #define IDC_ZONE12_TIME 1443 #define IDC_CHECK_ZONE4 1428 #define IDC_CHECK_ZONE5 1430 #define IDC_CHECK_ZONE6 1432 #define IDC_CHECK_ZONE7 1434 #define IDC_CHECK_ZONE8 1436 #define IDC_CHECK_ZONE9 1438 #define IDC_CHECK_ZONE10 1440 #define IDC_CHECK_ZONE11 1442 #define IDC_CHECK_ZONE12 1444
#define IDC_HEADER_TEXT2 1085 #define IDC_CODE2 1086 #define IDC_NAME2 1087 #define IDC_APPLY_BTN2 1088 #define IDC_CLOSE_BTN2 1089 #define IDC_SUNDAY_COMBO 1090 #define IDC_SUNDAY_TIMELINE 1091 #define IDC_MONDAY_COMBO 1092 #define IDC_MONDAY_TIMELINE 1093 #define IDC_TUESDAY_COMBO 1094 #define IDC_TUESDAY_TIMELINE 1095 #define IDC_HOLIDAY_GROUP 1096 #define IDC_HOLIDAY_GROUP_TIMELINE 1097 #define IDC_HOLIDAY_COMBO 1098 #define IDC_HOLIDAY_TIMELINE 1099 #define IDC_WEDNESDAY_COMBO 1100 #define IDC_WEDNESDAY_TIMELINE 1101 #define IDC_THURSDAY_COMBO 1102 #define IDC_THURSDAY_TIMELINE 1103 #define IDC_FRIDAY_COMBO 1104 #define IDC_FRIDAY_TIMELINE 1105 #define IDC_SATURDAY_COMBO 1106 #define IDC_SATURDAY_TIMELINE 1107
#define IDC_HEADER_TEXT3 1109 #define IDC_CODE3 1110 #define IDC_NAME3 1111 #define IDC_DOOR1 1112 #define IDC_DOOR2 1113 #define IDC_DOOR3 1114 #define IDC_DOOR4 1115 #define IDC_TERMINAL_LIST3 1116 #define IDC_APPLY_BTN3 1117 #define IDC_CLOSE_BTN3 1118
#define IDC_HEADER_TEXT4 1119 #define IDC_CODE4 1120 #define IDC_NAME4 1121 #define IDC_TERMINAL_LIST4 1122 #define IDC_APPLY_BTN4 1123 #define IDC_CLOSE_BTN4 1124
#define IDC_HEADER_TEXT5 1125 #define IDC_CODE5 1126 #define IDC_NAME5 1127 #define IDC_APPLY_BTN5 1128 #define IDC_CLOSE_BTN5 1129 #define IDC_ACCESS5 1130 #define IDC_AUTH_TYPE5 1131 #define IDC_COMB_TYPE5 1132 #define IDC_CHECK_FINGERPRINT5 1133 #define IDC_CHECK_FP_CARD5 1134 #define IDC_CHECK_PASSWORD5 1135 #define IDC_CHECK_CARD5 1136 #define IDC_CHECK_FACE5 1137 #define IDC_CHECK_MOBILE_CARD5 1138 //timezone constexpr auto IDC_TEXTBOX = 1001; constexpr auto IDC_SEND_BUTTON1 = 1200; constexpr auto IDC_SEND_BUTTON2 = 1201; constexpr auto IDC_SEND_BUTTON3 = 1202; constexpr auto IDC_SEND_BUTTON4 = 1204; constexpr auto IDC_SEND_BUTTON5 = 1205; constexpr auto IDC_LOGBOX = 1003; constexpr auto IDC_TABCONTROL = 1004; constexpr auto IDC_ADD_TIMEZONE = 1005; constexpr auto IDC_DEL_TIMEZONE = 1006; constexpr auto IDC_TIMEZONE_LIST = 1007; //accesstime constexpr auto IDC_ADD_ACCESSTIME = 1008; constexpr auto IDC_DEL_ACCESSTIME = 1009; constexpr auto IDC_ACCESSTIME_LIST = 1010; //accessarea constexpr auto IDC_ADD_ACCESSAREA = 1011; constexpr auto IDC_DEL_ACCESSAREA = 1012; constexpr auto IDC_ACCESSAREA_LIST = 1013; //accessgroup constexpr auto IDC_ADD_ACCESSGROUP = 1014; constexpr auto IDC_DEL_ACCESSGROUP = 1015; constexpr auto IDC_ACCESSGROUP_LIST = 1016; //user constexpr auto IDC_ADD_USER = 1017; constexpr auto IDC_DEL_USER = 1018; //terminal constexpr auto ID_TABCONTROL2 = 1139; constexpr auto ID_COMBO_READER2 = 1140; constexpr auto ID_BUTTON_SAVE2 = 1141; constexpr auto ID_COMBO_ENTER_ZONE2 = 1142; constexpr auto ID_COMBO_EXIT_ZONE2 = 1143; constexpr auto ID_COMBO_TYPE2 = 1144; constexpr auto ID_EDIT_LOCKOUT_DURATION2 = 1145; constexpr auto ID_BUTTON_REFRESH2 = 1146; constexpr auto ID_BUTTON_APPLY2 = 1147; constexpr auto ID_BUTTON_CLOSE2 = 1148; constexpr auto ID_hText21 = 1149; constexpr auto ID_hText22 = 1150; constexpr auto ID_hText23 = 1151; constexpr auto ID_hText24 = 1152; //reader constexpr auto ID_COMBO_READERTYPE = 1153; constexpr auto IDC_CHECK_LOCK1 = 1154; constexpr auto IDC_CHECK_LOCK2 = 1155; constexpr auto IDC_CHECK_LOCK3 = 1156; constexpr auto IDC_CHECK_LOCK4 = 1157; constexpr auto IDC_CHECK_Partition1 = 1158; constexpr auto IDC_CHECK_Partition2 = 1159; constexpr auto IDC_CHECK_Partition3 = 1160; constexpr auto IDC_CHECK_Partition4 = 1161; constexpr auto ID_COMBO_MODE = 1162; constexpr auto ID_COMBO_ACCESSMODE = 1163; constexpr auto ID_COMBO_OPENTIME = 1164; constexpr auto ID_hText25 = 1165; constexpr auto ID_hText26 = 1166; constexpr auto ID_hText27 = 1167; constexpr auto ID_hText28 = 1168; constexpr auto ID_hText29 = 1169; constexpr auto ID_hText30 = 1170; //accesstimepartition constexpr auto ID_hText31 = 1171; constexpr auto ID_hText32 = 1172; constexpr auto ID_hText33 = 1173; constexpr auto ID_hText34 = 1174; constexpr auto ID_hText35 = 1175; constexpr auto ID_hText36 = 1176; constexpr auto ID_hText37 = 1177; constexpr auto ID_hText38 = 1178; constexpr auto ID_EDIT_NAME = 1179; constexpr auto ID_EDIT_ACCOUNT = 1180; constexpr auto ID_EDIT_ENTRY1 = 1181; constexpr auto ID_EDIT_ENTRY2 = 1182; constexpr auto ID_EDIT_EXIT1 = 1183; constexpr auto ID_EDIT_EXIT2 = 1184; constexpr auto ID_EDIT_SIREN = 1185; constexpr auto ID_EDIT_ALARM = 1186; constexpr auto IDC_CHECK_ENABLE = 1187; constexpr auto IDC_CHECK_CHIME = 1188; constexpr auto IDC_CHECK_UNLOCKONDISARM = 1189; //zone constexpr auto ID_hText39 = 1190; constexpr auto ID_BUTTON_SAVEPARTITION2 = 1191; constexpr auto ID_COMBO_PARTITION2 = 1192; constexpr auto ID_hText40 = 1193; constexpr auto ID_BUTTON_SAVEZONE2 = 1194; constexpr auto ID_COMBO_ZONE2 = 1195; constexpr auto ID_hText41 = 1300; constexpr auto ID_hText42 = 1301; constexpr auto ID_EDIT_NAMEZONE = 1302; constexpr auto ID_COMBO_ZONETYPE = 1303; constexpr auto IDC_CHECK_DOUBLE = 1304; constexpr auto ID_hText43 = 1305; constexpr auto IDC_CHECK_PARTITIONZONE1 = 1306; constexpr auto IDC_CHECK_PARTITIONZONE2 = 1307; constexpr auto IDC_CHECK_PARTITIONZONE3 = 1308; constexpr auto IDC_CHECK_PARTITIONZONE4 = 1309; //in/out put constexpr auto IDC_CHECK_RESPONSE = 1310; constexpr auto ID_hText44 = 1311; constexpr auto ID_hText45 = 1312; constexpr auto ID_hText46 = 1313; constexpr auto ID_hText47 = 1314; constexpr auto ID_hText48 = 1315; constexpr auto ID_hText49 = 1316; constexpr auto ID_hText50 = 1317; constexpr auto ID_hText51 = 1318; constexpr auto ID_BUTTON_SAVEINOUT1 = 1319; constexpr auto ID_COMBO_SAVEINOUT1 = 1320; constexpr auto ID_BUTTON_SAVEINOUT2 = 1321; constexpr auto ID_COMBO_SAVEINOUT2 = 1322; constexpr auto ID_COMBO_TYPEINOUT1 = 1323; constexpr auto ID_COMBO_TYPEINOUT2 = 1324; constexpr auto ID_EDIT_TimeInOut1 = 1325; constexpr auto ID_EDIT_ParameterInOut1 = 1326; constexpr auto ID_EDIT_TimeInOut2 = 1327; constexpr auto ID_EDIT_ParameterInOut2 = 1328; constexpr auto IDC_CHECK_INVERTEDINOUT = 1329; //locksetting constexpr auto ID_hText52 = 1330; constexpr auto ID_BUTTON_SAVELOCK2 = 1331; constexpr auto ID_COMBO_LOCK2 = 1332; constexpr auto ID_hText53 = 1333; constexpr auto ID_hText54 = 1334; constexpr auto ID_COMBO_MONITOR2 = 1335; constexpr auto ID_EDIT_OPENWARNING = 1336; constexpr auto IDC_CHECK_FORCED = 1337; //network constexpr auto IDC_CHECK_DHCP = 1338; constexpr auto IDC_CHECK_STATICIP = 1339; constexpr auto ID_hText55 = 1340; constexpr auto ID_hText56 = 1341; constexpr auto ID_hText57 = 1342; constexpr auto ID_hText58 = 1343; constexpr auto ID_hText59 = 1344; constexpr auto ID_EDIT_TERMINALIP = 1345; constexpr auto ID_EDIT_SUBNETMASK = 1346; constexpr auto ID_EDIT_GATEWAY = 1347; constexpr auto ID_EDIT_SERVERIP = 1348; constexpr auto ID_EDIT_SERVERPORT = 1349; //system constexpr auto IDC_CHECK_FORCEDARM = 1350; constexpr auto IDC_CHECK_ENDRES = 1351; constexpr auto IDC_CHECK_TIMESYNC = 1352; constexpr auto IDC_CHECK_INSIDEOPENLOG = 1353; constexpr auto IDC_CHECK_SERVERPASSBACK = 1354; constexpr auto IDC_CHECK_INTERLOCK = 1355; constexpr auto ID_hText60 = 1356; constexpr auto ID_hText61 = 1357; constexpr auto ID_EDIT_TERMINALID = 1358; constexpr auto ID_COMBO_AUTHMODE = 1359; //lock constexpr auto ID_COMBO_LOCKNUMBER = 1360; constexpr auto ID_hText62 = 1361; constexpr auto ID_EDIT_LOCK1 = 1362; constexpr auto ID_EDIT_LOCK2 = 1363; constexpr auto ID_EDIT_LOCK3 = 1364; constexpr auto ID_EDIT_OPEN1 = 1365; constexpr auto ID_EDIT_OPEN2 = 1366; constexpr auto ID_EDIT_OPEN3 = 1367; constexpr auto ID_hText63 = 1368; constexpr auto ID_hText64 = 1369; constexpr auto ID_hText65 = 1370; constexpr auto ID_COMBO_LOCKTYPE = 1371; constexpr auto ID_BUTTON_APPLYLOCK = 1372; //holiday constexpr auto ID_hText66 = 1373; constexpr auto ID_COMBO_HolidayTYPE = 1374; constexpr auto IDC_CALENDAR = 1375; constexpr auto IDC_Calendar_LIST = 1376; constexpr auto ID_BUTTON_ADDHOLIDAY = 1377; constexpr auto ID_BUTTON_DELHOLIDAY = 1378; //schedules constexpr auto ID_hText67 = 1379; constexpr auto ID_hText68 = 1380; constexpr auto ID_hText69 = 1381; constexpr auto ID_hText70 = 1382; constexpr auto ID_hText71 = 1383; constexpr auto ID_hText72 = 1384; constexpr auto ID_hText73 = 1385; constexpr auto ID_COMBO_HOURALARM = 1386; constexpr auto ID_COMBO_MINUTEALARM = 1387; constexpr auto ID_COMBO_ALARMSETTING = 1388; constexpr auto IDC_CHECK_DAYS1 = 1389; constexpr auto IDC_CHECK_DAYS2 = 1390; constexpr auto IDC_CHECK_DAYS3 = 1391; constexpr auto IDC_CHECK_DAYS4 = 1392; constexpr auto IDC_CHECK_DAYS5 = 1393; constexpr auto IDC_CHECK_DAYS6 = 1394; constexpr auto IDC_CHECK_DAYS7 = 1395; constexpr auto IDC_CHECK_DAYS8 = 1396; constexpr auto ID_COMBO_ALARMDURATION = 1397; constexpr auto IDC_CHECK_AAP1 = 1398; constexpr auto IDC_CHECK_AAP2 = 1399; constexpr auto IDC_CHECK_AAP3 = 1400; constexpr auto IDC_CHECK_AAP4 = 1401; constexpr auto IDC_CHECK_ADP1 = 1402; constexpr auto IDC_CHECK_ADP2 = 1403; constexpr auto IDC_CHECK_ADP3 = 1404; constexpr auto IDC_CHECK_ADP4 = 1405; constexpr auto IDC_CHECK_OUTPUT1 = 1406; constexpr auto IDC_CHECK_OUTPUT2 = 1407; constexpr auto IDC_CHECK_OUTPUT3 = 1408; constexpr auto IDC_CHECK_OUTPUT4 = 1409; constexpr auto IDC_CHECK_OUTPUT5 = 1410; constexpr auto IDC_CHECK_OUTPUT6 = 1411; constexpr auto IDC_CHECK_OUTPUT7 = 1412; constexpr auto IDC_CHECK_OUTPUT8 = 1413; constexpr auto ID_EDIT_NOTES = 1414; constexpr auto ID_BUTTON_ADDALARM = 1415; constexpr auto ID_BUTTON_MODALARM = 1416; constexpr auto ID_BUTTON_DELALARM = 1417; constexpr auto IDC_ALARM_LIST = 1418; constexpr auto ID_BUTTON_RETRIEVE = 1419; constexpr auto ID_BUTTON_SAVEALARM = 1420;
// Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 138 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 1004 #define _APS_NEXT_SYMED_VALUE 110 #endif #endif // Microsoft Visual C++ generated resource script. // #include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #ifndef APSTUDIO_INVOKED #include "targetver.h" #endif #define APSTUDIO_HIDDEN_SYMBOLS #include "windows.h" #undef APSTUDIO_HIDDEN_SYMBOLS
///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// // English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
///////////////////////////////////////////////////////////////////////////// // // Icon //
// Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_MCP040 ICON "mcp040.ico"
IDI_SMALL ICON "small.ico"
///////////////////////////////////////////////////////////////////////////// // // Menu //
IDC_MCP040 MENU BEGIN POPUP "&File" BEGIN MENUITEM "&Exit", IDM_EXIT END POPUP "&Help" BEGIN MENUITEM "&About ...", IDM_ABOUT END END
///////////////////////////////////////////////////////////////////////////// // // Accelerator //
IDC_MCP040 ACCELERATORS BEGIN "?", IDM_ABOUT, ASCII, ALT "/", IDM_ABOUT, ASCII, ALT END
///////////////////////////////////////////////////////////////////////////// // // Dialog //
IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About mcp040" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN ICON IDI_MCP040,IDC_STATIC,14,14,21,20 LTEXT "mcp040, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX LTEXT "Copyright (c) 2024",IDC_STATIC,42,26,114,8 DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP END
IDD_ADD_DIALOG DIALOGEX 0, 0, 600, 400 STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Access Control Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Set maximum of 12 time periods that can access in a day per code", IDC_HEADER_TEXT1, 20, 10, 560, 20, SS_CENTER | WS_BORDER
LTEXT "Code", IDC_STATIC, 20, 40, 30, 10 EDITTEXT IDC_CODE1, 60, 40, 100, 14, ES_AUTOHSCROLL LTEXT "Name", IDC_STATIC, 200, 40, 30, 10 EDITTEXT IDC_NAME1, 240, 40, 100, 14, ES_AUTOHSCROLL
LTEXT "Authentication Type", IDC_STATIC, 20, 70, 120, 10
LTEXT "Combination", IDC_STATIC, 140, 70, 50, 10 COMBOBOX IDC_COMB_TYPE, 200, 70, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL
CONTROL "Fingerprint", IDC_CHECK_FINGERPRINT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 100, 80, 10 CONTROL "FP-Card", IDC_CHECK_FP_CARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 120, 100, 80, 10 CONTROL "Password", IDC_CHECK_PASSWORD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 220, 100, 80, 10 CONTROL "Card", IDC_CHECK_CARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 320, 100, 50, 10 CONTROL "Face", IDC_CHECK_FACE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 100, 50, 10 CONTROL "MobileCard", IDC_CHECK_MOBILE_CARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 440, 100, 80, 10
LTEXT "Set Time", IDC_STATIC, 20, 130, 50, 10 CONTROL "Zone 1", IDC_CHECK_ZONE1, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 150, 60, 10 EDITTEXT IDC_ZONE1_TIME, 80, 150, 100, 14, CONTROL "Zone 5", IDC_CHECK_ZONE5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 200, 150, 60, 10 EDITTEXT IDC_ZONE5_TIME, 260, 150, 100, 14, CONTROL "Zone 9", IDC_CHECK_ZONE9, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 150, 60, 10 EDITTEXT IDC_ZONE9_TIME, 440, 150, 100, 14, CONTROL "Zone 2", IDC_CHECK_ZONE2, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 170, 60, 10 EDITTEXT IDC_ZONE2_TIME, 80, 170, 100, 14, CONTROL "Zone 6", IDC_CHECK_ZONE6, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 200, 170, 60, 10 EDITTEXT IDC_ZONE6_TIME, 260, 170, 100, 14, CONTROL "Zone 10", IDC_CHECK_ZONE10, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 170, 60, 10 EDITTEXT IDC_ZONE10_TIME, 440, 170, 100, 14, CONTROL "Zone 3", IDC_CHECK_ZONE3, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 190, 60, 10 EDITTEXT IDC_ZONE3_TIME, 80, 190, 100, 14, CONTROL "Zone 7", IDC_CHECK_ZONE7, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 200, 190, 60, 10 EDITTEXT IDC_ZONE7_TIME, 260,190, 100, 14, CONTROL "Zone 11", IDC_CHECK_ZONE11, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 190, 60, 10 EDITTEXT IDC_ZONE11_TIME, 440, 190, 100, 14, CONTROL "Zone 4", IDC_CHECK_ZONE4, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 210, 60, 10 EDITTEXT IDC_ZONE4_TIME, 80, 210, 100, 14, CONTROL "Zone 8", IDC_CHECK_ZONE8, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 200, 210, 60, 10 EDITTEXT IDC_ZONE8_TIME, 260, 210, 100, 14, CONTROL "Zone 12", IDC_CHECK_ZONE12, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 210, 60, 10 EDITTEXT IDC_ZONE12_TIME, 440, 210, 100, 14,
// Repeat the above pattern for Zones 4 through 12
PUSHBUTTON "Initialization", IDC_INITIALIZE_BTN1, 500, 70, 80, 20 PUSHBUTTON "Apply", IDC_APPLY_BTN1, 500, 40, 80, 20 PUSHBUTTON "Close", IDC_CLOSE_BTN1, 500, 100, 80, 20
CONTROL "", IDC_TIMELINE1, "Static", SS_CENTER | WS_BORDER, 20, 230, 560, 20 END
IDD_ADD_DIALOG2 DIALOGEX 0, 0, 600, 400 STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Access Time Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN // Header Text LTEXT "Set access time for weekdays and holidays per code. Set value will be applied when setting access group", IDC_HEADER_TEXT2, 20, 10, 560, 20, SS_CENTER | WS_BORDER
// Code and Name Inputs LTEXT "Code", IDC_STATIC, 20, 40, 30, 10 COMBOBOX IDC_CODE2, 60, 40, 100, 14, ES_AUTOHSCROLL LTEXT "Name", IDC_STATIC, 200, 40, 30, 10 EDITTEXT IDC_NAME2, 240, 40, 100, 14, ES_AUTOHSCROLL
// Buttons PUSHBUTTON "Apply", IDC_APPLY_BTN2, 400, 40, 80, 20 PUSHBUTTON "Close", IDC_CLOSE_BTN2, 500, 40, 80, 20
// Weekday Section Header LTEXT "Set Weekday", IDC_STATIC, 20, 80, 100, 10
// Weekday Rows LTEXT "Sunday", IDC_STATIC, 20, 100, 50, 10 COMBOBOX IDC_SUNDAY_COMBO, 80, 100, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_SUNDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 100, 300, 20
LTEXT "Monday", IDC_STATIC, 20, 130, 50, 10 COMBOBOX IDC_MONDAY_COMBO, 80, 130, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_MONDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 130, 300, 20
LTEXT "Tuesday", IDC_STATIC, 20, 160, 50, 10 COMBOBOX IDC_TUESDAY_COMBO, 80, 160, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_TUESDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 160, 300, 20
LTEXT "Wednesday", IDC_STATIC, 20, 190, 50, 10 COMBOBOX IDC_WEDNESDAY_COMBO, 80, 190, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_WEDNESDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 190, 300, 20
LTEXT "Thursday", IDC_STATIC, 20, 220, 50, 10 COMBOBOX IDC_THURSDAY_COMBO, 80, 220, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_THURSDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 220, 300, 20
LTEXT "Friday", IDC_STATIC, 20, 250, 50, 10 COMBOBOX IDC_FRIDAY_COMBO, 80, 250, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_FRIDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 250, 300, 20
LTEXT "Saturday", IDC_STATIC, 20, 280, 50, 10 COMBOBOX IDC_SATURDAY_COMBO, 80, 280, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_SATURDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 280, 300, 20 // Repeat rows for Wednesday, Thursday, Friday, and Saturday
// Holiday Section Header LTEXT "Set Holiday", IDC_STATIC, 20, 310, 100, 10
// Holiday Rows LTEXT "Holiday Group", IDC_STATIC, 20, 310, 80, 10 COMBOBOX IDC_HOLIDAY_GROUP, 80, 310, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_HOLIDAY_GROUP_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 310, 300, 20
LTEXT "Holiday", IDC_STATIC, 20, 340, 80, 10 COMBOBOX IDC_HOLIDAY_COMBO, 80, 340, 120, 50, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "", IDC_HOLIDAY_TIMELINE, "Static", SS_CENTER | WS_BORDER, 220, 340, 300, 20 END
IDD_ADD_DIALOG3 DIALOGEX 0, 0, 400, 300 STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Access Terminal Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN // Header Text LTEXT "set accessable terminal per code. Set value will be applied when setting access group", IDC_HEADER_TEXT3, 20, 10, 360, 20, SS_CENTER | WS_BORDER
// Code and Name Inputs LTEXT "Code", IDC_STATIC, 20, 40, 30, 10 COMBOBOX IDC_CODE3, 60, 40, 100, 14, ES_AUTOHSCROLL LTEXT "Name", IDC_STATIC, 200, 40, 30, 10 EDITTEXT IDC_NAME3, 240, 40, 100, 14, ES_AUTOHSCROLL
// Access Time Section GROUPBOX "Access Time", IDC_STATIC, 20, 70, 360, 100 LTEXT "Door 1", IDC_STATIC, 30, 90, 40, 10 COMBOBOX IDC_DOOR1, 80, 90, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL LTEXT "Door 2", IDC_STATIC, 30, 110, 40, 10 COMBOBOX IDC_DOOR2, 80, 110, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL LTEXT "Door 3", IDC_STATIC, 30, 130, 40, 10 COMBOBOX IDC_DOOR3, 80, 130, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL LTEXT "Door 4", IDC_STATIC, 30, 150, 40, 10 COMBOBOX IDC_DOOR4, 80, 150, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL
// Add Terminal Section GROUPBOX "Add Terminal", IDC_STATIC, 20, 180, 360, 80 CONTROL "List View", IDC_TERMINAL_LIST3, "SysListView32", LVS_REPORT | WS_BORDER | WS_TABSTOP | WS_VISIBLE, 30, 200, 340, 50
// Buttons PUSHBUTTON "Apply", IDC_APPLY_BTN3, 240, 270, 60, 20 PUSHBUTTON "Close", IDC_CLOSE_BTN3, 310, 270, 60, 20 END
IDD_ADD_DIALOG1 DIALOGEX 0, 0, 400, 300 STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Access Terminal Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN // Header Text LTEXT "set the access area to be included in the access group", IDC_HEADER_TEXT4, 20, 10, 360, 20, SS_CENTER | WS_BORDER
// Code and Name Inputs LTEXT "Code", IDC_STATIC, 20, 40, 30, 10 COMBOBOX IDC_CODE4, 60, 40, 100, 14, ES_AUTOHSCROLL LTEXT "Name", IDC_STATIC, 200, 40, 30, 10 EDITTEXT IDC_NAME4, 240, 40, 100, 14, ES_AUTOHSCROLL
// Add Terminal Section GROUPBOX "Add Access Area", IDC_STATIC, 20, 70, 360, 190 CONTROL "List View", IDC_TERMINAL_LIST4, "SysListView32", LBS_MULTIPLESEL | LVS_REPORT | WS_BORDER | WS_TABSTOP | WS_VISIBLE, 30, 90, 340, 160
// Buttons PUSHBUTTON "Apply", IDC_APPLY_BTN4, 240, 270, 60, 20 PUSHBUTTON "Close", IDC_CLOSE_BTN4, 310, 270, 60, 20 END
IDD_ADD_DIALOG4 DIALOGEX 0, 0, 500, 300 STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Add User" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN // Header Text LTEXT "Add employee's info", IDC_HEADER_TEXT5, 20, 10, 460, 20, SS_CENTER | WS_BORDER
// Code and Name Inputs LTEXT "Access Group", IDC_STATIC, 20, 40, 30, 20 COMBOBOX IDC_ACCESS5, 60, 40, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL LTEXT "ID", IDC_STATIC, 20, 70, 30, 10 COMBOBOX IDC_CODE5, 60, 70, 100, 14, ES_AUTOHSCROLL LTEXT "Name", IDC_STATIC, 20, 100, 30, 10 EDITTEXT IDC_NAME5, 60, 100, 100, 14, ES_AUTOHSCROLL PUSHBUTTON "Apply", IDC_APPLY_BTN5, 300, 200, 80, 20 PUSHBUTTON "Close", IDC_CLOSE_BTN5, 380, 200, 80, 20
LTEXT "Authentication Type", IDC_STATIC, 20, 130, 120, 10
LTEXT "Combination", IDC_STATIC, 140, 130, 50, 10 COMBOBOX IDC_COMB_TYPE5, 200, 130, 100, 50, CBS_DROPDOWNLIST | WS_VSCROLL
CONTROL "Fingerprint", IDC_CHECK_FINGERPRINT5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 20, 160, 80, 10 CONTROL "FP-Card", IDC_CHECK_FP_CARD5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 120, 160, 80, 10 CONTROL "Password", IDC_CHECK_PASSWORD5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 220, 160, 80, 10 CONTROL "Card", IDC_CHECK_CARD5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 320, 160, 50, 10 CONTROL "Face", IDC_CHECK_FACE5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 380, 160, 50, 10 CONTROL "MobileCard", IDC_CHECK_MOBILE_CARD5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 440, 160, 80, 10 END
///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO //
#ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_ABOUTBOX, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 163 TOPMARGIN, 7 BOTTOMMARGIN, 55 END
IDD_ADD_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
IDD_ADD_DIALOG2, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
IDD_ADD_DIALOG3, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
IDD_ADD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
IDD_ADD_DIALOG4, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
IDD_ADD_DIALOG5, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 302
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
END #endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE //
1 TEXTINCLUDE BEGIN "resource.h\0" END
2 TEXTINCLUDE BEGIN "#ifndef APSTUDIO_INVOKED\r\n" "#include ""targetver.h""\r\n" "#endif\r\n" "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""windows.h""\r\n" "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" "\0" END
3 TEXTINCLUDE BEGIN "\r\n" "\0" END
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// // // String Table //
STRINGTABLE BEGIN IDS_APP_TITLE "mcp040" IDC_MCP040 "MCP040" END
#endif // English (United States) resources /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. //
///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED
// mcp040_C.cpp : Defines the entry point for the application.
#include
constexpr auto MAX_LOADSTRING = 100; #define WM_SOCKET (WM_USER + 1) #define WM_RECEIVEDATA (WM_USER + 2) // Custom message for received data
// Global Variables:
HINSTANCE hInst; // current instance
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
// Winsock variables
SOCKET ConnectSocket = INVALID_SOCKET;
const char* serverAddress = "192.168.110.200"; // Server IP address
const int serverPort = 10888; // Server port
// UI controls
HWND hWnd;
HWND hWndTextBox;
HWND hWndSendButton;
HWND hWndLogBox;
HWND hTab;
HWND hTab2, hComboReader2, hButtonSave2, hComboEnterZone2, hComboExitZone2, hComboType2, hEditLockoutDuration2;
HWND hButtonRefresh2, hButtonApply2, hButtonClose2, hText21, hText22, hText23, hText24, hComboReaderType, hCheckBoxLock1, hCheckBoxLock2, hCheckBoxLock3, hCheckBoxLock4
, hCheckBoxPartition1, hCheckBoxPartition2, hCheckBoxPartition3, hCheckBoxPartition4, hComboMode, hComboAccessMode, hComboOpenTime, hText25, hText26, hText27, hText28
, hText29, hText30, hText31, hText32, hText33, hText34, hText35, hText36, hText37, hText38, hEditName, hEditAccount, hEditEntry1, hEditEntry2, hEditExit1, hEditExit2
, hEditSiren, hEditAlarm, hCheckBoxEnable, hCheckBoxChime, hCheckBoxUnlockOnDisarm, hButtonSavePartition2, hComboPartition2, hText39, hButtonSaveZone2, hComboZone2
, hText40, hEditNameZone, hText41, hText42, hText43, hComboZoneType, hCheckBoxResponse, hCheckBoxDouble, hCheckBoxPartitionZone1, hCheckBoxPartitionZone2
, hCheckBoxPartitionZone3, hCheckBoxPartitionZone4, hButtonSaveInOut1, hText44, hText45, hText46, hText47, hText48, hText49, hText50, hText51, hComboSaveInOut1
, hButtonSaveInOut2, hComboSaveInOut2, hComboTypeInOut1, hComboTypeInOut2, hEditTimeInOut1, hEditParameterInOut1, hEditTimeInOut2, hEditParameterInOut2, hCheckBoxInvertedInOut
, hText52, hText53, hText54, hButtonSaveLock2, hComboLock2, hCheckBoxForced, hComboMonitor2, hEditOpenWarning, hCheckBoxDHCP, hCheckBoxSTATICIP, hText55, hText56
, hText57, hText58, hText59, hEditTerminalIp, hEditSubnetMask, hEditGateway, hEditServerIp, hEditServerPort, hCheckBoxForcedArm, hCheckBoxEndRes, hCheckBoxTimeSync
, hCheckBoxInsideOpenLog, hCheckBoxServerPassback, hCheckBoxInterlock, hText60, hText61, hEditTerminalID, hComboAuthMode, hComboLockNumber, hText62, hText63, hText64, hText65
, hEditLock1, hEditLock2, hEditLock3, hEditOpen1, hEditOpen2, hEditOpen3, hComboLockType, hButtonApplyLock, hText66, hComboHolidayType, hCalendar, hWndLogCalendar
, hButtonAddHoliday, hButtonDelHoliday, hText67, hText68, hText69, hText70, hText71, hText72, hText73, hComboHourAlarm, hComboMinuteAlarm, hComboAlarmSetting
, hCheckBoxDays1, hCheckBoxDays2, hCheckBoxDays3, hCheckBoxDays4, hCheckBoxDays5, hCheckBoxDays6, hCheckBoxDays7, hCheckBoxDays8, hComboAlarmDuration, hCheckBoxAAP1
, hCheckBoxAAP2, hCheckBoxAAP3, hCheckBoxAAP4, hCheckBoxADP1, hCheckBoxADP2, hCheckBoxADP3, hCheckBoxADP4, hCheckBoxOUTPUT1, hCheckBoxOUTPUT2, hCheckBoxOUTPUT3
, hCheckBoxOUTPUT4, hCheckBoxOUTPUT5, hCheckBoxOUTPUT6, hCheckBoxOUTPUT7, hCheckBoxOUTPUT8, hEditNotes, hButtonAddAlarm, hButtonModAlarm, hButtonDelAlarm, hWndLogAlarm
, hButtonRetrieve, hButtonSaveAlarm, hWndSendTimeZoneButton, hWndSendAccessTimeButton, hWndSendAccessAreaButton, hWndSendAccessGroupButton, hWndSendUserButton
, hWndAddUserButton, hWndDeleteUserButton, hWndListUser, hWndListTimeZone, hWndListAccessTime, hWndListAcessArea, hWndListAcessGroup, hWndAddTimeZone, hWndDelTimeZone
, hWndAddAccessTime, hWndDelAccessTime, hWndAddAccessArea, hWndDelAccessArea, hWndAddAccessGroup, hWndDelAccessGroup;
wchar_t TimeZone_Code[5] = { 0 };
wchar_t TimeZone_Name[9] = { 0 };
wchar_t TimeZone_Zone[12][9] = { 0 };
wchar_t AccessTime_Code[5] = { 0 };
wchar_t AccessTime_Name[9] = { 0 };
wchar_t Weekdays_AccessTime[9][5] = {0};
bool isDialogOpen = false;
wchar_t AccessArea_Code[5] = { 0 };
wchar_t AccessArea_Name[9] = { 0 };
wchar_t AccessArea_Doors[4][5] = { 0 };
wchar_t AccessGroup_Code[5] = { 0 };
wchar_t AccessGroup_Name[9] = { 0 };
wchar_t User_Code[5] = { 0 };
wchar_t User_Name[9] = { 0 };
void AddTabs2(HWND hTab); INT_PTR CALLBACK AddDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: switch (LOWORD(wParam)) { case WM_INITDIALOG: return (INT_PTR)TRUE; case IDC_APPLY_BTN1: { TCHAR formattedString[1024] = { 0 }; // Ensure large enough buffer for all zones TCHAR zoneText[9] = { 0 }; // Temporary buffer for each zone value
// Retrieve Code and Name
GetDlgItemText(hDlg, IDC_CODE1, TimeZone_Code, _countof(TimeZone_Code));
GetDlgItemText(hDlg, IDC_NAME1, TimeZone_Name, _countof(TimeZone_Name));
// Start formatting with Code and Name
_stprintf_s(formattedString, _countof(formattedString), _T("Code: %s, Name: %s"), TimeZone_Code, TimeZone_Name);
// Iterate over all 12 zones
for (int i = 0; i < 12; i++) {
int checkboxID = IDC_CHECK_ZONE1 + i * 2; // Calculate checkbox ID
int textboxID = IDC_ZONE1_TIME + i * 2; // Calculate textbox ID
if (IsDlgButtonChecked(hDlg, checkboxID) == BST_CHECKED) {
// Retrieve the text from the corresponding textbox
GetDlgItemText(hDlg, textboxID, zoneText, _countof(zoneText));
// Check if zoneText is valid (non-empty)
if (_tcslen(zoneText) > 0) {
// Append the Zone and its value to formattedString
_stprintf_s(formattedString + _tcslen(formattedString),
_countof(formattedString) - _tcslen(formattedString),
_T(", Zone%d: %s"), i + 1, zoneText);
}
else {
MessageBox(hDlg, _T("A selected zone has no value!"), _T("Error"), MB_OK | MB_ICONERROR);
}
}
}
// Add the formatted string to the listbox in the parent dialog
HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with the actual parent window title
if (hParentWnd == NULL) {
MessageBox(hDlg, L"Failed to find parent window!", L"Error", MB_OK | MB_ICONERROR);
break;
}
HWND TimeZoneLog = GetDlgItem(hParentWnd, IDC_TIMEZONE_LIST);
if (TimeZoneLog == NULL) {
MessageBox(hDlg, L"Failed to find the listbox in the parent window!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Add the string to the listbox
SendMessageW(TimeZoneLog, LB_ADDSTRING, 0, (LPARAM)formattedString);
// Close the dialog
EndDialog(hDlg, 0);
}
break;
case IDC_CLOSE_BTN1:
{
// Close the dialog
EndDialog(hDlg, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
case WM_DESTROY:
{
//OutputDebugString(L"Dialog destroyed\n");
PostQuitMessage(0);
}
break;
}
return FALSE;
break;
}
} void PopulateDaysComboBoxes(HWND hDlg) { HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual title
HWND TimeZoneLog = GetDlgItem(hParentWnd, IDC_TIMEZONE_LIST);
TCHAR buffer[128]; // Buffer for listbox item text
int itemCount = SendMessage(TimeZoneLog, LB_GETCOUNT, 0, 0); // Number of items in listbox
if (itemCount == LB_ERR || itemCount <= 0) {
//MessageBoxW(hDlg, L"No items in the timezone list!", L"Error", MB_OK | MB_ICONERROR);
return;
}
// Array of combo box IDs for each day
int comboBoxIDs[] = {
IDC_SUNDAY_COMBO, IDC_MONDAY_COMBO, IDC_TUESDAY_COMBO,
IDC_WEDNESDAY_COMBO, IDC_THURSDAY_COMBO, IDC_FRIDAY_COMBO,
IDC_SATURDAY_COMBO,IDC_HOLIDAY_GROUP,IDC_HOLIDAY_COMBO
};
// Loop through each combo box
for (int i = 0; i < 9; i++) {
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]); // Handle to combo box
// Clear the current contents of the combo box
SendMessage(hComboBox, CB_RESETCONTENT, 0, 0);
// Add items from the timezone list to the combo box
for (int j = 0; j < itemCount; j++) {
SendMessage(TimeZoneLog, LB_GETTEXT, j, (LPARAM)buffer); // Get listbox item text
SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)buffer); // Add to combo box
}
}
//MessageBoxW(hDlg, L"Combo boxes populated successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
} void PopulateWeekdaysAccessTime(HWND hDlg) { int comboBoxIDs[] = { IDC_SUNDAY_COMBO, IDC_MONDAY_COMBO, IDC_TUESDAY_COMBO, IDC_WEDNESDAY_COMBO, IDC_THURSDAY_COMBO, IDC_FRIDAY_COMBO, IDC_SATURDAY_COMBO, IDC_HOLIDAY_GROUP, IDC_HOLIDAY_COMBO };
wchar_t Weekdays_AccessTime[9][5] = { 0 }; // Array to store extracted times
for (int i = 0; i < 9; i++) {
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]); // Get handle to the combo box
if (!hComboBox) {
MessageBox(hDlg, L"Combo box handle not found!", L"Error", MB_OK | MB_ICONERROR);
continue;
}
// Get the selected index
int selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
// Get the selected item's text
wchar_t selectedItem[128] = { 0 };
SendMessage(hComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)selectedItem);
// Extract characters from position 5 to 9
if (wcslen(selectedItem) >= 9) {
wcsncpy_s(Weekdays_AccessTime[i], selectedItem + 5, 4);
}
else {
wcscpy_s(Weekdays_AccessTime[i], L"0000"); // Default if insufficient characters
}
}
else {
wcscpy_s(Weekdays_AccessTime[i], L"0000"); // Default if no selection
}
}
} INT_PTR CALLBACK AddDialogProc2(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: PopulateDaysComboBoxes(hDlg); // Populate combo boxes during initialization return (INT_PTR)TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_APPLY_BTN2: { TCHAR formattedString[512] = { 0 }; TCHAR selectedItem[128] = { 0 }; // Buffer for combo box item text
// Handle Apply button logic
GetDlgItemText(hDlg, IDC_CODE2, AccessTime_Code, 5);
GetDlgItemText(hDlg, IDC_NAME2, AccessTime_Name, 9);
PopulateWeekdaysAccessTime(hDlg);
// Start formatting with Code and Name
_stprintf_s(formattedString, _countof(formattedString), _T("Code: %s, Name: %s"), AccessTime_Code, AccessTime_Name);
// Array of combo box IDs
const TCHAR* dayNames[] = {
_T("Sun"), _T("Mon"), _T("Tue"),
_T("Wed"), _T("Thu"), _T("Fri"),
_T("Sat"), _T("HoG"), _T("Hol")
};
int comboBoxIDs[] = {
IDC_SUNDAY_COMBO, IDC_MONDAY_COMBO, IDC_TUESDAY_COMBO,
IDC_WEDNESDAY_COMBO, IDC_THURSDAY_COMBO, IDC_FRIDAY_COMBO,
IDC_SATURDAY_COMBO, IDC_HOLIDAY_GROUP, IDC_HOLIDAY_COMBO
};
const int numComboBoxes = _countof(comboBoxIDs); // Use _countof for safety
for (int i = 0; i < numComboBoxes; i++) { // Use numComboBoxes for the loop
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]);
if (hComboBox) {
int selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
TCHAR selectedItem[128] = { 0 };
SendMessage(hComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)selectedItem);
TCHAR truncatedText[11] = { 0 };
if (_tcslen(selectedItem) >= 10) { // Ensure the string is long enough
_tcsncpy_s(truncatedText, _countof(truncatedText), selectedItem + 5, 5);
truncatedText[5] = _T('\0'); // Null-terminate to ensure safety
}
else {
_tcscpy_s(truncatedText, _countof(truncatedText), _T("----")); // Default value if insufficient characters
}
_stprintf_s(formattedString + _tcslen(formattedString),
_countof(formattedString) - _tcslen(formattedString),
_T(", %s: %s"), dayNames[i], truncatedText);
}
}
}
// Add the formatted string to the listbox
HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with the actual title
HWND AccessTimeLog = GetDlgItem(hParentWnd, IDC_ACCESSTIME_LIST);
if (AccessTimeLog) {
SendMessageW(AccessTimeLog, LB_ADDSTRING, 0, (LPARAM)formattedString);
}
else {
//MessageBoxW(hDlg, L"Failed to find list box!", L"Error", MB_OK | MB_ICONERROR);
}
EndDialog(hDlg, 0);
//MessageBoxW(hDlg, L"Data saved and added to the list!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_CLOSE_BTN2:
{
// Close the dialog
EndDialog(hDlg, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
}
return FALSE;
break;
}
return FALSE;
} void PopulateDaysComboBoxes2(HWND hDlg) { HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual parent window title if (!hParentWnd) { MessageBoxW(hDlg, L"Parent window not found!", L"Error", MB_OK | MB_ICONERROR); return; }
HWND AccessTimeLog = GetDlgItem(hParentWnd, IDC_ACCESSTIME_LIST);
if (!AccessTimeLog) {
MessageBoxW(hDlg, L"Access time list not found!", L"Error", MB_OK | MB_ICONERROR);
return;
}
TCHAR buffer[256] = { 0 }; // Safe size for item text
int itemCount = SendMessage(AccessTimeLog, LB_GETCOUNT, 0, 0); // Number of items in listbox
if (itemCount == LB_ERR || itemCount <= 0) {
// If no items are in the listbox, exit
return;
}
// Array of combo box IDs for each day
int comboBoxIDs[] = {
IDC_DOOR1, IDC_DOOR2, IDC_DOOR3, IDC_DOOR4
};
for (int p = 0; p < _countof(comboBoxIDs); p++) {
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[p]);
if (!hComboBox) {
continue; // Skip if the combo box is not found
}
// Clear the combo box contents
SendMessage(hComboBox, CB_RESETCONTENT, 0, 0);
// Populate combo box with items from the listbox
for (int j = 0; j < itemCount; j++) {
memset(buffer, 0, sizeof(buffer)); // Clear buffer for each item
SendMessage(AccessTimeLog, LB_GETTEXT, j, (LPARAM)buffer);
if (_tcslen(buffer) < _countof(buffer)) { // Ensure buffer length is within bounds
SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)buffer);
}
}
}
}
void PopulateDoorsAccessArea(HWND hDlg) { int comboBoxIDs[] = { IDC_DOOR1, IDC_DOOR2, IDC_DOOR3, IDC_DOOR4 };
wchar_t Doors_AccessArea[4][5] = { 0 }; // Array to store extracted times
for (int i = 0; i < _countof(comboBoxIDs); i++) {
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]);
if (!hComboBox) {
MessageBox(hDlg, L"Combo box handle not found!", L"Error", MB_OK | MB_ICONERROR);
continue;
}
// Get the selected index
int selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
wchar_t selectedItem[256] = { 0 }; // Buffer for combo box item text
SendMessage(hComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)selectedItem);
// Extract characters from position 5 to 9
if (wcslen(selectedItem) >= 9) {
wcsncpy_s(Doors_AccessArea[i], selectedItem + 5, 4);
}
else {
wcscpy_s(Doors_AccessArea[i], L"0000"); // Default if insufficient characters
}
}
else {
wcscpy_s(Doors_AccessArea[i], L"0000"); // Default if no selection
}
}
}
void static InitListView3(HWND hWndListView) { LVCOLUMN lvColumn;
// Add columns
lvColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvColumn.cx = 50; // Column width
wchar_t wText[100];
MultiByteToWideChar(CP_ACP, 0, "C", -1, wText, 100);
lvColumn.pszText = wText; // Column header
ListView_InsertColumn(hWndListView, 0, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "ID", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 1, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "Name", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 2, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "Access Area", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 3, &lvColumn);
// Add rows (example)
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
MultiByteToWideChar(CP_ACP, 0, "1", -1, wText, 100);
lvItem.pszText = wText; // First column
ListView_InsertItem(hWndListView, &lvItem);
MultiByteToWideChar(CP_ACP, 0, "123", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 1, wText); // Second column
MultiByteToWideChar(CP_ACP, 0, "Terminal A", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 2, wText); // Third column
MultiByteToWideChar(CP_ACP, 0, "Zone 1", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 3, wText); // Fourth column
} void static InitListView4(HWND hWndListView) { LVCOLUMN lvColumn;
// Add columns
lvColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvColumn.cx = 50; // Column width
wchar_t wText[100];
MultiByteToWideChar(CP_ACP, 0, "C", -1, wText, 100);
lvColumn.pszText = wText; // Column header
ListView_InsertColumn(hWndListView, 0, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "ID", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 1, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "Name", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 2, &lvColumn);
MultiByteToWideChar(CP_ACP, 0, "Access Area", -1, wText, 100);
lvColumn.pszText = wText;
ListView_InsertColumn(hWndListView, 3, &lvColumn);
// Add rows (example)
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
MultiByteToWideChar(CP_ACP, 0, "1", -1, wText, 100);
lvItem.pszText = wText; // First column
ListView_InsertItem(hWndListView, &lvItem);
MultiByteToWideChar(CP_ACP, 0, "123", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 1, wText); // Second column
MultiByteToWideChar(CP_ACP, 0, "Terminal A", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 2, wText); // Third column
MultiByteToWideChar(CP_ACP, 0, "Zone 1", -1, wText, 100);
ListView_SetItemText(hWndListView, 0, 3, wText); // Fourth column
}
INT_PTR CALLBACK AddDialogProc3(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { HWND hListView3 = GetDlgItem(hWnd, IDC_TERMINAL_LIST3);
PopulateDaysComboBoxes2(hDlg); // Populate combo boxes during initialization
InitListView3(hListView3);
return (INT_PTR)TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_APPLY_BTN3:
{
TCHAR formattedString[1024] = { 0 }; // Ensure large enough buffer
_stprintf_s(formattedString, _countof(formattedString), _T("Code: %s, Name: %s"), AccessTime_Code, AccessTime_Name);
// Array of combo box IDs and their corresponding names
const TCHAR* DoorNames[] = {
_T("Door1"), _T("Door2"), _T("Door3"),
_T("Door4")
};
int comboBoxIDs[] = {
IDC_DOOR1, IDC_DOOR2, IDC_DOOR3, IDC_DOOR4
};
const int numComboBoxes = _countof(comboBoxIDs); // Use _countof for safety
for (int i = 0; i < numComboBoxes; i++) { // Loop through combo boxes
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]);
if (hComboBox) {
int selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
// Use a larger buffer for the selected item
TCHAR selectedItem[512] = { 0 }; // Increased buffer size
SendMessage(hComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)selectedItem);
// Ensure the text is within bounds
if (_tcslen(selectedItem) < _countof(selectedItem)) {
TCHAR truncatedText[11] = { 0 };
if (_tcslen(selectedItem) >= 10) { // Ensure the string is long enough
_tcsncpy_s(truncatedText, _countof(truncatedText), selectedItem + 5, 5);
truncatedText[5] = _T('\0'); // Null-terminate to ensure safety
}
else {
_tcscpy_s(truncatedText, _countof(truncatedText), _T("----")); // Default value if insufficient characters
}
_stprintf_s(
formattedString + _tcslen(formattedString),
_countof(formattedString) - _tcslen(formattedString),
_T(", %s: %s"),
DoorNames[i], truncatedText
);
}
else {
MessageBoxW(hDlg, L"Item text too long!", L"Error", MB_OK | MB_ICONERROR);
}
}
}
}
// Add formatted string to the listbox
HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual title
if (!hParentWnd) {
MessageBoxW(hDlg, L"Parent window not found!", L"Error", MB_OK | MB_ICONERROR);
break;
}
HWND AccessAreaLog = GetDlgItem(hParentWnd, IDC_ACCESSAREA_LIST);
if (AccessAreaLog) {
SendMessageW(AccessAreaLog, LB_ADDSTRING, 0, (LPARAM)formattedString);
}
else {
MessageBoxW(hDlg, L"Failed to find the access area list!", L"Error", MB_OK | MB_ICONERROR);
}
EndDialog(hDlg, 0);
}
break;
case IDC_CLOSE_BTN3:
{
// Close the dialog
EndDialog(hDlg, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
}
return FALSE;
break;
}
return FALSE;
} void TransferItemsToListView(HWND hDlg) { HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Find parent dialog by title if (!hParentWnd) { MessageBox(hDlg, L"Parent dialog not found!", L"Error", MB_OK | MB_ICONERROR); return; }
HWND hParentListBox = GetDlgItem(hParentWnd, IDC_ACCESSAREA_LIST); // Get listbox handle in parent dialog
if (!hParentListBox) {
MessageBox(hDlg, L"Parent listbox not found!", L"Error", MB_OK | MB_ICONERROR);
return;
}
HWND hListView = GetDlgItem(hDlg, IDC_TERMINAL_LIST4); // Get ListView handle in current dialog
if (!hListView) {
MessageBox(hDlg, L"ListView not found!", L"Error", MB_OK | MB_ICONERROR);
return;
}
// Clear existing items in the ListView
//ListView_DeleteAllItems(hListView);
// Get the count of items in the parent listbox
int itemCount = SendMessage(hParentListBox, LB_GETCOUNT, 0, 0);
if (itemCount == LB_ERR) {
MessageBox(hDlg, L"Failed to get item count from parent listbox!", L"Error", MB_OK | MB_ICONERROR);
return;
}
// Add each item from the listbox to the ListView
for (int i = 0; i < itemCount; i++) {
wchar_t itemText[256] = { 0 };
SendMessage(hParentListBox, LB_GETTEXT, i, (LPARAM)itemText); // Get text from the parent listbox
// Prepare ListView item
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT; // We're adding text
lvItem.iItem = i; // Item index
lvItem.pszText = itemText; // Item text
// Add the item to the ListView
ListView_InsertItem(hListView, &lvItem);
}
//MessageBox(hDlg, L"Items transferred successfully to ListView!", L"Info", MB_OK | MB_ICONINFORMATION);
} void InitializeListViewColumns(HWND hListView) { wchar_t itemText[256] = L"Description"; LVCOLUMN lvCol = { 0 }; lvCol.mask = LVCF_TEXT | LVCF_WIDTH; lvCol.pszText = itemText; // Column header text lvCol.cx = 300; // Column width
// Add the column
if (ListView_InsertColumn(hListView, 0, &lvCol) == -1) {
MessageBox(NULL, L"Failed to insert column!", L"Error", MB_OK | MB_ICONERROR);
}
}
INT_PTR CALLBACK AddDialogProc1(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { InitializeListViewColumns(GetDlgItem(hDlg, IDC_TERMINAL_LIST4)); TransferItemsToListView(hDlg); HWND hListView4 = GetDlgItem(hWnd, IDC_TERMINAL_LIST4); InitListView4(hListView4); return (INT_PTR)TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_APPLY_BTN4: { TCHAR formattedString[512] = { 0 }; // Retrieve code and name from input fields GetDlgItemText(hDlg, IDC_CODE4, AccessGroup_Code, _countof(AccessGroup_Code)); GetDlgItemText(hDlg, IDC_NAME4, AccessGroup_Name, _countof(AccessGroup_Name));
// Start formatting the main string
_stprintf_s(formattedString, _countof(formattedString), _T("Code: %s, Name: %s"), AccessGroup_Code, AccessGroup_Name);
// Get handle to the ListView control
HWND AccessGroupLog = GetDlgItem(hDlg, IDC_TERMINAL_LIST4);
if (!AccessGroupLog) {
MessageBoxW(hDlg, L"Access group ListView not found!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Get the number of items in the ListView
int itemCount = ListView_GetItemCount(AccessGroupLog);
if (itemCount <= 0) {
MessageBoxW(hDlg, L"No items in the list!", L"Info", MB_OK | MB_ICONINFORMATION);
break;
}
// Iterate over each item to check if it is selected
TCHAR itemText[256] = { 0 }; // Buffer for item text
TCHAR truncatedText[6] = { 0 }; // Buffer for extracted characters (5 characters + null terminator)
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT; // We're interested in text
lvItem.pszText = itemText;
lvItem.cchTextMax = _countof(itemText);
for (int i = 0; i < itemCount; i++) {
if (ListView_GetItemState(AccessGroupLog, i, LVIS_SELECTED) & LVIS_SELECTED) {
lvItem.iItem = i; // Set the item index
if (ListView_GetItem(AccessGroupLog, &lvItem)) {
// Ensure the text is long enough for truncation
if (_tcslen(itemText) >= 10) {
_tcsncpy_s(truncatedText, itemText + 5, 5); // Extract characters from position 5 to 10
truncatedText[5] = _T('\0'); // Null-terminate the truncated string
}
else {
_tcscpy_s(truncatedText, _T("-----")); // Default value if insufficient characters
}
// Append the truncated text to the formatted string
if (_tcslen(truncatedText) + _tcslen(formattedString) < _countof(formattedString)) {
_stprintf_s(formattedString + _tcslen(formattedString),
_countof(formattedString) - _tcslen(formattedString),
_T(", Access Area%d: %s"), i + 1, truncatedText); // Add i + 1 for human-readable index
}
else {
MessageBoxW(hDlg, L"Formatted string too long. Some items may not be added.", L"Error", MB_OK | MB_ICONERROR);
break;
}
}
}
}
// Add the formatted string to the main listbox
HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual title
HWND AccessTimeLog = GetDlgItem(hParentWnd, IDC_ACCESSGROUP_LIST);
if (AccessTimeLog) {
SendMessageW(AccessTimeLog, LB_ADDSTRING, 0, (LPARAM)formattedString);
}
else {
MessageBoxW(hDlg, L"Failed to find the access group list!", L"Error", MB_OK | MB_ICONERROR);
}
EndDialog(hDlg, 0);
}
break;
case IDC_CLOSE_BTN4:
{
// Close the dialog
EndDialog(hDlg, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
}
return FALSE;
break;
}
return FALSE;
} void PopulateDaysComboBoxes4(HWND hDlg) { HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual title
HWND UserLog = GetDlgItem(hParentWnd, IDC_ACCESSGROUP_LIST);
TCHAR buffer[128]; // Buffer for listbox item text
int itemCount = SendMessage(UserLog, LB_GETCOUNT, 0, 0); // Number of items in listbox
if (itemCount == LB_ERR || itemCount <= 0) {
//MessageBoxW(hDlg, L"No items in the timezone list!", L"Error", MB_OK | MB_ICONERROR);
return;
}
// Array of combo box IDs for each day
int comboBoxIDs[] = {
IDC_ACCESS5
};
// Loop through each combo box
for (int i = 0; i < 1; i++) {
HWND hComboBox = GetDlgItem(hDlg, comboBoxIDs[i]); // Handle to combo box
// Clear the current contents of the combo box
SendMessage(hComboBox, CB_RESETCONTENT, 0, 0);
// Add items from the timezone list to the combo box
for (int j = 0; j < itemCount; j++) {
SendMessage(UserLog, LB_GETTEXT, j, (LPARAM)buffer); // Get listbox item text
SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)buffer); // Add to combo box
}
}
//MessageBoxW(hDlg, L"Combo boxes populated successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
} INT_PTR CALLBACK AddDialogProc4(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { //InitializeListViewColumns(GetDlgItem(hDlg, IDC_LOGBOX)); PopulateDaysComboBoxes4(hDlg); // Populate combo boxes during initialization return (INT_PTR)TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_APPLY_BTN5: { TCHAR formattedString[512] = { 0 }; // Handle Apply button logic GetDlgItemText(hDlg, IDC_CODE5, User_Code, _countof(User_Code)); GetDlgItemText(hDlg, IDC_NAME5, User_Name, _countof(User_Name));
// Start formatting the string with code and name
_stprintf_s(formattedString, _countof(formattedString), _T("Code: %s, Name: %s"), User_Code, User_Name);
// Get handle to the combo box
HWND hComboBox = GetDlgItem(hDlg, IDC_ACCESS5);
if (!hComboBox) {
MessageBoxW(hDlg, L"Access combo box not found!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Get the selected index
int selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
TCHAR selectedItem[256] = { 0 };
SendMessage(hComboBox, CB_GETLBTEXT, selectedIndex, (LPARAM)selectedItem);
// Extract characters from position 5 to 10
if (_tcslen(selectedItem) >= 10) { // Ensure the string is long enough
TCHAR extractedText[6] = { 0 }; // Buffer for extracted characters
_tcsncpy_s(extractedText, selectedItem + 5, 5); // Copy 5 characters starting at position 5
_stprintf_s(formattedString + _tcslen(formattedString),
_countof(formattedString) - _tcslen(formattedString),
_T(", Access Group: %s"), extractedText);
}
else {
MessageBoxW(hDlg, L"Selected item is too short to extract characters!", L"Error", MB_OK | MB_ICONERROR);
}
}
else {
MessageBoxW(hDlg, L"No item selected in the combo box!", L"Info", MB_OK | MB_ICONINFORMATION);
}
// Add the formatted string to the listbox in the parent window
HWND hParentWnd = FindWindow(NULL, L"mcp040"); // Replace with actual title
HWND UserLog = GetDlgItem(hParentWnd, IDC_LOGBOX);
if (UserLog) {
SendMessageW(UserLog, LB_ADDSTRING, 0, (LPARAM)formattedString);
}
else {
MessageBoxW(hDlg, L"Failed to find the log listbox!", L"Error", MB_OK | MB_ICONERROR);
}
EndDialog(hDlg, 0);
}
break;
case IDC_CLOSE_BTN5:
{
// Close the dialog
EndDialog(hDlg, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
}
return FALSE;
break;
}
return FALSE;
}
void select_tab2(HWND hwnd, int selectedIndex) { // Hide all controls first ShowWindow(GetDlgItem(hwnd, ID_COMBO_READERTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_MODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ACCESSMODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_OPENTIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_READER2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ENTER_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_EXIT_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCKOUT_DURATION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText21), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText22), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText23), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText24), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText25), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText26), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText27), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText28), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText29), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText30), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText31), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText32), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText33), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText34), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText35), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText36), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText37), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText38), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ACCOUNT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SIREN), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENABLE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_CHIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_UNLOCKONDISARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText39), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEPARTITION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_PARTITION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText40), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText41), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText42), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAMEZONE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONETYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DOUBLE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText43), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_RESPONSE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText44), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText45), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText46), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText47), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText48), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText49), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText50), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText51), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INVERTEDINOUT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText52), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText53), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText54), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVELOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_MONITOR2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPENWARNING), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCED), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DHCP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_STATICIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText55), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText56), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText57), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText58), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText59), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SUBNETMASK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_GATEWAY), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERPORT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCEDARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENDRES), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_TIMESYNC), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INSIDEOPENLOG), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_SERVERPASSBACK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INTERLOCK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText60), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText61), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALID), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_AUTHMODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKNUMBER), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText62), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText63), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText64), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText65), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_APPLYLOCK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText66), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_HolidayTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CALENDAR), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_Calendar_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDHOLIDAY), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELHOLIDAY), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText67), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText68), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText69), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText70), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText71), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText72), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_hText73), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_HOURALARM), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_MINUTEALARM), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMSETTING), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS2), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS5), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS6), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS7), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS8), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMDURATION), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP2), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP2), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT1), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT2), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT3), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT4), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT5), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT6), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT7), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT8), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_NOTES), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDALARM), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_MODALARM), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELALARM), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_ALARM_LIST), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_RETRIEVE), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEALARM), SW_HIDE);
// Show controls based on the selected tab
switch (selectedIndex) {
case 0: // Time Zone Tab
{
ShowWindow(GetDlgItem(hwnd, ID_COMBO_READER2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ENTER_ZONE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_EXIT_ZONE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCKOUT_DURATION2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText21), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText22), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText23), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText24), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText25), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText26), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText27), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText28), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText29), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText30), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_READERTYPE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_MODE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ACCESSMODE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_OPENTIME), SW_SHOW);
}
break;
case 1: // Access Time Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText31), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText32), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText33), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText34), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText35), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText36), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText37), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText38), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAME), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ACCOUNT), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_SIREN), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENABLE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_CHIME), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_UNLOCKONDISARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText39), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEPARTITION2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_PARTITION2), SW_SHOW);
}
break;
case 2: // Access Area Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText40), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEZONE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText41), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText42), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAMEZONE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONETYPE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DOUBLE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText43), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_RESPONSE), SW_SHOW);
}
break;
case 3: // Access Group Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText44), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText45), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText46), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText47), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText48), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText49), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText50), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText51), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INVERTEDINOUT), SW_SHOW);
}
break;
case 4: // Users Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText52), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText53), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText54), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVELOCK2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCK2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_MONITOR2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPENWARNING), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCED), SW_SHOW);
}
break;
case 5: //Terminal Setup Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DHCP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_STATICIP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText55), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText56), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText57), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText58), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText59), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALIP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_SUBNETMASK), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_GATEWAY), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERIP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERPORT), SW_SHOW);
}
break;
case 6: // Access Time Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCEDARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENDRES), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_TIMESYNC), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INSIDEOPENLOG), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_SERVERPASSBACK), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INTERLOCK), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText60), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText61), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALID), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_AUTHMODE), SW_SHOW);
}
break;
case 7: // Access Area Tab
{
ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText62), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText63), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText64), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText65), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKTYPE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_APPLYLOCK), SW_SHOW);
}
break;
case 8: // Access Group Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText66), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_HolidayTYPE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CALENDAR), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_Calendar_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDHOLIDAY), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELHOLIDAY), SW_SHOW);
}
break;
case 9: // Users Tab
{
ShowWindow(GetDlgItem(hwnd, ID_hText67), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText68), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText69), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText70), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText71), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText72), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_hText73), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_HOURALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_MINUTEALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMSETTING), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS5), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS6), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS7), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS8), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMDURATION), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT1), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT3), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT4), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT5), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT6), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT7), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT8), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_EDIT_NOTES), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_MODALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELALARM), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_ALARM_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_RETRIEVE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEALARM), SW_SHOW);
}
break;
default:
break;
}
}
void select_tab(HWND hwnd, int selectedIndex) { // Hide all controls first ShowWindow(GetDlgItem(hwnd, IDC_TEXTBOX), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON5), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_LOGBOX), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ADD_TIMEZONE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_DEL_TIMEZONE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_TIMEZONE_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSTIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSTIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ACCESSTIME_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSAREA), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSAREA), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ACCESSAREA_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSGROUP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSGROUP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ACCESSGROUP_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_DEL_USER), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ADD_USER), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_TABCONTROL2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_READERTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_LOCK4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_MODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ACCESSMODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_OPENTIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_READER2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ENTER_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_EXIT_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCKOUT_DURATION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_REFRESH2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_APPLY2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_CLOSE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText21), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText22), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText23), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText24), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText25), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText26), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText27), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText28), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText29), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText30), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText31), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText32), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText33), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText34), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText35), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText36), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText37), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText38), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ACCOUNT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ENTRY2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_EXIT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SIREN), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENABLE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_CHIME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_UNLOCKONDISARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText39), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEPARTITION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_PARTITION2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText40), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText41), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText42), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_NAMEZONE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ZONETYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_Partition3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DOUBLE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText43), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_PARTITIONZONE4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_RESPONSE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText44), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText45), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText46), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText47), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText48), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText49), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText50), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText51), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_SAVEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_TYPEINOUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TimeInOut2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_ParameterInOut2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INVERTEDINOUT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText52), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText53), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText54), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVELOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_MONITOR2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPENWARNING), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCED), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DHCP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_STATICIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText55), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText56), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText57), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText58), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText59), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SUBNETMASK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_GATEWAY), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERIP), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_SERVERPORT), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_FORCEDARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ENDRES), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_TIMESYNC), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INSIDEOPENLOG), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_SERVERPASSBACK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_INTERLOCK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText60), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText61), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_TERMINALID), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_AUTHMODE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKNUMBER), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText62), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_LOCK3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_OPEN3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText63), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText64), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText65), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_LOCKTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_APPLYLOCK), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText66), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_HolidayTYPE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CALENDAR), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_Calendar_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDHOLIDAY), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELHOLIDAY), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText67), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText68), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText69), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText70), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText71), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText72), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_hText73), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_HOURALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_MINUTEALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMSETTING), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS5), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS6), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS7), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_DAYS8), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_COMBO_ALARMDURATION), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_AAP4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_ADP4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT1), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT2), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT3), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT4), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT5), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT6), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT7), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_CHECK_OUTPUT8), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_EDIT_NOTES), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_ADDALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_MODALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_DELALARM), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_ALARM_LIST), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_RETRIEVE), SW_HIDE); ShowWindow(GetDlgItem(hwnd, ID_BUTTON_SAVEALARM), SW_HIDE);
// Show controls based on the selected tab
switch (selectedIndex) {
case 0: // Time Zone Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_ADD_TIMEZONE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_DEL_TIMEZONE), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_TIMEZONE_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON1), SW_SHOW);
}
break;
case 1: // Access Time Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSTIME), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSTIME), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_ACCESSTIME_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON2), SW_SHOW);
}
break;
case 2: // Access Area Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSAREA), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSAREA), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_ACCESSAREA_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON3), SW_SHOW);
}
break;
case 3: // Access Group Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_ADD_ACCESSGROUP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_DEL_ACCESSGROUP), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_ACCESSGROUP_LIST), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON4), SW_SHOW);
}
break;
case 4: // Users Tab
{
ShowWindow(GetDlgItem(hwnd, IDC_TEXTBOX), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SEND_BUTTON5), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_LOGBOX), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_DEL_USER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_ADD_USER), SW_SHOW);
}
break;
case 5: //Terminal Setup Tab
{
ShowWindow(GetDlgItem(hwnd, ID_TABCONTROL2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_REFRESH2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_APPLY2), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, ID_BUTTON_CLOSE2), SW_SHOW);
select_tab2(hwnd,0);
if (hTab2) {
AddTabs2(hTab2); // Call the function to add tabs
}
else {
MessageBox(hWnd, L"Failed to create tab control!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
default:
break;
}
} // Function for receiving data in a separate thread static void ReceiveDataThread(SOCKET ConnectSocket, HWND hWndLogBox) { char recvbuf[1024]; int iResult;
while (true) {
iResult = recv(ConnectSocket, recvbuf, sizeof(recvbuf), 0);
if ((iResult > 0) && (iResult < 1024)) {
recvbuf[iResult] = '\0'; // Null-terminate the received data
int wideLen = MultiByteToWideChar(CP_ACP, 0, recvbuf, -1, NULL, 0);
if (wideLen > 0) {
wchar_t* wideMessage = new wchar_t[wideLen];
MultiByteToWideChar(CP_ACP, 0, recvbuf, -1, wideMessage, wideLen);
if (hWndLogBox) {
int logLen = GetWindowTextLength(hWndLogBox);
// Get the existing content
wchar_t* currentText = new wchar_t[logLen + 1];
GetWindowTextW(hWndLogBox, currentText, logLen + 1);
// Concatenate the new message
size_t newSize = logLen + wcslen(wideMessage) + 3; // Include space for "\r\n"
wchar_t* newText = new wchar_t[newSize];
swprintf_s(newText, newSize, L"%s\r\n%s", currentText, wideMessage);
// Update the log box
SetWindowTextW(hWndLogBox, newText);
// Clean up
delete[] currentText;
delete[] newText;
}
else {
MessageBox(NULL, L"hWndLogBox is invalid\n", L"Error", MB_OK);
}
delete[] wideMessage;
}
}
else if (iResult == 0) {
break; // Connection closed
}
else {
MessageBox(NULL, L"Receive failed", L"Error", MB_OK);
break;
}
}
}
void AddTabs(HWND hTab) {
TCITEM tie;
tie.mask = TCIF_TEXT; // Use text for the tabs
const wchar_t* tabNames[] = {
L"Time Zone", L"Access Time", L"Access Area", L"Access Group",L"Users",L"Terminal Setup"
};
for (int i = 0; i < 6; i++) {
tie.pszText = (LPWSTR)tabNames[i];
TabCtrl_InsertItem(hTab, i, &tie);
}
}
void AddTabs2(HWND hTab) {
TCITEM tie;
tie.mask = TCIF_TEXT; // Use text for the tabs
const wchar_t* tabNames[] = {
L"Reader", L"Access TimePartition", L"Zone", L"IN/OUT put",L"Lock Setting",L"Network",L"System",L"Lock",L"Holiday",L"schedules"
};
for (int i = 0; i < 10; i++) {
tie.pszText = (LPWSTR)tabNames[i];
TabCtrl_InsertItem(hTab, i, &tie);
}
}
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_MCP040, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES; // Initialize ListView controls
InitCommonControlsEx(&icex);
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow))
{
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MCP040));
MSG msg;
// Initialize Winsock
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
MessageBox(NULL, L"WSAStartup failed", L"Error", MB_OK);
return FALSE;
}
// Create a socket
ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ConnectSocket == INVALID_SOCKET) {
MessageBox(NULL, L"Socket creation failed", L"Error", MB_OK);
WSACleanup();
return FALSE;
}
// Setup the server address structure
sockaddr_in serverAddr{};
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(serverPort);
inet_pton(AF_INET, serverAddress, &serverAddr.sin_addr);
// Connect to server
iResult = connect(ConnectSocket, (sockaddr*)&serverAddr, sizeof(serverAddr));
if (iResult == SOCKET_ERROR) {
MessageBox(NULL, L"Connection failed", L"Error", MB_OK);
closesocket(ConnectSocket);
WSACleanup();
return FALSE;
}
// Start the receive data thread
std::thread receiveThread(ReceiveDataThread, ConnectSocket, hWndLogBox);
receiveThread.detach(); // Detach the thread so it runs independently
// Main message loop:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// Cleanup
closesocket(ConnectSocket);
WSACleanup();
return (int)msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex{};
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MCP040));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_MCP040);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindowEx(0,szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
hWndSendTimeZoneButton = CreateWindowEx(0, L"BUTTON", L"Send to terminal", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
150, 50, 150, 20, hWnd, (HMENU)IDC_SEND_BUTTON1, hInstance, nullptr);
hWndSendAccessTimeButton = CreateWindowEx(0, L"BUTTON", L"Send to terminal", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
150, 50, 150, 20, hWnd, (HMENU)IDC_SEND_BUTTON2, hInstance, nullptr);
hWndSendAccessAreaButton = CreateWindowEx(0, L"BUTTON", L"Send to terminal", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
150, 50, 150, 20, hWnd, (HMENU)IDC_SEND_BUTTON3, hInstance, nullptr);
hWndSendAccessGroupButton = CreateWindowEx(0, L"BUTTON", L"Send to terminal", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
150, 50, 150, 20, hWnd, (HMENU)IDC_SEND_BUTTON4, hInstance, nullptr);
hWndSendUserButton = CreateWindowEx(0, L"BUTTON", L"Send to terminal", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
150, 50, 150, 20, hWnd, (HMENU)IDC_SEND_BUTTON5, hInstance, nullptr);
//user
hWndAddUserButton = CreateWindowEx(0, L"BUTTON", L"Add user", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
450, 50, 150, 20, hWnd, (HMENU)IDC_ADD_USER, hInstance, nullptr);
hWndDeleteUserButton = CreateWindowEx(0, L"BUTTON", L"Delete", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
300, 50, 150, 20, hWnd, (HMENU)IDC_DEL_USER, hInstance, nullptr);
hWndListUser = CreateWindowEx(0,L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
10, 80, 590, 300, hWnd, (HMENU)IDC_LOGBOX, hInstance, nullptr);
hTab = CreateWindowEx(
0, WC_TABCONTROL, NULL,
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
0, 0, 600, 30, // Position and size
hWnd, (HMENU)IDC_TABCONTROL, hInst, NULL
);
hTab2 = CreateWindowEx(0,WC_TABCONTROL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
0, 30, 600, 30, hWnd, (HMENU)ID_TABCONTROL2, hInst, NULL);
//timezone
hWndAddTimeZone = CreateWindowEx(0, L"BUTTON", L"ADD Time Zone", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
450, 50, 150, 20, hWnd, (HMENU)IDC_ADD_TIMEZONE, hInstance, nullptr);
hWndDelTimeZone = CreateWindowEx(0, L"BUTTON", L"DELETE", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
300, 50, 150, 20, hWnd, (HMENU)IDC_DEL_TIMEZONE, hInstance, nullptr);
hWndListTimeZone = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
10, 80, 590, 300, hWnd, (HMENU)IDC_TIMEZONE_LIST, hInstance, nullptr);
//accesstime
hWndAddAccessTime = CreateWindowEx(0, L"BUTTON", L"ADD Access Time", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON ,
450, 50, 150, 20, hWnd, (HMENU)IDC_ADD_ACCESSTIME, hInstance, nullptr);
hWndDelAccessTime = CreateWindowEx(0, L"BUTTON", L"DELETE", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
300, 50, 150, 20, hWnd, (HMENU)IDC_DEL_ACCESSTIME, hInstance, nullptr);
hWndListAccessTime = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
10, 80, 590, 300, hWnd, (HMENU)IDC_ACCESSTIME_LIST, hInstance, nullptr);
//accessarea
hWndAddAccessArea = CreateWindowEx(0, L"BUTTON", L"ADD Access Area", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
450, 50, 150, 20, hWnd, (HMENU)IDC_ADD_ACCESSAREA, hInstance, nullptr);
hWndDelAccessArea = CreateWindowEx(0, L"BUTTON", L"DELETE", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
300, 50, 150, 20, hWnd, (HMENU)IDC_DEL_ACCESSAREA, hInstance, nullptr);
hWndListAcessArea = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
10, 80, 590, 300, hWnd, (HMENU)IDC_ACCESSAREA_LIST, hInstance, nullptr);
//accessgroup
hWndAddAccessGroup = CreateWindowEx(0, L"BUTTON", L"ADD Access Group", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
450, 50, 150, 20, hWnd, (HMENU)IDC_ADD_ACCESSGROUP, hInstance, nullptr);
hWndDelAccessGroup = CreateWindowEx(0, L"BUTTON", L"DELETE", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
300, 50, 150, 20, hWnd, (HMENU)IDC_DEL_ACCESSGROUP, hInstance, nullptr);
hWndListAcessGroup = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
10, 80, 590, 300, hWnd, (HMENU)IDC_ACCESSGROUP_LIST, hInstance, nullptr);
//terminal tab
hButtonRefresh2 = CreateWindowW(L"BUTTON", L"Refresh", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
360, 450, 80, 30, hWnd, (HMENU)ID_BUTTON_REFRESH2, NULL, NULL);
hButtonApply2 = CreateWindowW(L"BUTTON", L"Apply", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
440, 450, 80, 30, hWnd, (HMENU)ID_BUTTON_APPLY2, NULL, NULL);
hButtonClose2 = CreateWindowW(L"BUTTON", L"Close", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
520, 450, 80, 30, hWnd, (HMENU)ID_BUTTON_CLOSE2, NULL, NULL);
//reader
hComboReader2 = CreateWindowW(L"COMBOBOX", L"", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
360, 70, 100, 100, hWnd, (HMENU)ID_COMBO_READER2, NULL, NULL);
hButtonSave2 = CreateWindowW(L"BUTTON", L"Save", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
520, 70, 80, 20, hWnd, (HMENU)ID_BUTTON_SAVE2, NULL, NULL);
hText21 = CreateWindowW(L"STATIC", L"Enter Zone:", WS_CHILD | WS_VISIBLE,
360, 100, 80, 20, hWnd, (HMENU)ID_hText21, NULL, NULL);
hComboEnterZone2 = CreateWindowW(L"COMBOBOX", L"", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
450, 100, 150, 100, hWnd, (HMENU)ID_COMBO_ENTER_ZONE2, NULL, NULL);
hText22 = CreateWindowW(L"STATIC", L"Exit Zone:", WS_CHILD | WS_VISIBLE,
360, 140, 80, 20, hWnd, (HMENU)ID_hText22, NULL, NULL);
hComboExitZone2 = CreateWindowW(L"COMBOBOX", L"", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
450, 140, 150, 100, hWnd, (HMENU)ID_COMBO_EXIT_ZONE2, NULL, NULL);
hText23 = CreateWindowW(L"STATIC", L"Type:", WS_CHILD | WS_VISIBLE,
360, 180, 80, 20, hWnd, (HMENU)ID_hText23, NULL, NULL);
hComboType2 = CreateWindowW(L"COMBOBOX", L"", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
450, 180, 150, 100, hWnd, (HMENU)ID_COMBO_TYPE2, NULL, NULL);
hText24 = CreateWindowW(L"STATIC", L"Lockout Duration:", WS_CHILD | WS_VISIBLE,
360, 220, 120, 20, hWnd, (HMENU)ID_hText24, NULL, NULL);
hEditLockoutDuration2 = CreateWindowW(L"EDIT", L"", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
500, 220, 100, 20, hWnd, (HMENU)ID_EDIT_LOCKOUT_DURATION2, NULL, NULL);
hText30 = CreateWindowW(L"STATIC", L"Reader Type", WS_CHILD | WS_VISIBLE,
20, 70, 120, 20, hWnd, (HMENU)ID_hText30, NULL, NULL);
hText25 = CreateWindowW(L"STATIC", L"Lock", WS_CHILD | WS_VISIBLE,
20, 100, 120, 20, hWnd, (HMENU)ID_hText25, NULL, NULL);
hText26 = CreateWindowW(L"STATIC", L"Partition", WS_CHILD | WS_VISIBLE,
20, 130, 120, 20, hWnd, (HMENU)ID_hText26, NULL, NULL);
hText27 = CreateWindowW(L"STATIC", L"Mode", WS_CHILD | WS_VISIBLE,
20, 160, 120, 20, hWnd, (HMENU)ID_hText27, NULL, NULL);
hText28 = CreateWindowW(L"STATIC", L"Open Time (sec)", WS_CHILD | WS_VISIBLE,
20, 190, 120, 20, hWnd, (HMENU)ID_hText28, NULL, NULL);
hText29 = CreateWindowW(L"STATIC", L"Access Mode", WS_CHILD | WS_VISIBLE,
20, 220, 120, 20, hWnd, (HMENU)ID_hText29, NULL, NULL);
hComboReaderType = CreateWindowW(L"COMBOBOX", L"UNKOWN", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 70, 100, 100, hWnd, (HMENU)ID_COMBO_READERTYPE, NULL, NULL);
hCheckBoxLock1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
140, 100, 40, 20,
hWnd, (HMENU)IDC_CHECK_LOCK1, NULL, NULL);
hCheckBoxLock2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
180, 100, 40, 20,
hWnd, (HMENU)IDC_CHECK_LOCK2, NULL, NULL);
hCheckBoxLock3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
220, 100, 40, 20,
hWnd, (HMENU)IDC_CHECK_LOCK3, NULL, NULL);
hCheckBoxLock4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 100, 40, 20,
hWnd, (HMENU)IDC_CHECK_LOCK4, NULL, NULL);
hCheckBoxPartition1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
140, 130, 40, 20,
hWnd, (HMENU)IDC_CHECK_Partition1, NULL, NULL);
hCheckBoxPartition2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
180, 130, 40, 20,
hWnd, (HMENU)IDC_CHECK_Partition2, NULL, NULL);
hCheckBoxPartition3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
220, 130, 40, 20,
hWnd, (HMENU)IDC_CHECK_Partition3, NULL, NULL);
hCheckBoxPartition4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 130, 40, 20,
hWnd, (HMENU)IDC_CHECK_Partition4, NULL, NULL);
hComboMode = CreateWindowW(L"COMBOBOX", L"ACCESS", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 160, 100, 100, hWnd, (HMENU)ID_COMBO_MODE, NULL, NULL);
hComboAccessMode = CreateWindowW(L"COMBOBOX", L"ACCESS", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 220, 100, 100, hWnd, (HMENU)ID_COMBO_ACCESSMODE, NULL, NULL);
hComboOpenTime = CreateWindowW(L"EDIT", L"5", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 190, 100, 20, hWnd, (HMENU)ID_COMBO_OPENTIME, NULL, NULL);
//accesstime partition
hText31 = CreateWindowW(L"STATIC", L"Name", WS_CHILD | WS_VISIBLE,
20, 100, 120, 20, hWnd, (HMENU)ID_hText31, NULL, NULL);
hText32 = CreateWindowW(L"STATIC", L"Account", WS_CHILD | WS_VISIBLE,
20, 130, 120, 20, hWnd, (HMENU)ID_hText32, NULL, NULL);
hText33 = CreateWindowW(L"STATIC", L"Entry Delay1 (sec)", WS_CHILD | WS_VISIBLE,
20, 160, 120, 20, hWnd, (HMENU)ID_hText33, NULL, NULL);
hText34 = CreateWindowW(L"STATIC", L"Entry Delay2 (sec)", WS_CHILD | WS_VISIBLE,
20, 190, 120, 20, hWnd, (HMENU)ID_hText34, NULL, NULL);
hText35 = CreateWindowW(L"STATIC", L"Exit Delay1 (sec)", WS_CHILD | WS_VISIBLE,
20, 220, 120, 20, hWnd, (HMENU)ID_hText35, NULL, NULL);
hText36 = CreateWindowW(L"STATIC", L"Exit Delay2 (sec)", WS_CHILD | WS_VISIBLE,
20, 250, 120, 20, hWnd, (HMENU)ID_hText36, NULL, NULL);
hText37 = CreateWindowW(L"STATIC", L"Siren Time (sec)", WS_CHILD | WS_VISIBLE,
20, 280, 120, 20, hWnd, (HMENU)ID_hText37, NULL, NULL);
hText38 = CreateWindowW(L"STATIC", L"Alarm Count", WS_CHILD | WS_VISIBLE,
20, 310, 120, 20, hWnd, (HMENU)ID_hText38, NULL, NULL);
hEditName = CreateWindowW(L"EDIT", L"Partition #1", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 100, 100, 20, hWnd, (HMENU)ID_EDIT_NAME, NULL, NULL);
hEditAccount = CreateWindowW(L"EDIT", L"0040", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 130, 100, 20, hWnd, (HMENU)ID_EDIT_ACCOUNT, NULL, NULL);
hEditEntry1 = CreateWindowW(L"EDIT", L"30", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 160, 100, 20, hWnd, (HMENU)ID_EDIT_ENTRY1, NULL, NULL);
hEditEntry2 = CreateWindowW(L"EDIT", L"30", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 190, 100, 20, hWnd, (HMENU)ID_EDIT_ENTRY2, NULL, NULL);
hEditExit1 = CreateWindowW(L"EDIT", L"30", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 220, 100, 20, hWnd, (HMENU)ID_EDIT_EXIT1, NULL, NULL);
hEditExit2 = CreateWindowW(L"EDIT", L"30", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 250, 100, 20, hWnd, (HMENU)ID_EDIT_EXIT2, NULL, NULL);
hEditSiren = CreateWindowW(L"EDIT", L"60", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 280, 100, 20, hWnd, (HMENU)ID_EDIT_SIREN, NULL, NULL);
hEditAlarm = CreateWindowW(L"EDIT", L"3", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 310, 100, 20, hWnd, (HMENU)ID_EDIT_ALARM, NULL, NULL);
hCheckBoxEnable = CreateWindowW(
L"BUTTON", L"ENABLE",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 360, 100, 20,
hWnd, (HMENU)IDC_CHECK_ENABLE, NULL, NULL);
hCheckBoxChime = CreateWindowW(
L"BUTTON", L"CHIME",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
120, 360, 100, 20,
hWnd, (HMENU)IDC_CHECK_CHIME, NULL, NULL);
hCheckBoxUnlockOnDisarm = CreateWindowW(
L"BUTTON", L"UNLOCK ON DISARM",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
220, 360, 160, 20,
hWnd, (HMENU)IDC_CHECK_UNLOCKONDISARM, NULL, NULL);
hText39 = CreateWindowW(L"STATIC", L"Partition", WS_CHILD | WS_VISIBLE,
20, 70, 120, 20, hWnd, (HMENU)ID_hText39, NULL, NULL);
hButtonSavePartition2 = CreateWindowW(L"BUTTON", L"SAVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
300, 70, 80, 20, hWnd, (HMENU)ID_BUTTON_SAVEPARTITION2, NULL, NULL);
hComboPartition2 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 70, 100, 100, hWnd, (HMENU)ID_COMBO_PARTITION2, NULL, NULL);
//zone
hText40 = CreateWindowW(L"STATIC", L"ZONE", WS_CHILD | WS_VISIBLE,
20, 70, 120, 20, hWnd, (HMENU)ID_hText40, NULL, NULL);
hButtonSaveZone2 = CreateWindowW(L"BUTTON", L"SAVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
300, 70, 80, 20, hWnd, (HMENU)ID_BUTTON_SAVEZONE2, NULL, NULL);
hComboZone2 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 70, 100, 100, hWnd, (HMENU)ID_COMBO_ZONE2, NULL, NULL);
hText41 = CreateWindowW(L"STATIC", L"Name", WS_CHILD | WS_VISIBLE,
20, 100, 120, 20, hWnd, (HMENU)ID_hText41, NULL, NULL);
hText42 = CreateWindowW(L"STATIC", L"TYPE", WS_CHILD | WS_VISIBLE,
20, 130, 120, 20, hWnd, (HMENU)ID_hText42, NULL, NULL);
hEditNameZone = CreateWindowW(L"EDIT", L"Zone 00", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 100, 100, 20, hWnd, (HMENU)ID_EDIT_NAMEZONE, NULL, NULL);
hComboZoneType = CreateWindowW(L"COMBOBOX", L"EXIT1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 130, 100, 100, hWnd, (HMENU)ID_COMBO_ZONETYPE, NULL, NULL);
hCheckBoxResponse = CreateWindowW(
L"BUTTON", L"Response (100ms)",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 160, 140, 20,
hWnd, (HMENU)IDC_CHECK_RESPONSE, NULL, NULL);
hCheckBoxDouble = CreateWindowW(
L"BUTTON", L"Double",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 190, 140, 20,
hWnd, (HMENU)IDC_CHECK_DOUBLE, NULL, NULL);
hText43 = CreateWindowW(L"STATIC", L"Partition", WS_CHILD | WS_VISIBLE,
20, 220, 120, 20, hWnd, (HMENU)ID_hText43, NULL, NULL);
hCheckBoxPartitionZone1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
140, 220, 40, 20,
hWnd, (HMENU)IDC_CHECK_PARTITIONZONE1, NULL, NULL);
hCheckBoxPartitionZone2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
180, 220, 40, 20,
hWnd, (HMENU)IDC_CHECK_PARTITIONZONE2, NULL, NULL);
hCheckBoxPartitionZone3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
220, 220, 40, 20,
hWnd, (HMENU)IDC_CHECK_PARTITIONZONE3, NULL, NULL);
hCheckBoxPartitionZone4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 220, 40, 20,
hWnd, (HMENU)IDC_CHECK_PARTITIONZONE4, NULL, NULL);
//in/out put
hText44 = CreateWindowW(L"STATIC", L"Output", WS_CHILD | WS_VISIBLE,
20, 70, 100, 20, hWnd, (HMENU)ID_hText44, NULL, NULL);
hText45 = CreateWindowW(L"STATIC", L"Type", WS_CHILD | WS_VISIBLE,
20, 100, 100, 20, hWnd, (HMENU)ID_hText45, NULL, NULL);
hText46 = CreateWindowW(L"STATIC", L"Time", WS_CHILD | WS_VISIBLE,
20, 130, 100, 20, hWnd, (HMENU)ID_hText46, NULL, NULL);
hText47 = CreateWindowW(L"STATIC", L"Parameter", WS_CHILD | WS_VISIBLE,
20, 160, 100, 20, hWnd, (HMENU)ID_hText47, NULL, NULL);
hText48 = CreateWindowW(L"STATIC", L"Input", WS_CHILD | WS_VISIBLE,
320, 70, 100, 20, hWnd, (HMENU)ID_hText48, NULL, NULL);
hText49 = CreateWindowW(L"STATIC", L"Type", WS_CHILD | WS_VISIBLE,
320, 100, 100, 20, hWnd, (HMENU)ID_hText49, NULL, NULL);
hText50 = CreateWindowW(L"STATIC", L"Time", WS_CHILD | WS_VISIBLE,
320, 130, 100, 20, hWnd, (HMENU)ID_hText50, NULL, NULL);
hText51 = CreateWindowW(L"STATIC", L"Parameter", WS_CHILD | WS_VISIBLE,
320, 160, 100, 20, hWnd, (HMENU)ID_hText51, NULL, NULL);
hButtonSaveInOut1 = CreateWindowW(L"BUTTON", L"SAVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
240, 70, 60, 20, hWnd, (HMENU)ID_BUTTON_SAVEINOUT1, NULL, NULL);
hComboSaveInOut1 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 70, 80, 100, hWnd, (HMENU)ID_COMBO_SAVEINOUT1, NULL, NULL);
hButtonSaveInOut2 = CreateWindowW(L"BUTTON", L"SAVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
540, 70, 60, 20, hWnd, (HMENU)ID_BUTTON_SAVEINOUT2, NULL, NULL);
hComboSaveInOut2 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
460, 70, 80, 100, hWnd, (HMENU)ID_COMBO_SAVEINOUT2, NULL, NULL);
hComboTypeInOut1 = CreateWindowW(L"COMBOBOX", L"AUTHORISED", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 100, 140, 100, hWnd, (HMENU)ID_COMBO_TYPEINOUT1, NULL, NULL);
hComboTypeInOut2 = CreateWindowW(L"COMBOBOX", L"EXIT BUTTON NC", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
460, 100, 140, 100, hWnd, (HMENU)ID_COMBO_TYPEINOUT2, NULL, NULL);
hEditTimeInOut1 = CreateWindowW(L"EDIT", L"5", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 130, 140, 20, hWnd, (HMENU)ID_EDIT_TimeInOut1, NULL, NULL);
hEditParameterInOut1 = CreateWindowW(L"EDIT", L"1", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 160, 140, 20, hWnd, (HMENU)ID_EDIT_ParameterInOut1, NULL, NULL);
hEditTimeInOut2 = CreateWindowW(L"EDIT", L"5", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
460, 130, 140, 20, hWnd, (HMENU)ID_EDIT_TimeInOut2, NULL, NULL);
hEditParameterInOut2 = CreateWindowW(L"EDIT", L"1", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
460, 160, 140, 20, hWnd, (HMENU)ID_EDIT_ParameterInOut2, NULL, NULL);
hCheckBoxInvertedInOut = CreateWindowW(
L"BUTTON", L"Inverted",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 190, 100, 20,
hWnd, (HMENU)IDC_CHECK_INVERTEDINOUT, NULL, NULL);
//lock
hText52 = CreateWindowW(L"STATIC", L"LOCK", WS_CHILD | WS_VISIBLE,
20, 70, 120, 20, hWnd, (HMENU)ID_hText52, NULL, NULL);
hButtonSaveLock2 = CreateWindowW(L"BUTTON", L"SAVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
300, 70, 80, 20, hWnd, (HMENU)ID_BUTTON_SAVELOCK2, NULL, NULL);
hComboLock2 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
160, 70, 100, 100, hWnd, (HMENU)ID_COMBO_LOCK2, NULL, NULL);
hText53 = CreateWindowW(L"STATIC", L"ZONE/DOOR MONITOR", WS_CHILD | WS_VISIBLE,
20, 100, 160, 20, hWnd, (HMENU)ID_hText53, NULL, NULL);
hText54 = CreateWindowW(L"STATIC", L"OPEN TOO LONG WARNING (sec)", WS_CHILD | WS_VISIBLE,
20, 130, 160, 40, hWnd, (HMENU)ID_hText54, NULL, NULL);
hComboMonitor2 = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 100, 140, 100, hWnd, (HMENU)ID_COMBO_MONITOR2, NULL, NULL);
hEditOpenWarning = CreateWindowW(L"EDIT", L"20", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 140, 140, 20, hWnd, (HMENU)ID_EDIT_OPENWARNING, NULL, NULL);
hCheckBoxForced = CreateWindowW(
L"BUTTON", L"FORCED ENABLE",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 190, 140, 20,
hWnd, (HMENU)IDC_CHECK_FORCED, NULL, NULL);
//network
hCheckBoxDHCP = CreateWindowW(
L"BUTTON", L"AUTOMATIC IP ADDRESS ACQUISITION",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 70, 160, 20,
hWnd, (HMENU)IDC_CHECK_DHCP, NULL, NULL);
hCheckBoxSTATICIP = CreateWindowW(
L"BUTTON", L"FOLLOWING IP ADDRESS USED",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 100, 160, 20,
hWnd, (HMENU)IDC_CHECK_STATICIP, NULL, NULL);
hText55 = CreateWindowW(L"STATIC", L"TERMINAL IP", WS_CHILD | WS_VISIBLE,
20, 130, 100, 20, hWnd, (HMENU)ID_hText55, NULL, NULL);
hText56 = CreateWindowW(L"STATIC", L"SUBNET MASK", WS_CHILD | WS_VISIBLE,
20, 160, 100, 20, hWnd, (HMENU)ID_hText56, NULL, NULL);
hText57 = CreateWindowW(L"STATIC", L"DEFAULT GATEWAY", WS_CHILD | WS_VISIBLE,
20, 180, 100, 40, hWnd, (HMENU)ID_hText57, NULL, NULL);
hText58 = CreateWindowW(L"STATIC", L"SERVER IP", WS_CHILD | WS_VISIBLE,
20, 220, 100, 20, hWnd, (HMENU)ID_hText58, NULL, NULL);
hText59 = CreateWindowW(L"STATIC", L"SERVER PORT", WS_CHILD | WS_VISIBLE,
20, 250, 100, 20, hWnd, (HMENU)ID_hText59, NULL, NULL);
hEditTerminalIp = CreateWindowW(L"EDIT", L"192.168.0.6", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 130, 140, 20, hWnd, (HMENU)ID_EDIT_TERMINALIP, NULL, NULL);
hEditSubnetMask = CreateWindowW(L"EDIT", L"255.255.255.0", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 160, 140, 20, hWnd, (HMENU)ID_EDIT_SUBNETMASK, NULL, NULL);
hEditGateway = CreateWindowW(L"EDIT", L"192.168.0.1", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 190, 140, 20, hWnd, (HMENU)ID_EDIT_GATEWAY, NULL, NULL);
hEditServerIp = CreateWindowW(L"EDIT", L"192.168.0.2", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 220, 140, 20, hWnd, (HMENU)ID_EDIT_SERVERIP, NULL, NULL);
hEditServerPort = CreateWindowW(L"EDIT", L"9870", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 250, 140, 20, hWnd, (HMENU)ID_EDIT_SERVERPORT, NULL, NULL);
//system
hCheckBoxForcedArm = CreateWindowW(
L"BUTTON", L"FORCED ARM",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 70, 200, 20,
hWnd, (HMENU)IDC_CHECK_FORCEDARM, NULL, NULL);
hCheckBoxEndRes = CreateWindowW(
L"BUTTON", L"END OF LINE RESISTORS",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 100, 200, 20,
hWnd, (HMENU)IDC_CHECK_ENDRES, NULL, NULL);
hCheckBoxTimeSync = CreateWindowW(
L"BUTTON", L"TIME SYNC",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 130, 200, 20,
hWnd, (HMENU)IDC_CHECK_TIMESYNC, NULL, NULL);
hCheckBoxInsideOpenLog = CreateWindowW(
L"BUTTON", L"INSIDE OPEN LOG",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 160, 200, 20,
hWnd, (HMENU)IDC_CHECK_INSIDEOPENLOG, NULL, NULL);
hCheckBoxServerPassback = CreateWindowW(
L"BUTTON", L"SERVER PASSBACK",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 190, 200, 20,
hWnd, (HMENU)IDC_CHECK_SERVERPASSBACK, NULL, NULL);
hCheckBoxInterlock = CreateWindowW(
L"BUTTON", L"DOOR INTERLOCKING",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 220, 200, 20,
hWnd, (HMENU)IDC_CHECK_INTERLOCK, NULL, NULL);
hText60 = CreateWindowW(L"STATIC", L"TERMINAL ID", WS_CHILD | WS_VISIBLE,
20, 250, 200, 20, hWnd, (HMENU)ID_hText60, NULL, NULL);
hText61 = CreateWindowW(L"STATIC", L"AUTHENCTICATION MODE", WS_CHILD | WS_VISIBLE,
20, 280, 200, 20, hWnd, (HMENU)ID_hText61, NULL, NULL);
hEditTerminalID = CreateWindowW(L"EDIT", L"40", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
220, 250, 140, 20, hWnd, (HMENU)ID_EDIT_TERMINALID, NULL, NULL);
hComboAuthMode = CreateWindowW(L"COMBOBOX", L"SN", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
220, 280, 140, 100, hWnd, (HMENU)ID_COMBO_AUTHMODE, NULL, NULL);
//lock
hComboLockNumber = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
220, 70, 140, 100, hWnd, (HMENU)ID_COMBO_LOCKNUMBER, NULL, NULL);
hText62 = CreateWindowW(L"STATIC", L"Lock", WS_CHILD | WS_VISIBLE,
20, 70, 100, 20, hWnd, (HMENU)ID_hText62, NULL, NULL);
hEditLock1 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
120, 100, 100, 20, hWnd, (HMENU)ID_EDIT_LOCK1, NULL, NULL);
hEditLock2 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
240, 100, 100, 20, hWnd, (HMENU)ID_EDIT_LOCK2, NULL, NULL);
hEditLock3 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
380, 100, 100, 20, hWnd, (HMENU)ID_EDIT_LOCK3, NULL, NULL);
hEditOpen1 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
120, 180, 100, 20, hWnd, (HMENU)ID_EDIT_OPEN1, NULL, NULL);
hEditOpen2 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
240, 180, 100, 20, hWnd, (HMENU)ID_EDIT_OPEN2, NULL, NULL);
hEditOpen3 = CreateWindowW(L"EDIT", L"0000~0000", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
380, 180, 100, 20, hWnd, (HMENU)ID_EDIT_OPEN3, NULL, NULL);
hText63 = CreateWindowW(L"STATIC", L"Lock", WS_CHILD | WS_VISIBLE,
20, 100, 100, 20, hWnd, (HMENU)ID_hText63, NULL, NULL);
hText64 = CreateWindowW(L"STATIC", L"Open", WS_CHILD | WS_VISIBLE,
20, 180, 100, 20, hWnd, (HMENU)ID_hText64, NULL, NULL);
hText65 = CreateWindowW(L"STATIC", L"The present setting will be changed as follows:", WS_CHILD | WS_VISIBLE,
20, 250, 400, 20, hWnd, (HMENU)ID_hText65, NULL, NULL);
hComboLockType = CreateWindowW(L"COMBOBOX", L"ALL", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
220, 280, 80, 100, hWnd, (HMENU)ID_COMBO_LOCKTYPE, NULL, NULL);
hButtonApplyLock = CreateWindowW(L"BUTTON", L"APPLY", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
300, 280, 80, 20, hWnd, (HMENU)ID_BUTTON_APPLYLOCK, NULL, NULL);
//holiday
hText66 = CreateWindowW(L"STATIC", L"Type", WS_CHILD | WS_VISIBLE,
20, 70, 100, 20, hWnd, (HMENU)ID_hText66, NULL, NULL);
hComboHolidayType = CreateWindowW(L"COMBOBOX", L"1", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 70, 100, 100, hWnd, (HMENU)ID_COMBO_HolidayTYPE, NULL, NULL);
hCalendar = CreateWindowEx(
0, MONTHCAL_CLASS, NULL,
WS_BORDER | WS_CHILD | WS_VISIBLE,
20, 100, 200, 160,
hWnd, (HMENU)IDC_CALENDAR, NULL, NULL
);
hWndLogCalendar = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
240, 70, 260, 300, hWnd, (HMENU)IDC_Calendar_LIST, hInstance, nullptr);
hButtonAddHoliday = CreateWindowW(L"BUTTON", L"ADD", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
20, 280, 80, 20, hWnd, (HMENU)ID_BUTTON_ADDHOLIDAY, NULL, NULL);
hButtonDelHoliday = CreateWindowW(L"BUTTON", L"DEL", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
120, 280, 80, 20, hWnd, (HMENU)ID_BUTTON_DELHOLIDAY, NULL, NULL);
//schedules
hText67 = CreateWindowW(L"STATIC", L"ALARM TIME", WS_CHILD | WS_VISIBLE,
20, 70, 100, 20, hWnd, (HMENU)ID_hText67, NULL, NULL);
hComboHourAlarm = CreateWindowW(L"COMBOBOX", L"0", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 70, 60, 100, hWnd, (HMENU)ID_COMBO_HOURALARM, NULL, NULL);
hComboMinuteAlarm = CreateWindowW(L"COMBOBOX", L"0", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
220, 70, 60, 100, hWnd, (HMENU)ID_COMBO_MINUTEALARM, NULL, NULL);
hText68 = CreateWindowW(L"STATIC", L"Settings", WS_CHILD | WS_VISIBLE,
20, 100, 100, 20, hWnd, (HMENU)ID_hText68, NULL, NULL);
hComboAlarmSetting = CreateWindowW(L"COMBOBOX", L"EVERYDAY", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 100, 140, 100, hWnd, (HMENU)ID_COMBO_ALARMSETTING, NULL, NULL);
hCheckBoxDays1 = CreateWindowW(
L"BUTTON", L"SUN",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS1, NULL, NULL);
hCheckBoxDays2 = CreateWindowW(
L"BUTTON", L"MON",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
80, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS2, NULL, NULL);
hCheckBoxDays3 = CreateWindowW(
L"BUTTON", L"TUE",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
140, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS3, NULL, NULL);
hCheckBoxDays4 = CreateWindowW(
L"BUTTON", L"WED",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
200, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS4, NULL, NULL);
hCheckBoxDays5 = CreateWindowW(
L"BUTTON", L"THU",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS5, NULL, NULL);
hCheckBoxDays6 = CreateWindowW(
L"BUTTON", L"FRI",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
320, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS6, NULL, NULL);
hCheckBoxDays7 = CreateWindowW(
L"BUTTON", L"SAT",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
380, 130, 60, 20,
hWnd, (HMENU)IDC_CHECK_DAYS7, NULL, NULL);
hCheckBoxDays8 = CreateWindowW(
L"BUTTON", L"OFF HOLIDAY",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 160, 200, 20,
hWnd, (HMENU)IDC_CHECK_DAYS8, NULL, NULL);
hText69 = CreateWindowW(L"STATIC", L"Duration", WS_CHILD | WS_VISIBLE,
20, 190, 100, 20, hWnd, (HMENU)ID_hText69, NULL, NULL);
hComboAlarmDuration = CreateWindowW(L"COMBOBOX", L"0", WS_BORDER | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 190, 60, 100, hWnd, (HMENU)ID_COMBO_ALARMDURATION, NULL, NULL);
hText70 = CreateWindowW(L"STATIC", L"AUTO ARM PARTITION", WS_CHILD | WS_VISIBLE,
20, 220, 200, 20, hWnd, (HMENU)ID_hText70, NULL, NULL);
hCheckBoxAAP1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 220, 30, 20,
hWnd, (HMENU)IDC_CHECK_AAP1, NULL, NULL);
hCheckBoxAAP2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
300, 220, 30, 20,
hWnd, (HMENU)IDC_CHECK_AAP2, NULL, NULL);
hCheckBoxAAP3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
340, 220, 30, 20,
hWnd, (HMENU)IDC_CHECK_AAP3, NULL, NULL);
hCheckBoxAAP4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
380, 220, 30, 20,
hWnd, (HMENU)IDC_CHECK_AAP4, NULL, NULL);
hText71 = CreateWindowW(L"STATIC", L"AUTO DISARM PARTITION", WS_CHILD | WS_VISIBLE,
20, 250, 200, 20, hWnd, (HMENU)ID_hText71, NULL, NULL);
hCheckBoxADP1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 250, 30, 20,
hWnd, (HMENU)IDC_CHECK_ADP1, NULL, NULL);
hCheckBoxADP2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
300, 250, 30, 20,
hWnd, (HMENU)IDC_CHECK_ADP2, NULL, NULL);
hCheckBoxADP3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
340, 250, 30, 20,
hWnd, (HMENU)IDC_CHECK_ADP3, NULL, NULL);
hCheckBoxADP4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
380, 250, 30, 20,
hWnd, (HMENU)IDC_CHECK_ADP4, NULL, NULL);
hText72 = CreateWindowW(L"STATIC", L"OUTPUT", WS_CHILD | WS_VISIBLE,
20, 280, 100, 20, hWnd, (HMENU)ID_hText72, NULL, NULL);
hCheckBoxOUTPUT1 = CreateWindowW(
L"BUTTON", L"1",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
100, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT1, NULL, NULL);
hCheckBoxOUTPUT2 = CreateWindowW(
L"BUTTON", L"2",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
140, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT2, NULL, NULL);
hCheckBoxOUTPUT3 = CreateWindowW(
L"BUTTON", L"3",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
180, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT3, NULL, NULL);
hCheckBoxOUTPUT4 = CreateWindowW(
L"BUTTON", L"4",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
220, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT4, NULL, NULL);
hCheckBoxOUTPUT5 = CreateWindowW(
L"BUTTON", L"5",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
260, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT5, NULL, NULL);
hCheckBoxOUTPUT6 = CreateWindowW(
L"BUTTON", L"6",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
300, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT6, NULL, NULL);
hCheckBoxOUTPUT7 = CreateWindowW(
L"BUTTON", L"7",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
340, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT7, NULL, NULL);
hCheckBoxOUTPUT8 = CreateWindowW(
L"BUTTON", L"8",
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
380, 280, 30, 20,
hWnd, (HMENU)IDC_CHECK_OUTPUT8, NULL, NULL);
hText73 = CreateWindowW(L"STATIC", L"NOTES", WS_CHILD | WS_VISIBLE,
20, 310, 100, 20, hWnd, (HMENU)ID_hText73, NULL, NULL);
hEditNotes = CreateWindowW(L"EDIT", L"", WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
140, 310, 140, 20, hWnd, (HMENU)ID_EDIT_NOTES, NULL, NULL);
hButtonAddAlarm = CreateWindowW(L"BUTTON", L"ADD", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
40, 340, 80, 20, hWnd, (HMENU)ID_BUTTON_ADDALARM, NULL, NULL);
hButtonModAlarm = CreateWindowW(L"BUTTON", L"MODIFY", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
120, 340, 80, 20, hWnd, (HMENU)ID_BUTTON_MODALARM, NULL, NULL);
hButtonDelAlarm = CreateWindowW(L"BUTTON", L"DEL", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
200, 340, 80, 20, hWnd, (HMENU)ID_BUTTON_DELALARM, NULL, NULL);
hWndLogAlarm = CreateWindowW(L"LISTBOX", L"", WS_BORDER | WS_VISIBLE | WS_CHILD | LBS_NOTIFY | WS_VSCROLL,
420, 70, 180, 240, hWnd, (HMENU)IDC_ALARM_LIST, hInstance, nullptr);
hButtonRetrieve = CreateWindowW(L"BUTTON", L"RETRIEVE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
420, 340, 80, 20, hWnd, (HMENU)ID_BUTTON_RETRIEVE, NULL, NULL);
hButtonSaveAlarm = CreateWindowW(L"BUTTON", L"SAVE TO FILE", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
500, 340, 100, 20, hWnd, (HMENU)ID_BUTTON_SAVEALARM, NULL, NULL);
if (hTab) {
AddTabs(hTab); // Call the function to add tabs
}
else {
MessageBox(hWnd, L"Failed to create tab control!", L"Error", MB_OK | MB_ICONERROR);
}
select_tab(hWnd, 0);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
switch (wmId)
{
case WM_CREATE:
{
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_TAB_CLASSES; // Initialize tab control classes
InitCommonControlsEx(&icex);
}
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
case ID_BUTTON_CLOSE2:
DestroyWindow(hWnd);
break;
case IDC_SEND_BUTTON1:
{
// Buffer for the selected item text
wchar_t messageBuffer[502] = { 0 };
// Get the selected index from the listbox
int selectedIndex = SendMessage(hWndListTimeZone, LB_GETCURSEL, 0, 0);
if (selectedIndex == LB_ERR) {
MessageBox(hWnd, L"No item selected in the listbox!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Retrieve the selected item's text
SendMessage(hWndListTimeZone, LB_GETTEXT, selectedIndex, (LPARAM)messageBuffer);
// Convert to multibyte string for sending over the socket
wchar_t messageToSend[512] = { 0 };
if (wcslen(messageBuffer) + wcslen(L"TimeZone: ") < _countof(messageToSend)) {
swprintf_s(messageToSend, _countof(messageToSend), L"TimeZone: %s", messageBuffer);
}
else {
MessageBox(NULL, L"Buffer overrun detected. Text is too long!", L"Error", MB_OK | MB_ICONERROR);
break; // Exit if the input is too long
}
char messageToSendMultibyte[512] = { 0 };
int conversionResult = WideCharToMultiByte(
CP_ACP, 0, messageToSend, -1, messageToSendMultibyte, sizeof(messageToSendMultibyte), NULL, NULL);
// Send the message to the server
int iResult = send(ConnectSocket, messageToSendMultibyte, (int)strlen(messageToSendMultibyte), 0);
if (iResult == SOCKET_ERROR) {
wchar_t errorMsg[256];
swprintf_s(errorMsg, L"Send failed with error: %d", WSAGetLastError());
MessageBox(hWnd, errorMsg, L"Error", MB_OK | MB_ICONERROR);
break;
}
MessageBoxW(NULL, messageToSend, L"Info", MB_OK);
// Confirm successful send
MessageBox(hWnd, L"Message sent successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_SEND_BUTTON2:
{
// Buffer for the selected item text
wchar_t messageBuffer[256] = { 0 };
// Get the selected index from the listbox
int selectedIndex = SendMessage(hWndListAccessTime, LB_GETCURSEL, 0, 0);
if (selectedIndex == LB_ERR) {
MessageBox(hWnd, L"No item selected in the listbox!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Retrieve the selected item's text
SendMessage(hWndListAccessTime, LB_GETTEXT, selectedIndex, (LPARAM)messageBuffer);
// Convert to multibyte string for sending over the socket
wchar_t messageToSend[512] = { 0 };
if (wcslen(messageBuffer) + wcslen(L"AccessTime: ") < _countof(messageToSend)) {
swprintf_s(messageToSend, _countof(messageToSend), L"AccessTime: %s", messageBuffer);
}
else {
MessageBox(NULL, L"Buffer overrun detected. Text is too long!", L"Error", MB_OK | MB_ICONERROR);
break; // Exit if the input is too long
}
char messageToSendMultibyte[512] = { 0 };
int conversionResult = WideCharToMultiByte(
CP_ACP, 0, messageToSend, -1, messageToSendMultibyte, sizeof(messageToSendMultibyte), NULL, NULL);
// Send the message to the server
int iResult = send(ConnectSocket, messageToSendMultibyte, (int)strlen(messageToSendMultibyte), 0);
if (iResult == SOCKET_ERROR) {
wchar_t errorMsg[256];
swprintf_s(errorMsg, L"Send failed with error: %d", WSAGetLastError());
MessageBox(hWnd, errorMsg, L"Error", MB_OK | MB_ICONERROR);
break;
}
// Confirm successful send
MessageBox(hWnd, L"Message sent successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_SEND_BUTTON3:
{
// Buffer for the selected item text
wchar_t messageBuffer[256] = { 0 };
// Get the selected index from the listbox
int selectedIndex = SendMessage(hWndListAcessArea, LB_GETCURSEL, 0, 0);
if (selectedIndex == LB_ERR) {
MessageBox(hWnd, L"No item selected in the listbox!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Retrieve the selected item's text
SendMessage(hWndListAcessArea, LB_GETTEXT, selectedIndex, (LPARAM)messageBuffer);
// Convert to multibyte string for sending over the socket
wchar_t messageToSend[512] = { 0 };
if (wcslen(messageBuffer) + wcslen(L"AccessArea: ") < _countof(messageToSend)) {
swprintf_s(messageToSend, _countof(messageToSend), L"AccessArea: %s", messageBuffer);
}
else {
MessageBox(NULL, L"Buffer overrun detected. Text is too long!", L"Error", MB_OK | MB_ICONERROR);
break; // Exit if the input is too long
}
char messageToSendMultibyte[512] = { 0 };
int conversionResult = WideCharToMultiByte(
CP_ACP, 0, messageToSend, -1, messageToSendMultibyte, sizeof(messageToSendMultibyte), NULL, NULL);
// Send the message to the server
int iResult = send(ConnectSocket, messageToSendMultibyte, (int)strlen(messageToSendMultibyte), 0);
if (iResult == SOCKET_ERROR) {
wchar_t errorMsg[256];
swprintf_s(errorMsg, L"Send failed with error: %d", WSAGetLastError());
MessageBox(hWnd, errorMsg, L"Error", MB_OK | MB_ICONERROR);
break;
}
// Confirm successful send
MessageBox(hWnd, L"Message sent successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_SEND_BUTTON4:
{
// Buffer for the selected item text
wchar_t messageBuffer[256] = { 0 };
// Get the selected index from the listbox
int selectedIndex = SendMessage(hWndListAcessGroup, LB_GETCURSEL, 0, 0);
if (selectedIndex == LB_ERR) {
MessageBox(hWnd, L"No item selected in the listbox!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Retrieve the selected item's text
SendMessage(hWndListAcessGroup, LB_GETTEXT, selectedIndex, (LPARAM)messageBuffer);
// Convert to multibyte string for sending over the socket
wchar_t messageToSend[512] = { 0 };
if (wcslen(messageBuffer) + wcslen(L"AccessGroup: ") < _countof(messageToSend)) {
swprintf_s(messageToSend, _countof(messageToSend), L"AccessGroup: %s", messageBuffer);
}
else {
MessageBox(NULL, L"Buffer overrun detected. Text is too long!", L"Error", MB_OK | MB_ICONERROR);
break; // Exit if the input is too long
}
char messageToSendMultibyte[512] = { 0 };
int conversionResult = WideCharToMultiByte(
CP_ACP, 0, messageToSend, -1, messageToSendMultibyte, sizeof(messageToSendMultibyte), NULL, NULL);
// Send the message to the server
int iResult = send(ConnectSocket, messageToSendMultibyte, (int)strlen(messageToSendMultibyte), 0);
if (iResult == SOCKET_ERROR) {
wchar_t errorMsg[256];
swprintf_s(errorMsg, L"Send failed with error: %d", WSAGetLastError());
MessageBox(hWnd, errorMsg, L"Error", MB_OK | MB_ICONERROR);
break;
}
// Confirm successful send
MessageBox(hWnd, L"Message sent successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_SEND_BUTTON5:
{
// Buffer for the selected item text
wchar_t messageBuffer[256] = { 0 };
// Get the selected index from the listbox
int selectedIndex = SendMessage(hWndListUser, LB_GETCURSEL, 0, 0);
if (selectedIndex == LB_ERR) {
MessageBox(hWnd, L"No item selected in the listbox!", L"Error", MB_OK | MB_ICONERROR);
break;
}
// Retrieve the selected item's text
SendMessage(hWndListUser, LB_GETTEXT, selectedIndex, (LPARAM)messageBuffer);
// Convert to multibyte string for sending over the socket
wchar_t messageToSend[512] = { 0 };
if (wcslen(messageBuffer) + wcslen(L"User: ") < _countof(messageToSend)) {
swprintf_s(messageToSend, _countof(messageToSend), L"User: %s", messageBuffer);
}
else {
MessageBox(NULL, L"Buffer overrun detected. Text is too long!", L"Error", MB_OK | MB_ICONERROR);
break; // Exit if the input is too long
}
char messageToSendMultibyte[512] = { 0 };
int conversionResult = WideCharToMultiByte(
CP_ACP, 0, messageToSend, -1, messageToSendMultibyte, sizeof(messageToSendMultibyte), NULL, NULL);
// Send the message to the server
int iResult = send(ConnectSocket, messageToSendMultibyte, (int)strlen(messageToSendMultibyte), 0);
if (iResult == SOCKET_ERROR) {
wchar_t errorMsg[256];
swprintf_s(errorMsg, L"Send failed with error: %d", WSAGetLastError());
MessageBox(hWnd, errorMsg, L"Error", MB_OK | MB_ICONERROR);
break;
}
// Confirm successful send
MessageBox(hWnd, L"Message sent successfully!", L"Info", MB_OK | MB_ICONINFORMATION);
}
break;
case IDC_ADD_USER:// Your main app's button ID
{
DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_ADD_DIALOG4), hWnd, AddDialogProc4, (LPARAM)hWnd);
}
break;
case IDC_DEL_USER: // ID for your delete button
{
// Get the selected text from the log box
HWND hLogBox = GetDlgItem(hWnd, IDC_LOGBOX);
int selectedIndex = SendMessageW(hLogBox, LB_GETCURSEL, 0, 0);
if (selectedIndex != LB_ERR) {
// Confirmation popup
int result = MessageBoxW(
hWnd,
L"Are you sure you want to delete the selected item?",
L"Confirm Delete",
MB_YESNO | MB_ICONQUESTION
);
if (result == IDYES) {
// Delete the selected item
SendMessageW(hLogBox, LB_DELETESTRING, selectedIndex, 0);
}
}
else {
MessageBoxW(hWnd, L"No item is selected!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
case IDC_ADD_ACCESSTIME:// Your main app's button ID
{
DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_ADD_DIALOG2), hWnd, AddDialogProc2, (LPARAM)hWnd);
}
break;
case IDC_DEL_ACCESSTIME: // ID for your delete button
{
// Get the selected text from the log box
HWND hLogBox = GetDlgItem(hWnd, IDC_ACCESSTIME_LIST);
int selectedIndex = SendMessageW(hLogBox, LB_GETCURSEL, 0, 0);
if (selectedIndex != LB_ERR) {
// Confirmation popup
int result = MessageBoxW(
hWnd,
L"Are you sure you want to delete the selected item?",
L"Confirm Delete",
MB_YESNO | MB_ICONQUESTION
);
if (result == IDYES) {
// Delete the selected item
SendMessageW(hLogBox, LB_DELETESTRING, selectedIndex, 0);
}
}
else {
MessageBoxW(hWnd, L"No item is selected!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
case IDC_ADD_TIMEZONE:// Your main app's button ID
{
DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_ADD_DIALOG), hWnd, AddDialogProc, (LPARAM)hWnd);
}
break;
case IDC_DEL_TIMEZONE:// ID for your delete button
{
// Get the selected text from the log box
HWND hLogBox = GetDlgItem(hWnd, IDC_TIMEZONE_LIST);
int selectedIndex = SendMessageW(hLogBox, LB_GETCURSEL, 0, 0);
if (selectedIndex != LB_ERR) {
// Confirmation popup
int result = MessageBoxW(
hWnd,
L"Are you sure you want to delete the selected item?",
L"Confirm Delete",
MB_YESNO | MB_ICONQUESTION
);
if (result == IDYES) {
// Delete the selected item
SendMessageW(hLogBox, LB_DELETESTRING, selectedIndex, 0);
}
}
else {
MessageBoxW(hWnd, L"No item is selected!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
case IDC_ADD_ACCESSAREA:// Your main app's button ID
{
DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_ADD_DIALOG3), hWnd, AddDialogProc3, (LPARAM)hWnd);
}
break;
case IDC_DEL_ACCESSAREA: // ID for your delete button
{
// Get the selected text from the log box
HWND hLogBox = GetDlgItem(hWnd, IDC_ACCESSAREA_LIST);
int selectedIndex = SendMessageW(hLogBox, LB_GETCURSEL, 0, 0);
if (selectedIndex != LB_ERR) {
// Confirmation popup
int result = MessageBoxW(
hWnd,
L"Are you sure you want to delete the selected item?",
L"Confirm Delete",
MB_YESNO | MB_ICONQUESTION
);
if (result == IDYES) {
// Delete the selected item
SendMessageW(hLogBox, LB_DELETESTRING, selectedIndex, 0);
}
}
else {
MessageBoxW(hWnd, L"No item is selected!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
case IDC_ADD_ACCESSGROUP:// Your main app's button ID
{
DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_ADD_DIALOG1), hWnd, AddDialogProc1, (LPARAM)hWnd);
}
break;
case IDC_DEL_ACCESSGROUP: // ID for your delete button
{
// Get the selected text from the log box
HWND hLogBox = GetDlgItem(hWnd, IDC_ACCESSGROUP_LIST);
int selectedIndex = SendMessageW(hLogBox, LB_GETCURSEL, 0, 0);
if (selectedIndex != LB_ERR) {
// Confirmation popup
int result = MessageBoxW(
hWnd,
L"Are you sure you want to delete the selected item?",
L"Confirm Delete",
MB_YESNO | MB_ICONQUESTION
);
if (result == IDYES) {
// Delete the selected item
SendMessageW(hLogBox, LB_DELETESTRING, selectedIndex, 0);
}
}
else {
MessageBoxW(hWnd, L"No item is selected!", L"Error", MB_OK | MB_ICONERROR);
}
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_CTLCOLORSTATIC:
{
HDC hdcStatic = (HDC)wParam;
HWND hStatic = (HWND)lParam;
if (hStatic == GetDlgItem(hWnd, IDC_HEADER_TEXT1)) {
SetTextColor(hdcStatic, RGB(0, 255, 0)); // Green text
SetBkMode(hdcStatic, TRANSPARENT);
return (INT_PTR)GetStockObject(NULL_BRUSH);
}
if (hStatic == GetDlgItem(hWnd, IDC_HEADER_TEXT2)) {
SetTextColor(hdcStatic, RGB(0, 255, 0)); // Green text
SetBkMode(hdcStatic, TRANSPARENT);
return (INT_PTR)GetStockObject(NULL_BRUSH);
}
if (hStatic == GetDlgItem(hWnd, IDC_HEADER_TEXT3)) {
SetTextColor(hdcStatic, RGB(0, 255, 0)); // Green text
SetBkMode(hdcStatic, TRANSPARENT);
return (INT_PTR)GetStockObject(NULL_BRUSH);
}
break;
}
case WM_NOTIFY:
{
NMHDR* nmhdr = (NMHDR*)lParam;
if (nmhdr->hwndFrom == hTab && nmhdr->code == TCN_SELCHANGE) {
// Get the selected tab index
int selectedIndex = TabCtrl_GetCurSel(hTab);
select_tab(hWnd, selectedIndex); // Call select_tab with the selected index
}
if (((LPNMHDR)lParam)->hwndFrom == hTab && ((LPNMHDR)lParam)->code == TCN_SELCHANGE) {
int iPage = TabCtrl_GetCurSel(hTab); // Get the selected tab
// Update your content here based on iPage
}
if (nmhdr->hwndFrom == hTab2 && nmhdr->code == TCN_SELCHANGE) {
// Get the selected tab index
int selectedIndex2 = TabCtrl_GetCurSel(hTab2);
select_tab2(hWnd, selectedIndex2); // Call select_tab with the selected index
}
if (((LPNMHDR)lParam)->hwndFrom == hTab && ((LPNMHDR)lParam)->code == TCN_SELCHANGE) {
int iPage2 = TabCtrl_GetCurSel(hTab2); // Get the selected tab
// Update your content here based on iPage
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
}
break;
case WM_RECEIVEDATA:
{
char* receivedMessage = (char*)lParam; // Received data as char*
if (receivedMessage && strlen(receivedMessage) > 0) { // Check if the message is not empty or null
// Convert char* to wchar_t* for Windows message processing
int wideLen = MultiByteToWideChar(CP_ACP, 0, receivedMessage, -1, NULL, 0); // Automatically calculate length including null terminator
if (wideLen > 0) {
wchar_t* wideMessage = new wchar_t[wideLen]; // Allocate enough space including null terminator
MultiByteToWideChar(CP_ACP, 0, receivedMessage, -1, wideMessage, wideLen);
// Get the current content length of the log box
int logLen = GetWindowTextLength(hWndLogBox);
// Move the cursor to the end of the log box
SendMessageW(hWndLogBox, EM_SETSEL, (WPARAM)logLen, (LPARAM)logLen);
// Append the wide message to the log box
SendMessageW(hWndLogBox, EM_REPLACESEL, FALSE, (LPARAM)wideMessage);
// Move to the next line after the message
SendMessageW(hWndLogBox, EM_REPLACESEL, FALSE, (LPARAM)L"\r\n");
// Clean up the dynamically allocated memory
delete[] wideMessage;
}
}
else {
// Do not write to the log box if the received message is empty or null
MessageBoxW(NULL, L"Received empty or null data", L"Error", MB_OK); // Use MessageBoxW for wide strings
}
}
break;
case WM_DESTROY:
{
PostQuitMessage(0);
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCELABOUT)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}