wxWidgets & BRICSCAD do not work together. wxDialog::ShowModal() or wxMessageBox() do crash of Bric
wxWidgets & BRICSCAD do not work together. wxDialog::ShowModal() or wxMessageBox() do crash of BricsCad.
"An unhandled exception at 0x0000000000000000 in bricscad.exe: 0xC0000005: Access violation while performing at 0x0000000000000000."
"An unhandled exception at 0x0000000000000000 in bricscad.exe: 0xC0000005: Access violation while performing at 0x0000000000000000."
0
Comments
-
Hi Oleg,
With some effort you can use WxWidgets from your code running in BricsCAD, but you have to compile and link against the same version and build settings of WxWidgets that is used by BricsCAD.
0 -
Hi.
How can I see version wxWidgets of BricsCad?
BricsCad = V 15.3.05 (x64) 390620 -
Hi Oleg,
With some effort you can use WxWidgets from your code running in BricsCAD, but you have to compile and link against the same version and build settings of WxWidgets that is used by BricsCAD.
Thanks for your help.0 -
Hi Oleg,
With some effort you can use WxWidgets from your code running in BricsCAD, but you have to compile and link against the same version and build settings of WxWidgets that is used by BricsCAD.
I installed wxWidges Previous Stable Release: 2.8.12.
When in BRX call
HWND hWnd = acedGetAcadFrame()->m_hWnd;
wxWindow * win = new wxWindow();
win->SetHWND((WXHWND)hWnd);
wxMessageBox( wxT("Quit program?"), wxT("Confirm"), wxYES_NO | wxCANCEL, win);
BricsCad crash.0 -
Also, I think BricsCad use 3.0.2 version of wxWidgets. Because sample in BRXSDK compiled with only version 3.0.2. With previous version of wxwidgets can not compile.0
-
Yes, we use a v3 version, indeed ... likely v 3.02 ...
there is a WXWIDGETS macro (#define ...) which instructs WX build to *not* include a CWinApp instance, as it is usually done for regular DLLs;
instead, that extra CWinApp instance must be suppressed by that macro (similar to an extension DLL) - it is likely that extra CWinApp which causes
the crash ...0 -
Yes, we use a v3 version, indeed ... likely v 3.02 ...
there is a WXWIDGETS macro (#define ...) which instructs WX build to *not* include a CWinApp instance, as it is usually done for regular DLLs;
instead, that extra CWinApp instance must be suppressed by that macro (similar to an extension DLL) - it is likely that extra CWinApp which causes
the crash ...
Can you tell me what macro? I can not find similar macro in Documentation of wxwidgets.
CWinApp not mentioned in documentation of wxwidgets.0 -
Yes, we use a v3 version, indeed ... likely v 3.02 ...
there is a WXWIDGETS macro (#define ...) which instructs WX build to *not* include a CWinApp instance, as it is usually done for regular DLLs;
instead, that extra CWinApp instance must be suppressed by that macro (similar to an extension DLL) - it is likely that extra CWinApp which causes
the crash ...
I use sample with wxWidgets from BRXSDK.
I compiled WX with keys BUILD=release UNICODE=1 SHARED=1 TARGET_CPU=X64.
In file StdAfx.h there are strings
/*
MFC includes
OPTIONAL: remove these lines if your application does not use MFC
*/
#include
#include
#include
If comment its then BRX do not compiled. Because some function BRXSDK use MFC functions.
Example
//CWnd *pWnd = AcUiMainWindow();
//HWND hWnd = pWnd->GetSafeHwnd();
HWND hWnd = acedGetAcadFrame()->m_hWnd;
and other...
When BRX call
wxMessageBox( wxT("Quit program?"), wxT("Confirm"), wxYES_NO | wxCANCEL, win)
bricscad crash.
When BRX call
wxWindow* mainWindow = wxTheApp->GetTopWindow();
bricscad crash.
Is there manual or description step-by-step how to use wxWidgets with BricsCad?
Help me please. My head does not understand what i can do yet.0 -
Dear Oleg,
first of all, no need to disable MFC linkage ... to prevent BRX compiler errors.
The crash is very likely caised by instantiated CWinApp from WX modules - I will keep you updated about that *magic* WX preprocessor symbol, to disable CWinApp instance ....
then, such simple WX message boxes should work.
more to come & many greetings !0 -
Dear Oleg,
you will need to use
IMPLEMENT_APP_NO_MAIN
as
wxIMPLEMENT_APP_NO_MAIN(MyApp);
or better
IMPLEMENT_APP_NO_MAIN(MyApp);
to exclude WX's message loop / CWinApp instance ... as Balint Pete told us, you are already informed, and the crashes are gone ...
many greetings !0 -
Dear Oleg,
you will need to use
IMPLEMENT_APP_NO_MAIN
as
wxIMPLEMENT_APP_NO_MAIN(MyApp);
or better
IMPLEMENT_APP_NO_MAIN(MyApp);
to exclude WX's message loop / CWinApp instance ... as Balint Pete told us, you are already informed, and the crashes are gone ...
many greetings !
Thank you for help ))))0 -
having widgets fun here too https://www.theswamp.org/index.php?topic=50881.0 :)0
-
having widgets fun here too https://www.theswamp.org/index.php?topic=50881.0 :)
Thank you.
It is good info0 -
Hi Daniel.
It works ok.
But it does not work if i try put wxWindow to palette.
When i click on button, that puted on wxWindow, i get exaption
---------------------------
wxWidgets Debug Alert
---------------------------
..\..\src\msw\button.cpp(272): assert "tlw" failed in GetTLWParentIfNotBeingDeleted(): logic error in GetTLWParentIfNotBeingDeleted()
Call stack:
[00] wxButton::MSWWindowProc d:\wxwidgets_3.0.2\src\msw\button.cpp:431
[01] wxWndProc d:\wxwidgets_3.0.2\src\msw\window.cpp:2716
[02] DispatchMessageW
[03] GetSysColorBrush
[04] GetSysColorBrush
[05] KiUserCallbackDispatcher
[06] SetFocus
[07] ImageList_SetOverlayImage
[08] ImageList_SetOverlayImage
[09] DispatchMessageW
[10] CallWindowProcW
[11] wxWindow::MSWDefWindowProc d:\wxwidgets_3.0.2\src\msw\window.cpp:2271
[12] wxWindow::MSWWindowProc d:\wxwidgets_3.0.2\src\msw\window.cpp:3651
[13] wxWndProc d:\wxwidgets_3.0.2\src\msw\window.cpp:2716
[14] DispatchMessageW
[15] NotifyWinEvent
[16] CharLowerW
[17] 000000005C2FA9E0
[18] 000000005C22BCCA
[19] 000000005C2DFCFE
[20] 000000005C2C51F7
Do you want to stop the program?
You can also choose [Cancel] to suppress further warnings.0
This discussion has been closed.