dooley090698
asked on
CString exception error in a DLL
I have a class in a DLL.
It is currently dynamicly linked to the MFC's.
This is a code snipet from the base class.
Everytime I try to run it I get an exception error at the line:
ConPath = "ODBC;DSN=Simply: ";
If I comment out this line the next exception error occurs at:
Filename=FOpen.GetFileName ();
Seems to be the CString class (and yes I have included the header file for the CString class..:) )
Any suggestions would be appreciated..
class CAccounts
{
private:
protected:
long NoAccounts;
long NoTxs;
CTime CurrentUsingDate;
CString ConPath;
CString Filename;
//======================== ==========
void CAccounts::OpendataBase()
{
ConPath = "ODBC;DSN=Simply: ";
CFileDialog FOpen(TRUE,"*.sdb","*.sdb" ,OFN_HIDER EADONLY,"S imply Data |*.sdb ||");
if (FOpen.DoModal()==IDOK)
{
Filename=FOpen.GetFileName ();
Filename = Filename.Left(13);
ConPath=ConPath+Filename+" ;UID=sysad min";
It is currently dynamicly linked to the MFC's.
This is a code snipet from the base class.
Everytime I try to run it I get an exception error at the line:
ConPath = "ODBC;DSN=Simply: ";
If I comment out this line the next exception error occurs at:
Filename=FOpen.GetFileName
Seems to be the CString class (and yes I have included the header file for the CString class..:) )
Any suggestions would be appreciated..
class CAccounts
{
private:
protected:
long NoAccounts;
long NoTxs;
CTime CurrentUsingDate;
CString ConPath;
CString Filename;
//========================
void CAccounts::OpendataBase()
{
ConPath = "ODBC;DSN=Simply: ";
CFileDialog FOpen(TRUE,"*.sdb","*.sdb"
if (FOpen.DoModal()==IDOK)
{
Filename=FOpen.GetFileName
Filename = Filename.Left(13);
ConPath=ConPath+Filename+"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Odd thing though is if I change the CString variables to char and use the string manipulation routines (ie strcpy , strlen etc.) all seems to works fine.
Hmmmm....
Hmmmm....
ASKER
Oh and this is the debug version btw
ASKER
well I found the problem...
Would you believe I had declared the class in the main exe but never created an instance of it.....DOH!!!!!
That seemed to clear things up.....
If I keep making STUPID STUPID mistakes like that figure I should maybe take up another hobby!! :)
Would you believe I had declared the class in the main exe but never created an instance of it.....DOH!!!!!
That seemed to clear things up.....
If I keep making STUPID STUPID mistakes like that figure I should maybe take up another hobby!! :)
You have to use only combinations Debug DLL with Debug App, and Release DLL with Release App.