Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - XTRegistryManager Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XTRegistryManager Problem

 Post Reply Post Reply
Author
Message
jwhagen View Drop Down
Groupie
Groupie
Avatar

Joined: 09 May 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote jwhagen Quote  Post ReplyReply Direct Link To This Post Topic: XTRegistryManager Problem
    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



Edited by jwhagen
Back to Top
blindemann View Drop Down
Guest Group
Guest Group
Avatar

Joined: 08 July 2003
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote blindemann Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jwhagen View Drop Down
Groupie
Groupie
Avatar

Joined: 09 May 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote jwhagen Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.