[python-win32] win32ui and resources for dialogs

Michael Morisak mmorisak at risc.uni-linz.ac.at
Wed Jan 10 15:14:36 CET 2007


Mark Hammond schrieb:
>> i tried to add this to the source of python-win32
>> but i refuses to compile with some link issue
>>     
>
> What issue is that?  I'd like for pywin32 to build without too much effort -
> and at least fail gracefully when it doesn't.
>
> As Niki says, avoiding MFC is a good idea.  You should also find win32gui
> complete enough for most dialog work (and Roger has added yet more GDI
> functions to win32gui since the last release :)
>
> Mark
>
>   

Hi Mark

I made the following change:


-----------------------
// @pymethod |PyCDialog|CreateWindow|Create a modeless window for the 
dialog box.
static PyObject *ui_dialog_create_window( PyObject *self, PyObject *args )
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState()); 

    PyObject *obParent = NULL;
    CWnd *pParent = NULL;


    // @pyparm <o PyCWnd>|obParent|None|The parent window for the new window
    if (!PyArg_ParseTuple(args,"|O:CreateWindow", &obParent))
        return NULL;
.
.
.
.
----------------

after adding AFX_MANAGE_STATE(AfxGetStaticModuleState());
i get the following link-errors:

----
Linking...
mfcs71.lib(dllmodul.obj) : error LNK2005: _DllMain at 12 already defined in 
dllmain.obj
mfcs71.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined 
in dllmain.obj
mfcs71.lib(dllmodul.obj) : warning LNK4006: _DllMain at 12 already defined 
in dllmain.obj; second definition ignored
mfcs71.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already 
defined in dllmain.obj; second definition ignored
   Creating library .\Build/win32ui.lib and object .\Build/win32ui.exp
Build\win32ui.pyd : fatal error LNK1169: one or more multiply defined 
symbols found

Build log was saved at 
"file://c:\src\pywin\pywin32-210\pythonwin\Build\Temp\win32ui\Release\BuildLog.htm"
win32ui - 3 error(s), 2 warning(s)
-----

At least M$ says something like (wrong order of linking):
http://support.microsoft.com/?scid=kb%3Ben-us%3B148652&x=13&y=18

im already playing around with this linker issue for some hours but no 
solution yet.

Anyway I wonder why AFX_MANAGE_STATE(AfxGetStaticModuleState()); is not 
included
in win32ui  on every functioncall dealing with the mfc since it always 
could happen that somebody would like to
open a dlg as a COM-Component :)

further inf on AFX_MANAGE_STATE(AfxGetStaticModuleState())
can be found at:
http://support.microsoft.com/?scid=kb%3Ben-us%3B140850&x=11&y=9

thx for answering


Michael



-- 
Michael Morisak
RISC Software GmbH -- Johannes Kepler Universitaet Linz
IT-Center, Hauptstrasse 119                phone: ++43 7236 3343-251
4232 Hagenberg, Austria                    fax:   ++43 7236 3343-250






More information about the Python-win32 mailing list