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

C / C++ / MFC

 
QuestionRe: Unmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE Pin
David Crow15-Jul-16 5:59
David Crow15-Jul-16 5:59 
AnswerRe: Unmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE Pin
Leif Simon Goodwin17-Jul-16 3:11
Leif Simon Goodwin17-Jul-16 3:11 
AnswerSolved Pin
Leif Simon Goodwin17-Jul-16 20:42
Leif Simon Goodwin17-Jul-16 20:42 
QuestionDirectX 9 in code:blocks fails on initD3D Pin
Korowai14-Jul-16 9:10
Korowai14-Jul-16 9:10 
AnswerRe: DirectX 9 in code:blocks fails on initD3D Pin
leon de boer14-Jul-16 18:13
leon de boer14-Jul-16 18:13 
GeneralRe: DirectX 9 in code:blocks fails on initD3D Pin
Korowai15-Jul-16 6:04
Korowai15-Jul-16 6:04 
GeneralRe: DirectX 9 in code:blocks fails on initD3D Pin
Korowai1-Aug-16 16:19
Korowai1-Aug-16 16:19 
Questionbehaviour when adding custom buttons to CMFCToolBar with CMFCToolBar::ReplaceButton? Pin
Maximilien13-Jul-16 10:27
Maximilien13-Jul-16 10:27 
I have a CMFCToolbar that contains a CMFCToolBarMenuButton (which will display a drop down menu).

I add my custom button like this (not production code)
C++
LRESULT CMainFrame::OnToolbarReset(WPARAM wp, LPARAM)
{
    UINT uiToolBarId = (UINT) wp;

    if (uiToolBarId == IDR_TOOLBAR1 )
    {
        CMenu m_Menu;
        m_Menu.LoadMenu(IDR_OUTPUT_POPUP);
        MyToolbarMenuButton menuButton(ID_BUTTON32771, m_Menu.GetSubMenu(0)->GetSafeHmenu(), GetCmdMgr()->GetCmdImage(ID_BUTTON32771, FALSE), NULL, FALSE);
        m_MaxToolbar.ReplaceButton(ID_BUTTON32771, menuButton);
    }

    return 0;
}

Eventually, in the framework, I get to this function :
int CMFCToolBar::InsertButton(const CMFCToolBarButton& button, INT_PTR iInsertAt)
{
/1/   CRuntimeClass* pClass = button.GetRuntimeClass();
    ENSURE(pClass != NULL);

/2/   CMFCToolBarButton* pButton = (CMFCToolBarButton*) pClass->CreateObject();
    ENSURE(pButton != NULL);

    ASSERT_VALID(pButton);

    pButton->CopyFrom(button);

    INT_PTR iIndex = InsertButton(pButton, (int) iInsertAt);
    if (iIndex < 0)
    {
        delete pButton;
    }

    return(int) iIndex;
}

Question:
If I understand correctly the code at line 1 and 2 in CMFCToolBar::InsertButton, it will loose all information about my own derived class MyToolbarMenuButton by getting the Runtime class and casting that to the base class ?

The issue is that I want to override some virtual method in CMFCToolBarButton but when I add my own class, it is not actually "instantiated".

Thanks.
I'd rather be phishing!

QuestionCalling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 4:52
Django_Untaken12-Jul-16 4:52 
SuggestionRe: Calling C Function in Dll Causing Problem Pin
Richard MacCutchan12-Jul-16 5:19
mveRichard MacCutchan12-Jul-16 5:19 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 5:27
Django_Untaken12-Jul-16 5:27 
AnswerRe: Calling C Function in Dll Causing Problem Pin
Albert Holguin12-Jul-16 5:59
professionalAlbert Holguin12-Jul-16 5:59 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 7:18
Django_Untaken12-Jul-16 7:18 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Albert Holguin13-Jul-16 6:36
professionalAlbert Holguin13-Jul-16 6:36 
GeneralRe: Calling C Function in Dll Causing Problem Pin
mariakatosvich13-Aug-16 2:28
mariakatosvich13-Aug-16 2:28 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Richard MacCutchan12-Jul-16 6:08
mveRichard MacCutchan12-Jul-16 6:08 
QuestionNcPaint and Invalid rect/region Pin
Сергей Шевченко12-Jul-16 2:00
Сергей Шевченко12-Jul-16 2:00 
AnswerRe: NcPaint and Invalid rect/region Pin
leon de boer12-Jul-16 2:33
leon de boer12-Jul-16 2:33 
GeneralRe: NcPaint and Invalid rect/region Pin
Сергей Шевченко12-Jul-16 4:15
Сергей Шевченко12-Jul-16 4:15 
QuestionCalling a method with the pointer to a base class Pin
FriendOfAsherah10-Jul-16 21:11
FriendOfAsherah10-Jul-16 21:11 
AnswerRe: Calling a method with the pointer to a base class Pin
Jochen Arndt10-Jul-16 21:47
professionalJochen Arndt10-Jul-16 21:47 
GeneralRe: Calling a method with the pointer to a base class Pin
FriendOfAsherah10-Jul-16 22:33
FriendOfAsherah10-Jul-16 22:33 
GeneralRe: Calling a method with the pointer to a base class Pin
Jochen Arndt10-Jul-16 22:52
professionalJochen Arndt10-Jul-16 22:52 
GeneralRe: Calling a method with the pointer to a base class Pin
_Flaviu11-Jul-16 1:59
_Flaviu11-Jul-16 1:59 
GeneralRe: Calling a method with the pointer to a base class Pin
leon de boer11-Jul-16 7:16
leon de boer11-Jul-16 7:16 

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.