Click here to Skip to main content
15,909,591 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalpath via property sheet Pin
john563214-Mar-08 2:46
john563214-Mar-08 2:46 
QuestionChrash at UpdateData(FALSE) Pin
merh14-Mar-08 2:45
merh14-Mar-08 2:45 
GeneralRe: Chrash at UpdateData(FALSE) Pin
Cedric Moonen14-Mar-08 3:03
Cedric Moonen14-Mar-08 3:03 
QuestionRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 3:14
merh14-Mar-08 3:14 
GeneralRe: Chrash at UpdateData(FALSE) Pin
jhwurmbach14-Mar-08 3:51
jhwurmbach14-Mar-08 3:51 
AnswerRe: Chrash at UpdateData(FALSE) Pin
bert_r14-Mar-08 3:20
bert_r14-Mar-08 3:20 
QuestionRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 4:15
merh14-Mar-08 4:15 
AnswerRe: Chrash at UpdateData(FALSE) Pin
bert_r14-Mar-08 4:54
bert_r14-Mar-08 4:54 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 5:03
merh14-Mar-08 5:03 
GeneralRe: Crash at UpdateData(FALSE) Pin
bert_r14-Mar-08 5:19
bert_r14-Mar-08 5:19 
GeneralRe: Crash at UpdateData(FALSE) Pin
merh14-Mar-08 5:40
merh14-Mar-08 5:40 
GeneralRe: Chrash at UpdateData(FALSE) Pin
David Crow14-Mar-08 5:41
David Crow14-Mar-08 5:41 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 5:51
merh14-Mar-08 5:51 
GeneralRe: Chrash at UpdateData(FALSE) Pin
merh14-Mar-08 6:15
merh14-Mar-08 6:15 
GeneralRe: Chrash at UpdateData(FALSE) Pin
David Crow14-Mar-08 6:16
David Crow14-Mar-08 6:16 
Questioncan anybody tell me how i can call a vb activex dll from c++ Pin
philiptabraham14-Mar-08 1:29
philiptabraham14-Mar-08 1:29 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
ritz123414-Mar-08 1:39
ritz123414-Mar-08 1:39 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
Nathan Holt at EMOM14-Mar-08 6:22
Nathan Holt at EMOM14-Mar-08 6:22 
AnswerRe: can anybody tell me how i can call a vb activex dll from c++ Pin
CPallini14-Mar-08 11:02
mveCPallini14-Mar-08 11:02 
QuestionProblem in using Fromhandle Function Pin
ashtwin14-Mar-08 0:44
ashtwin14-Mar-08 0:44 
AnswerRe: Problem in using Fromhandle Function [modified] Pin
Rajkumar R14-Mar-08 2:19
Rajkumar R14-Mar-08 2:19 
ashtwin wrote:
CDC *pDC = CDC::FromHandle(MyClasss::getMyHDC());


Are you storing the pDC beyond a function call, CDC::FromHandle returns a temporary CDC object if HDC is not already attached. CDC::DeleteTempMap will delete the temporary CDC objects in idle processing. so if you using the object beyond a function call and there by alowing the idle processing to delete the object, application can crash if you access the temp object.

CDC::FromHandle() is less error-prone in the sense you do not have to remember to "detach". but remember it is used only in immediate processing.

In your MyClass::MyFunction(), you are Detaching the CDC, so it is sure that FromHandle creates temp map object, and possibly you are storing beyond a function call.

I suggest you to Keep attached the Printer DC with a member variable CDC and use it everywhere or use attach detach you should match the two calls then, or use FromHandle but with in a function call.
If the frequency of the call is high reduce the number of attach - detach.

modified on Friday, March 14, 2008 8:50 AM

GeneralRe: Problem in using Fromhandle Function Pin
ashtwin16-Mar-08 19:47
ashtwin16-Mar-08 19:47 
GeneralRe: Problem in using Fromhandle Function Pin
Rajkumar R16-Mar-08 20:49
Rajkumar R16-Mar-08 20:49 
QuestionRe: Problem in using Fromhandle Function Pin
ashtwin16-Mar-08 21:03
ashtwin16-Mar-08 21:03 
GeneralRe: Problem in using Fromhandle Function Pin
Rajkumar R16-Mar-08 21:17
Rajkumar R16-Mar-08 21:17 

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.