Click here to Skip to main content
15,888,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC Application Scroll bar issue on PDF Viewer Pin
kasi146-Nov-09 11:31
kasi146-Nov-09 11:31 
AnswerRe: MFC Application Scroll bar issue on PDF Viewer Pin
Garth J Lancaster6-Nov-09 13:57
professionalGarth J Lancaster6-Nov-09 13:57 
GeneralRe: MFC Application Scroll bar issue on PDF Viewer Pin
kasi149-Nov-09 6:08
kasi149-Nov-09 6:08 
QuestionBreakpoints in Wincore.cpp Pin
Member 36807856-Nov-09 5:50
Member 36807856-Nov-09 5:50 
AnswerRe: Breakpoints in Wincore.cpp Pin
Rajesh R Subramanian6-Nov-09 6:26
professionalRajesh R Subramanian6-Nov-09 6:26 
AnswerRe: Breakpoints in Wincore.cpp Pin
sashoalm6-Nov-09 6:32
sashoalm6-Nov-09 6:32 
AnswerRe: Breakpoints in Wincore.cpp Pin
Randor 6-Nov-09 7:15
professional Randor 6-Nov-09 7:15 
QuestionCDatabase::OpenEx failure kills UI thread Pin
Gary Wheeler6-Nov-09 5:13
Gary Wheeler6-Nov-09 5:13 
I've recently moved my data base code into a worker thread, which works just fine unless the data base open fails. I currently have the thread wait 15 seconds, and then try the open again. This process repeats until the data base opens successfully or the application exits. The problem I'm having is that, when this logic is occurring, my UI thread will fail with an access violation some time later. It appears that having the CDatabase::OpenEx() call fail causes some sort of corruption to either the UI thread's MFC state or its stack, which is then exposed as the UI is navigated.

I'm using SQL Server 2005 Express, Service Pack 2.

I've tried the following to resolve this:

1. If I comment out the data base operations (OpenEx() ... Close()), the UI does not crash.

2. If I comment out the data base operations like in #1, and replace them with a AfxThrowDBException(...), the UI does not crash.

3. One suspect was the CDatabase::OpenEx() implementation, which does some hinky looking things trying to find a window handle. I overrode it and passed a NULL window handle to the ::SQLDriverConnect() call that does the real work of connecting to the data base. The UI still crashes.

From these results I can only conclude that there is some kind of problem here using CDatabase/CRecordset in a worker thread that isn't documented. I've searched on MSDN and Google'd several times, and only found claims of issues with specific ODBC drivers.

Anyone have any suggestions, or ideas that I've missed?

Software Zen: delete this;

QuestionRe: CDatabase::OpenEx failure kills UI thread Pin
Randor 6-Nov-09 6:25
professional Randor 6-Nov-09 6:25 
AnswerRe: CDatabase::OpenEx failure kills UI thread Pin
Gary Wheeler6-Nov-09 8:35
Gary Wheeler6-Nov-09 8:35 
QuestionRunning task on shutdown Pin
__DanC__6-Nov-09 2:29
__DanC__6-Nov-09 2:29 
AnswerRe: Running task on shutdown Pin
Randor 6-Nov-09 6:08
professional Randor 6-Nov-09 6:08 
GeneralRe: Running task on shutdown Pin
Rajesh R Subramanian6-Nov-09 6:09
professionalRajesh R Subramanian6-Nov-09 6:09 
GeneralRe: Running task on shutdown Pin
__DanC__6-Nov-09 6:18
__DanC__6-Nov-09 6:18 
GeneralRe: Running task on shutdown Pin
Randor 6-Nov-09 6:51
professional Randor 6-Nov-09 6:51 
GeneralRe: Running task on shutdown Pin
__DanC__6-Nov-09 6:53
__DanC__6-Nov-09 6:53 
GeneralRe: Running task on shutdown Pin
Randor 6-Nov-09 7:07
professional Randor 6-Nov-09 7:07 
QuestionCreate Split Window in RightView of SDI Pin
Abinash Mohanty5-Nov-09 23:16
Abinash Mohanty5-Nov-09 23:16 
AnswerRe: Create Split Window in RightView of SDI Pin
Adam Roderick J5-Nov-09 23:22
Adam Roderick J5-Nov-09 23:22 
AnswerRe: Create Split Window in RightView of SDI Pin
jinlsg8-Nov-09 14:15
jinlsg8-Nov-09 14:15 
Questionwhere is my fault? Pin
goutom roy5-Nov-09 23:10
goutom roy5-Nov-09 23:10 
AnswerRe: where is my fault? Pin
Richard MacCutchan6-Nov-09 0:03
mveRichard MacCutchan6-Nov-09 0:03 
AnswerRe: where is my fault? Pin
Michael Schubert6-Nov-09 0:22
Michael Schubert6-Nov-09 0:22 
GeneralRe: where is my fault? PinPopular
David Crow6-Nov-09 3:27
David Crow6-Nov-09 3:27 
Questionhow to place CFromview on CDialog? [modified] Pin
jinlsg5-Nov-09 22:22
jinlsg5-Nov-09 22:22 

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.