Problem Embedding PythonWin in VC++ 6
Miles Rizzo
milesrizzo at hotmail.com
Thu Mar 23 16:10:30 EST 2000
Ok, I'm really new to Python (thought it was just a big snake until this
week). I've gone throught the tuturial and now I'm trying to embed a Python
script in an MFC app using VC 6.0. I followed
the instructions in "Using Pythonwin in an external project"
(http://www.python.org/windows/pythonwin/EmbeddingWin32ui.html) but my
application crashes. The DLL loads and the address of the function is found
but calling the Win32uiApplicationInit function causes a crash.
I'd appreciate any suggestions. Thanks.
milesrizzo at hotmail.com
--------------------------------------------------
CTESTApp theApp;
class MyGlueClass : public Win32uiHostGlue
// I don't have any methods yet.
};
MyGlueClass glue;
BOOL CTESTApp::InitInstance() {
Win32uiHostGlue glue;
.
glue.DynamicApplicationInit("import pytest",
"c:\\winnt\\profiles\\mgr\\desktop");
.
}
inline BOOL Win32uiHostGlue::RegisterModule(const char *fname, const char
*moduleName) {
.
BOOL (__cdecl *pfnInit)(Win32uiHostGlue *, char *, const char *)=NULL;
pfnInit = (BOOL (__cdecl *)(Win32uiHostGlue *, char *, const char
*))GetProcAddress(hMod, "Win32uiApplicationInit");
BOOL rc;
if (pfnInit)
rc = (*pfnInit)(this, (char *)cmd, additionalPaths); // <<<----- The
app crashes on this call
.
}
More information about the Python-list
mailing list