|
-
July 9th, 1999, 01:42 PM
#1
Confusued
CThreadsView::CThreadsView()
{
// TODO: add construction code here
CFileDialog _FileBox(TRUE,"*.mdb");
ThreadOnOff = FALSE;
_ST = NULL;
GetKeyDBFileValues("KanComm\\DISPLAY",&MyDataName);
MessageBox("Point -1 " + MyDataName);
if ( MyDataName == "" )
{
//if no database open file find
MessageBox(MyDataName);
_FileBox.DoModal();
MyDataName = _FileBox.GetPathName();
}
if ( MyDataName == "" )
{
MessageBox("Cannot create window without a database connection");
return;
}
_PortSettings = "COM2 baud=19200 parity=N data=8";
MyData.Open(MyDataName);
if (!MyData.IsOpen() )
MessageBox("DataBase is not open");
}
I have a question. When I run this code in debug mode it runs right; but when I run it in release mode the MyDataName is set to the proper string, but the condition of [MyDataName ==%2
-
July 9th, 1999, 02:55 PM
#2
Re: Confusued
Well to start with, in C/C++ it's never a good idea to start any variable or function names with an underscore (look up Decorated Names in the help files).
Now your code... have you tried using CString::IsEmpty()?
I've changed all class member variables to begin with m_
CThreadsView::CThreadsView()
{
CFileDialog FileBox(TRUE,"*.mdb");
m_ThreadOnOff = FALSE;
m_ST = NULL;
GetKeyDBFileValues("KanComm\\DISPLAY",&m_MyDataName);
// Assume that the above function returns the correct value
MessageBox("Point -1 " + m_MyDataName);
if ( m_MyDataName.IsEmpty() )
{
//if no database open file find
// MessageBox(MyDataName); // We know it's empty at this point
if (FileBox.DoModal() == IDOK)
{
m_MyDataName = FileBox.GetPathName();
}
else
{
MessageBox("Cannot create window without a database connection");
return;
}
}
m_PortSettings = "COM2 baud=19200 parity=N data=8";
m_MyData.Open(m_MyDataName);
if (!m_MyData.IsOpen() )
MessageBox("DataBase is not open");
}
My other caveat would be that I don't think the constructor is the right place for this... Have you thought about having a public member function CThreadsView::OpenConnection() or something?
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|