home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / registry.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  1.9 KB  |  71 lines

  1. /* 
  2.  *  registry.cpp - Windows registry stuff
  3.  *
  4.  *    Copyright (C) Alberto Vigata - January 2000 - ultraflask@yahoo.com
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24. #include "flaskmpeg.h"
  25.  
  26. HKEY MyKey;
  27. void SaveRegistryConfig( TConfig *Config )
  28. {
  29.     RegSetValueEx( MyKey , "Config" , NULL , REG_BINARY , (CONST BYTE *)  Config , sizeof(TConfig));
  30.     RegCloseKey(MyKey);
  31.     return;
  32. }
  33.  
  34.  
  35.  
  36. int LoadRegistryConfig( TConfig *Config )
  37. {
  38.     int error;
  39.     DWORD Disposition;
  40.     CHAR Class[MAX_PATH];
  41.     error=RegCreateKeyEx( HKEY_CURRENT_USER,
  42.                "Software\\FlasK Development\\FlasK MPEG",
  43.                NULL,
  44.                Class,
  45.                REG_OPTION_NON_VOLATILE,
  46.                KEY_ALL_ACCESS,
  47.                NULL,
  48.                &MyKey,
  49.                &Disposition);
  50.  
  51.     if(Disposition==REG_CREATED_NEW_KEY)
  52.     {
  53.     //The key didn't exist, so this is the first time Flaskmpeg
  54.     //is running. Leave defaults
  55.  
  56.     return 0;
  57.     }
  58.  
  59.     if(Disposition==REG_OPENED_EXISTING_KEY)
  60.     {
  61.     //The key existed, so load configuration in Config
  62.     unsigned long size_temp=sizeof(TConfig);
  63.     RegQueryValueEx( MyKey,"Config",NULL, NULL, (LPBYTE) Config , &size_temp);
  64.     return 1;
  65.     }
  66.  
  67.  
  68.  
  69. return 0;
  70. }
  71.