Solved

CString exception error in a DLL

Posted on 2001-07-01
5
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Pacman earned 100 total points
ID: 6243883
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
ID: 6243898
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
ID: 6244904
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
ID: 6244906
Oh and this is the debug version btw
0
 

Author Comment

by:dooley090698
ID: 6245312
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.

751 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