If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Ok, i'm new to windows programming but am pretty competant and so I decided the next thing to learn is how to create and use DLLs. So i decided to take an existing app and move my logging class to a DLL. The DLL itself works and I can load it up in my app fine, but when I run a function inside the DLL that creates a wxFrame my app crashes in flames.
FrmLog = new wxDialog(&win, wxID_ANY, "Log Window", wxPoint(0,0), wxSize(800,400));
If i comment it out, everything works fine but I can't see what's being logged.
I'm asuming it doesn't like the fact that I'm trying to create a window without an application? maybe? Anyone that can point me in the right direction? I'm kinda unsure where to start looking to solve this one.
But as you can see, you are using the wxDialog (wxWindow) correctly.
But I digress.
I thought it was something like that too. The original version used wxFrame (before it was in the DLL) but after reading some examples i got the impression i was suppose to use wxDialog. But, regardless, neither way works and whenever it get's to execute a line that creates a window, it crashes.
Of course. My logger class actually inherits wxApp.
Solved tho. It was sort of to do with how i was loading the DLL. I was linking the library instead of calling LoadLibary(), so dllmain was not was not being called. Which meant this part:
wxSetInstance((HINSTANCE)hInst);
int argc = 0;
char **argv = NULL;
wxEntryStart(argc, argv);
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
was not executing either. So i put that at the top of my logger::Initialise member function and threw in a HINSTANCE argument. To initialise it from my app now all i have to change is one line to:
Hi:)
Was this dll written with wxWidgets only and no MS code ? If so, can you post it for a tutorial for others ? Also, the compile and link commands ( on linux if possible )
Thanks in advance