Print Page | Close Window

XTRegistryManager Problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=106
Printed Date: 22 December 2024 at 5:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: XTRegistryManager Problem
Posted By: jwhagen
Subject: XTRegistryManager Problem
Date Posted: 22 July 2003 at 12:37pm

I am trying to utilize the functions of the XTRegistryManager. When attempting to utilize the following functions, I receive a First Chance Exception. It appears to occur when

if (m_strINIFileName.IsEmpty())

is executed. This occurs in both of the following functions:e 

BOOL CXTRegistryManager::GetProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue)

BOOL CXTRegistryManager::WriteProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue)

{

ASSERT(lpszSection != NULL);

if (m_strINIFileName.IsEmpty())

{

I have confirmed the three parameters are being passed correctly. I am also using the SetRegistryKey(COMPANYNAME) in the InitInstance() of the main application.

I have not chosen to create an INI file, but instead want to write to the registry. Therefore, I have not taken any measures to change the value of m_strINIFileName. In debugging this function, I noted that many times m_strINIFileName is accessed the string is always NULL, but when this function is entered, the string appears to be invalid (value = ???).

Is there something else that must occur to set the m_strINIFileName to a valid value before calling these functions when reading or writing to the registry?

Thanks.

John Hagen




Replies:
Posted By: blindemann
Date Posted: 22 August 2003 at 1:55pm

John,

We found the problem. You never allocated CXTRegistryManager with a new.

            SetRegistryKey(_T("Codejock Software Demos"));

            m_pXTRegistryManager = new CXTRegistryManager;

            CString st  = m_pXTRegistryManager->GetProfileString(_T("Settings"), _T("TestSettingOne"), _T("0"));

            CString str = m_pXTRegistryManager->WriteProfileString(_T("Settings"), _T("TestSettingTwo"), _T("0"));

We are not sure why you would make this a static pointer. Members of VisualStudio7 can be accessed through theApp.

Thanks,

Bob



-------------
Bob at Codejock


Posted By: jwhagen
Date Posted: 22 August 2003 at 2:30pm

Yes, you are correct. Thanks for pointing that out. Not sure how or why I missed it. Sorry for the trouble.

John Hagen




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net