https://stackoverflow.com/questions/475 ... -exception
I'm using wxWidgets 3.0.3 and have set up the project using instructions (Visual studio 2017) provided here:
https://wiki.wxwidgets.org/Microsoft_Vi ... B%2B_Guide
I compiled the binaries myself using the same IDE and have not changed any of the settings.
I have following code:
(Note that I've ran a similar snippet in the same project while using wxFileDialog and it worked in both x64 and x86 configurations. So I must've set the library properly at least to some degree.)
Main.h
Code: Select all
#pragma once
#include <wx\wxwidgets.h>
class Main : public wxApp {
public:
virtual bool OnInit();
};
Code: Select all
#include "Main.h"
bool Main::OnInit() {
wxMessageDialog *test= new wxMessageDialog(nullptr, wxT("Test"));
test->ShowModal();
return true;
}
wxIMPLEMENT_APP(Main);
Code: Select all
int wxMessageDialog::ShowModal()
{
WX_HOOK_MODAL_DIALOG();
#ifdef wxHAS_MSW_TASKDIALOG
if ( HasNativeTaskDialog() )
{
TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc();
wxCHECK_MSG( taskDialogIndirect, wxID_CANCEL, wxS("no task dialog?") );
WinStruct<TASKDIALOGCONFIG> tdc;
wxMSWTaskDialogConfig wxTdc( *this );
wxTdc.MSWCommonTaskDialogInit( tdc );
int msAns;
--HERE->HRESULT hr = taskDialogIndirect( &tdc, &msAns, NULL, NULL );
if ( FAILED(hr) )
{
wxLogApiError( "TaskDialogIndirect", hr );
return wxID_CANCEL;
}
// In case only an "OK" button was specified we actually created a
// "Cancel" button (see comment in MSWCommonTaskDialogInit). This
// results in msAns being IDCANCEL while we want IDOK (just like
// how the native MessageBox function does with only an "OK" button).
if ( (msAns == IDCANCEL)
&& !(GetMessageDialogStyle() & (wxYES_NO|wxCANCEL)) )
{
msAns = IDOK;
}
return MSWTranslateReturnCode( msAns );
}
#endif // wxHAS_MSW_TASKDIALOG
return ShowMessageBox();
}
Does any of this make any sense?
Is it a bug within the library?
Did I set something wrong?
How do I make it work?