I expect that most of what you see in wxPython/samples/embedding would still apply, but you'll need to figure out where/how to run the main event loop.
I don't want to run wxPython's main event loop, since it blocks the application which loads my DLL.
Using wxWindows I managed to do what I want by calling wxEntry() with the last parameter 'enterLoop' set to zero, like this:
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
wxEntry((WXHINSTANCE)hInstance, 0, "", SW_SHOWNA, 0);
else if (dwReason == DLL_PROCESS_DETACH)
{
if (wxTheApp != 0)
{ // OnExit isn't called by CleanUp so must be called explicitly.
wxTheApp->OnExit();
wxApp::CleanUp();
}
}
return 1; // ok
}
After calling wxEntry(), wxTheApp was constructed and I could display my test frame. Is there something similar to wxEntry() within wxPython?
I expect that most of what you see in wxPython/samples/embedding would still apply, but you'll need to figure out where/how to run the main event loop.
I don't want to run wxPython's main event loop, since it blocks the application which loads my DLL.
Using wxWindows I managed to do what I want by calling wxEntry() with the last parameter 'enterLoop' set to zero, like this:
[...]
After calling wxEntry(), wxTheApp was constructed and I could display my test frame.
But could you interact with it? Without an event loop of some sort then events will not be delivered to the windows.
Is there something similar to wxEntry() within wxPython?
wxPython already breaks up the wxEntry functionality, and lets you control when the main loop is started since you have to call app.MainLoop() yourself. The first part of wxEntry is currently called when the wxc core extension module is loaded. The second part is called after the wxApp object is constructed but before your OnInit is called. Then you call MainLoop, and finally the last part of wxEntry is called when the module is unloaded by Python. (This will be changing slightly in 2.5...)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!