|
// DatabaseOpDlg.cpp : implementation file
//
#include "stdafx.h"
#include "morefast.h"
#include "DatabaseOpDlg.h"
#include "key.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDatabaseOpDlg property page
IMPLEMENT_DYNCREATE(CDatabaseOpDlg, CPropertyPage)
CDatabaseOpDlg::CDatabaseOpDlg() : CPropertyPage(CDatabaseOpDlg::IDD)
{
//{{AFX_DATA_INIT(CDatabaseOpDlg)
m_path = _T("");
//}}AFX_DATA_INIT
CRegKey reg;
// If it's the first time, an AddIns subkey may not exist, so we need to create it
if (reg.Create(HKEY_CURRENT_USER, KeyAddIns) == ERROR_SUCCESS)
{
HKEY key = reg.Detach();
if (reg.Create(key, KeyAutoSave) == ERROR_SUCCESS)
{
//DWORD val;
unsigned long l=512;
char valstr[512];
if (reg.QueryValue(valstr, "DatabasePath",&l) == ERROR_SUCCESS)
m_path.Format("%s",valstr);
}
reg.Close();
reg.Attach(key);
}
}
CDatabaseOpDlg::~CDatabaseOpDlg()
{
}
void CDatabaseOpDlg::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDatabaseOpDlg)
DDX_Text(pDX, IDC_STATIC_PATH, m_path);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDatabaseOpDlg, CPropertyPage)
//{{AFX_MSG_MAP(CDatabaseOpDlg)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDatabaseOpDlg message handlers
void CDatabaseOpDlg::OnBrowse()
{
static char BASED_CODE szFilter[] = "Database Files (*..mdb)|*.mdb||";
int ret;
CFileDialog file(TRUE,"*.*",m_path,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter);
ret = file.DoModal();
if(ret == IDCANCEL)
return;
m_path= file.GetPathName();
UpdateData(FALSE);
SetModified();
AfxMessageBox("Please Restart Visual Studio If You Have Changed DatabasePath");
}
BOOL CDatabaseOpDlg::OnApply()
{
// TODO: Add your specialized code here and/or call the base class
CRegKey reg;
if (reg.Create(HKEY_CURRENT_USER, KeyFull) == ERROR_SUCCESS)
{
reg.SetValue(m_path.GetBuffer(1), "DatabasePath");
}
return CPropertyPage::OnApply();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
A 8 or something in .NET, living in Ahmedabad, India owned IntelliPro Solutions Pvt. Ltd..
Currently working on .NET technologies, MVC and Silverlight.
My little blog is for helping community with the solution for problems or helping them to understand new technology. You can reach to my blog at http://maniish.wordpress.com.
To contact me, post comment here or email me at manish AT iprospl.com
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.