Click here to Skip to main content
15,900,108 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Class Constructor Problem Pin
led mike7-Dec-07 8:28
led mike7-Dec-07 8:28 
GeneralRe: Class Constructor Problem Pin
cp98767-Dec-07 9:45
cp98767-Dec-07 9:45 
Generalkeyboard buffer Pin
RomTibi7-Dec-07 6:40
RomTibi7-Dec-07 6:40 
AnswerRe: keyboard buffer Pin
Nathan Holt at EMOM7-Dec-07 7:23
Nathan Holt at EMOM7-Dec-07 7:23 
GeneralRe: keyboard buffer Pin
RomTibi9-Dec-07 4:29
RomTibi9-Dec-07 4:29 
General(Dundas Grid related) Modal dialog called from an event in the grid is not modal at all. [modified](SOLVED) Pin
Maximilien7-Dec-07 5:45
Maximilien7-Dec-07 5:45 
GeneralRe: (Dundas Grid related) Modal dialog called from an event in the grid is not modal at all. Pin
James R. Twine7-Dec-07 6:14
James R. Twine7-Dec-07 6:14 
GeneralCObject (CView - CDoument) callbacks Pin
Tony Teveris7-Dec-07 4:48
Tony Teveris7-Dec-07 4:48 
callback (p1, p2, p3, ....)
{
CView *pView = (CView *)p1

pView->whatever() causes ASSERT as defined in wincore.cpp - void CWnd::AssertValid()
}

MainApp{

CDocument::OnCommand - selected some operation from menu

CView *pView = get active view
call DLL (pView, p2, p3, ...)
}

DLL {
put up dialog
move slider, now need to update pView in main app

callback(pView, p2, p3 ...)
}

No matter if I pass a ptr to CDocument or CView the callback will fail (ASSERT) someplace

If I pass in the HWND and in the callback use CWnd::FromHandle() and then call InvalidateRect() I can get thinks to redraw but I want to access items in the Doc or View.

The ASSERT code states

// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.

So does anyone have a way around this?

Thanks in advance

Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074

GeneralRe: CObject (CView - CDoument) callbacks Pin
led mike7-Dec-07 6:04
led mike7-Dec-07 6:04 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Mark Salsbery7-Dec-07 6:24
Mark Salsbery7-Dec-07 6:24 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Tony Teveris7-Dec-07 6:51
Tony Teveris7-Dec-07 6:51 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Mark Salsbery7-Dec-07 7:11
Mark Salsbery7-Dec-07 7:11 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Tony Teveris7-Dec-07 7:18
Tony Teveris7-Dec-07 7:18 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Mark Salsbery7-Dec-07 7:34
Mark Salsbery7-Dec-07 7:34 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Tony Teveris7-Dec-07 8:03
Tony Teveris7-Dec-07 8:03 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Mark Salsbery7-Dec-07 8:18
Mark Salsbery7-Dec-07 8:18 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Tony Teveris7-Dec-07 8:23
Tony Teveris7-Dec-07 8:23 
GeneralRe: CObject (CView - CDoument) callbacks Pin
Mark Salsbery7-Dec-07 8:29
Mark Salsbery7-Dec-07 8:29 
GeneralExecutable application Pin
llp00na7-Dec-07 4:28
llp00na7-Dec-07 4:28 
GeneralRe: Executable application Pin
led mike7-Dec-07 4:59
led mike7-Dec-07 4:59 
GeneralRe: Executable application Pin
llp00na7-Dec-07 5:09
llp00na7-Dec-07 5:09 
GeneralRe: Executable application Pin
led mike7-Dec-07 5:31
led mike7-Dec-07 5:31 
GeneralRe: Executable application Pin
Eytukan7-Dec-07 5:20
Eytukan7-Dec-07 5:20 
GeneralRe: Executable application Pin
llp00na7-Dec-07 5:28
llp00na7-Dec-07 5:28 
GeneralRe: Executable application Pin
Eytukan7-Dec-07 5:35
Eytukan7-Dec-07 5:35 

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.