XTRegistryManager Problem |
Post Reply |
Author | |
jwhagen
Groupie Joined: 09 May 2003 Location: United States Status: Offline Points: 43 |
Post Options
Thanks(0)
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 |
|
blindemann
Guest Group Joined: 08 July 2003 Location: United States Status: Offline Points: 11 |
Post Options
Thanks(0)
|
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
|
|
jwhagen
Groupie Joined: 09 May 2003 Location: United States Status: Offline Points: 43 |
Post Options
Thanks(0)
|
Yes, you are correct. Thanks for pointing that out. Not sure how or why I missed it. Sorry for the trouble. John Hagen |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |