Solved

CString exception error in a DLL

Posted on 2001-07-01
5
491 Views
Last Modified: 2013-11-20
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_HIDEREADONLY,"Simply Data |*.sdb ||");
     
     if (FOpen.DoModal()==IDOK)
     {
     Filename=FOpen.GetFileName();


     Filename = Filename.Left(13);
     ConPath=ConPath+Filename+";UID=sysadmin";    
         
0
Comment
Question by:dooley090698
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Pacman earned 100 total points
Comment Utility
I don't think that the problem is in the code you posted.
Maybe some memory overwriting in another part of your program ?
0
 
LVL 2

Expert Comment

by:MadYugoslav
Comment Utility
Is this sutisfied:
You have to use only combinations Debug DLL with Debug App, and Release DLL with Release App.
0
 

Author Comment

by:dooley090698
Comment Utility
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....
0
 

Author Comment

by:dooley090698
Comment Utility
Oh and this is the debug version btw
0
 

Author Comment

by:dooley090698
Comment Utility
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!!  :)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now