#include #include #include #include #include "xlock.h" #include "xlock95.h" /* Win95 specific globals */ extern HWND hwnd; // window handle extern HDC hdc; // device context extern RECT rc; // coords of the screen unsigned int xlockmore_create(void); void xlockmore_destroy(void); void xlockmore_init(void); unsigned int xlockmore_timer(void); static int *enabled = NULL; char *xlock95_get_modelist() { int m; HKEY skey; char key[1024]; static char modelist[1024] = ""; /* make this dynamic!! */ if(enabled == NULL) { enabled = (int*)malloc((numprocs-1)*sizeof(int)); } /* Populate enabled[] from registry */ for(m=0; m= 0 && m < numprocs-1) { SetDlgItemText(hDlg, DESC_LABEL, LockProcs[m].desc); SetDlgItemText(hDlg, DELAY_TEXT, _itoa(LockProcs[m].def_delay, tchBuffer, 10)); SetDlgItemText(hDlg, COUNT_TEXT, _itoa(LockProcs[m].def_count, tchBuffer, 10)); SetDlgItemText(hDlg, CYCLES_TEXT, _itoa(LockProcs[m].def_cycles,tchBuffer, 10)); SendDlgItemMessage(hDlg, ENABLE_BUTTON, BM_SETCHECK, (WPARAM)(enabled[m]? BST_CHECKED:BST_UNCHECKED), 0); } return TRUE; break; case LBN_DBLCLK: m = SendDlgItemMessage(hDlg, MODE_LIST, LB_GETCURSEL, 0, 0); if(m >= 0 && m < numprocs-1) { enabled[m] = !enabled[m]; SendDlgItemMessage(hDlg, ENABLE_BUTTON, BM_SETCHECK, (WPARAM)(enabled[m]? BST_CHECKED:BST_UNCHECKED), 0); sprintf(tchBuffer, "%c\t%s", enabled[m]?'x':' ', LockProcs[m].cmdline_arg); SendDlgItemMessage(hDlg, MODE_LIST, LB_DELETESTRING, (WPARAM)m, 0); SendDlgItemMessage(hDlg, MODE_LIST, LB_INSERTSTRING, m, (LPARAM) tchBuffer); SendDlgItemMessage(hDlg, MODE_LIST, LB_SETCURSEL, m, 0); } } break; case ENABLE_BUTTON: switch (HIWORD(wParam)) { case BN_CLICKED: m = SendDlgItemMessage(hDlg, MODE_LIST, LB_GETCURSEL, 0, 0); if(m >= 0 && m < numprocs-1) { enabled[m] = !enabled[m]; SendDlgItemMessage(hDlg, ENABLE_BUTTON, BM_SETCHECK, (WPARAM)(enabled[m]? BST_CHECKED:BST_UNCHECKED), 0); sprintf(tchBuffer, "%c\t%s", enabled[m]?'x':' ', LockProcs[m].cmdline_arg); SendDlgItemMessage(hDlg, MODE_LIST, LB_DELETESTRING, m, 0); SendDlgItemMessage(hDlg, MODE_LIST, LB_INSERTSTRING, m, (LPARAM)tchBuffer); SendDlgItemMessage(hDlg, MODE_LIST, LB_SETCURSEL, m, 0); } return TRUE; } break; case IDOK: { HKEY skey; char key[1024]; char buf[20]; for(m=0; m