regbinding.h

来自「zip的全部算法源代码」· C头文件 代码 · 共 87 行

H
87
字号
// RegBinding.h: interface for the CRegBinding class.
//
//////////////////////////////////////////////////////////////////////

/*
 * CREGBINDING.H
 *
 * Registry Class
 *
 * Copyright (C) 1998 by Joerg Dentler (dentler@tpnet.de)
 * All rights reserved
 *
 */
 //
// Version 1.0.0        98-11-20 created

/////////////////////////////////////////////////////////////////////////////
// Permission is granted to anyone to use this software for any
// purpose and to redistribute it in any way, subject to the following 
// restrictions:
//
// 1. The author is not responsible for the consequences of use of
//    this software, no matter how awful, even if they arise
//    from defects in it.
//
// 2. The origin of this software must not be misrepresented, either
//    by explicit claim or by omission.
//
// 3. Altered versions must be plainly marked as such, and must not
//    be misrepresented (by explicit claim or omission) as being
//    the original software.
// 
// 4. This notice must not be removed or altered.
/////////////////////////////////////////////////////////////////////////////



#if !defined(AFX_REGBINDING_H__83AA8B84_33F5_11D3_81C7_0000B4A265C3__INCLUDED_)
#define AFX_REGBINDING_H__83AA8B84_33F5_11D3_81C7_0000B4A265C3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CEntry;

class CRegBinding : public CObject  
{
 public:
  CRegBinding(const char *section);

  // Bind frequently used data types
  void Bind(bool       &value, const char *name, const bool def = false);
  void Bind(int        &value, const char *name, const int def = 0);
  void Bind(DWORD      &value, const char *name, const DWORD def = 0);
  void Bind(CString    &value, const char *name, const char *def = NULL);
  void Bind(CByteArray &value, const char *name, const CByteArray *def = NULL);
  // Save the window's screen state
  void Bind(CWnd       *value, const char *name = NULL);
  // Write Data - optional clear variable bindings
  void Write(const BOOL clear = FALSE);

 ~CRegBinding();
 protected:
  // Data
  CObList  m_list;
  CString  m_strSection;
 protected:
  void SaveWindowState(const CEntry &e);
  void Write(const CEntry *e);
  void Insert(const CEntry &e);
  BOOL Hook(const HWND hwnd);
  BOOL FindAndRemove(CEntry *&e, const HWND hwnd);

  static CWinApp *m_pApp;
  static HHOOK    m_hHook;
  // reference counting
  static CObList  m_lInstances;

  static LRESULT CALLBACK FilterHook(int code, WPARAM wParam, LPARAM lParam);
  static void Bind(CRegBinding *rs);
  static void UnBind(CRegBinding *rs);

};

#endif // !defined(AFX_REGBINDING_H__83AA8B84_33F5_11D3_81C7_0000B4A265C3__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?