options.h

来自「一个不同目录中多个文件拷贝的助手程序」· C头文件 代码 · 共 86 行

H
86
字号
//-----------------------------------------------------------------------//
// This is a part of the Multicopier.									 //	
// Autor  :  Ahmed Ismaiel Zakaria										 //
// (C) 2002 FCIS Egypt  All rights reserved								 //
// This code is provided "as is", with absolutely no warranty expressed  //
// or implied. Any use is at your own risk.								 //		
// You must obtain the author's consent before you can include this code //
// in a software library.												 //
// If the source code in  this file is used in any application			 //
// then acknowledgement must be made to the author of this program		 //	
// ahmed_ismaiel@hotmail.com											 //
//-----------------------------------------------------------------------//

// Options.h : Declaration of the COptions

#ifndef __OPTIONS_H_
#define __OPTIONS_H_

#include "resource.h"       // main symbols
#include <atlhost.h>

/////////////////////////////////////////////////////////////////////////////
// COptions
class COptions : 
	public CAxDialogImpl<COptions>
{
public:
	COptions()
	{
	}

	~COptions()
	{
	}

	enum { IDD = IDD_OPTIONS };

BEGIN_MSG_MAP(COptions)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	COMMAND_ID_HANDLER(IDOK, OnOK)
	COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		CButton b;b.Attach (::GetDlgItem (this->m_hWnd,IDC_DELETE));
		CRegDWORD  myword("Software\\Company\\Subkey\\mydword", 0, TRUE, HKEY_LOCAL_MACHINE);
		b.SetCheck ((DWORD)myword);
		b.Detach ();

		return 1;  // Let the system set the focus
	}

	LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		CButton b;b.Attach (::GetDlgItem (this->m_hWnd,IDC_DELETE));
		if (b.GetCheck()==BST_CHECKED)
		{
			CRegDWORD  myword("Software\\Company\\Subkey\\mydword", 0, TRUE, HKEY_LOCAL_MACHINE);
			myword=1;
			
		}
		else
		{
			CRegDWORD  myword("Software\\Company\\Subkey\\mydword", 0, TRUE, HKEY_LOCAL_MACHINE);
			myword=0;	
		}
		b.Detach ();
		EndDialog(wID);

		return 0;
	}

	LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
	{
		EndDialog(wID);
		return 0;
	}
};

#endif //__OPTIONS_H_

⌨️ 快捷键说明

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