/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * DIALOG_COPY_MOVE_DlgProc */ static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HLOCAL hGroup; switch (msg) { case WM_INITDIALOG: /* List all group names */ for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup)) SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_ADDSTRING, 0, (LPARAM) GROUP_GroupName(hGroup)); SetDlgItemText(hDlg, PM_PROGRAM, CopyMove.lpszProgramName); SetDlgItemText(hDlg, PM_FROM_GROUP, CopyMove.lpszFromGroupName); break; case WM_COMMAND: switch (wParam) { case IDOK: { /* Get selected group */ INT nCurSel = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETCURSEL, 0, 0); INT nLen = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXTLEN, nCurSel, 0); HLOCAL hBuffer = LocalAlloc(LMEM_FIXED, nLen + 1); LPSTR buffer = LocalLock(hBuffer); SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXT, nCurSel, (LPARAM)buffer); for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup)) if (!lstrcmp(buffer, GROUP_GroupName(hGroup))) break; LocalFree(hBuffer); CopyMove.hToGroup = hGroup; EndDialog(hDlg, IDOK); return TRUE; } case IDCANCEL: EndDialog(hDlg, IDCANCEL); return TRUE; } } return FALSE; }
VOID MAIN_AutoStart() { CHAR buffer[BUFFER_SIZE]; HLOCAL hGroup, hProgram; GetPrivateProfileString("Settings", "AutoStart", "Autostart", buffer, sizeof(buffer), Globals.lpszIniFile); for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup)) if (!lstrcmp(buffer, GROUP_GroupName(hGroup))) for (hProgram = PROGRAM_FirstProgram(hGroup); hProgram; hProgram = PROGRAM_NextProgram(hProgram)) PROGRAM_ExecuteProgram(hProgram); }