Click here to Skip to main content
16,005,038 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDeclarations help Pin
fynox19-Oct-03 17:41
fynox19-Oct-03 17:41 
GeneralRe: Declarations help Pin
Joe Woodbury19-Oct-03 18:27
professionalJoe Woodbury19-Oct-03 18:27 
QuestionHELP PLEASE!!! CRAZY COMPILERS????? Pin
tguzella19-Oct-03 12:44
tguzella19-Oct-03 12:44 
AnswerRe: HELP PLEASE!!! CRAZY COMPILERS????? Pin
tguzella19-Oct-03 12:45
tguzella19-Oct-03 12:45 
AnswerRe: HELP PLEASE!!! CRAZY COMPILERS????? Pin
markkuk19-Oct-03 22:48
markkuk19-Oct-03 22:48 
AnswerRe: HELP PLEASE!!! CRAZY COMPILERS????? Pin
jhwurmbach19-Oct-03 22:56
jhwurmbach19-Oct-03 22:56 
GeneralMacro accessing a function from another macro file Pin
Jeff Miles19-Oct-03 12:35
Jeff Miles19-Oct-03 12:35 
GeneralDatabase connection through MFC help Pin
Mike Danberg19-Oct-03 12:33
Mike Danberg19-Oct-03 12:33 
Hi,

I posted about this a few days ago, but didn't get anywhere with it. I have a MFC DLL that I wrote to access a database that I'm using with my program (also MFC).

What I've been doing is in each function I have in the dll, I connect to the database, perform the operation I want and then disconnect. This worked perfectly fine. However, I decided it was a waste of processing time to connect and disconnect each time I accessed the database, so I wrote two functions called connect and disconnect in order to be able to hold onto the database connection for the life of the program.

This is how I did it.

CDatabase database;

__declspec(dllexport) void Connect()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

database.Open( "EmployeeManager" );
}

__declspec(dllexport) void Disconnect()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

database.Close();
}


This seems to me that it would work without problems. However, when I try to close the program it causes an error that says "A Breakpoint has been reached" and it crashes.

All I did was override OnClose and call disconnect before I close. I stepped through the debugger and it doesn't crash on disconnect, but right after the close is executed. There are no breakpoints anywhere in the program so I have no idea what's going on here. Can anyone help me out?

Thanks,
Mike
GeneralRe: Database connection through MFC help Pin
Michael P Butler19-Oct-03 23:35
Michael P Butler19-Oct-03 23:35 
GeneralRe: Database connection through MFC help Pin
Mike Danberg20-Oct-03 6:16
Mike Danberg20-Oct-03 6:16 
GeneralHelp with some C Pin
Sirrius19-Oct-03 11:05
Sirrius19-Oct-03 11:05 
GeneralRe: Help with some C Pin
markkuk19-Oct-03 11:45
markkuk19-Oct-03 11:45 
GeneralRe: Convert int to hexa Pin
Alexander M.,19-Oct-03 10:26
Alexander M.,19-Oct-03 10:26 
GeneralRe: MRU problem Pin
Neville Franks19-Oct-03 9:45
Neville Franks19-Oct-03 9:45 
GeneralRe: MRU problem Pin
YaronNir19-Oct-03 22:47
YaronNir19-Oct-03 22:47 
GeneralRe: MRU problem Pin
Neville Franks19-Oct-03 23:13
Neville Franks19-Oct-03 23:13 
GeneralRe: MRU problem Pin
YaronNir19-Oct-03 23:25
YaronNir19-Oct-03 23:25 
GeneralRe: MRU problem Pin
Neville Franks20-Oct-03 0:02
Neville Franks20-Oct-03 0:02 
GeneralRe: MRU problem Pin
YaronNir20-Oct-03 0:14
YaronNir20-Oct-03 0:14 
GeneralRe: MRU problem Pin
Neville Franks20-Oct-03 2:16
Neville Franks20-Oct-03 2:16 
GeneralRe: MRU problem Pin
YaronNir20-Oct-03 2:41
YaronNir20-Oct-03 2:41 
GeneralRe: MRU problem Pin
Neville Franks20-Oct-03 21:16
Neville Franks20-Oct-03 21:16 
GeneralApplication does not terminating Pin
csperber19-Oct-03 7:42
csperber19-Oct-03 7:42 
GeneralRe: Application does not terminating Pin
Neville Franks19-Oct-03 9:47
Neville Franks19-Oct-03 9:47 
GeneralRe: Application does not terminating Pin
csperber20-Oct-03 8:30
csperber20-Oct-03 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.