Exemple #1
0
static VOID MAIN_CreateGroups(VOID)
{
  CHAR buffer[BUFFER_SIZE];
  CHAR szPath[MAX_PATHNAME_LEN];
  CHAR key[20], *ptr;

  /* Initialize groups according the `Order' entry of `progman.ini' */
  GetPrivateProfileStringA("Settings", "Order", "", buffer, sizeof(buffer), Globals.lpszIniFile);
  ptr = buffer;
  while (ptr < buffer + sizeof(buffer))
    {
      int num, skip, ret;
      ret = sscanf(ptr, "%d%n", &num, &skip);
      if (ret == 0)
	MAIN_MessageBoxIDS_s(IDS_FILE_READ_ERROR_s, Globals.lpszIniFile, IDS_ERROR, MB_OK);
      if (ret != 1) break;

      sprintf(key, "Group%d", num);
      GetPrivateProfileStringA("Groups", key, "", szPath,
			      sizeof(szPath), Globals.lpszIniFile);
      if (!szPath[0]) continue;

      GRPFILE_ReadGroupFile(szPath);

      ptr += skip;
    }
  /* FIXME initialize other groups, not enumerated by `Order' */
}
Exemple #2
0
VOID GROUP_NewGroup(void)
{
  CHAR szName[MAX_PATHNAME_LEN] = "";
  CHAR szFile[MAX_PATHNAME_LEN] = "";
  OFSTRUCT dummy;

  if (!DIALOG_GroupAttributes(szName, szFile, MAX_PATHNAME_LEN)) return;

  if (OpenFile(szFile, &dummy, OF_EXIST) == HFILE_ERROR)
    {
      /* File doesn't exist */
      HLOCAL hGroup =
	GROUP_AddGroup(szName, szFile, SW_SHOWNORMAL,
		       DEF_GROUP_WIN_XPOS, DEF_GROUP_WIN_YPOS,
		       DEF_GROUP_WIN_WIDTH, DEF_GROUP_WIN_HEIGHT, 0, 0,
		       FALSE, FALSE, FALSE);
      if (!hGroup) return;
      GRPFILE_WriteGroupFile(hGroup);
    }
  else /* File exist */
    GRPFILE_ReadGroupFile(szFile);

  /* FIXME Update progman.ini */
}
Exemple #3
0
VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup)
{
    HANDLE hFile;
    WCHAR szGrpFile[MAX_PATHNAME_LEN] = L"";
    WCHAR szTitle[MAX_PATHNAME_LEN]   = L"";

    // ZeroMemory(szTitle, sizeof(szTitle));
    // ZeroMemory(szGrpFile, sizeof(szGrpFile));

    if (!DIALOG_GroupAttributes(format, szTitle, szGrpFile, MAX_PATHNAME_LEN))
        return;

    /*
     * Just check whether the group file does exist. If it does, close the handle, because GRPFILE_ReadGroupFile will
     * reopen the file for loading. If it doesn't exist, we create a new one.
     */
    hFile = CreateFileW(szGrpFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (hFile == INVALID_HANDLE_VALUE)
    {
        /* File doesn't exist */
        PROGGROUP* hGroup = GROUP_AddGroup(format, bIsCommonGroup, szTitle, szGrpFile,
                                           DEF_GROUP_WIN_XPOS, DEF_GROUP_WIN_YPOS,
                                           DEF_GROUP_WIN_XPOS + DEF_GROUP_WIN_WIDTH, DEF_GROUP_WIN_YPOS + DEF_GROUP_WIN_HEIGHT,
                                           0, 0, SW_SHOWNORMAL, 0, 0, FALSE, FALSE);
        if (hGroup)
            GRPFILE_WriteGroupFile(hGroup);
    }
    else
    {
        /* File exist */
        CloseHandle(hFile);
        GRPFILE_ReadGroupFile(szGrpFile, bIsCommonGroup);
    }

    /* FIXME Update progman.ini */
}