PythonWin and Dialogs in DLLs

phil at ricochet.net phil at ricochet.net
Tue Jan 18 03:57:30 EST 2000


On Mon, 17 Jan 2000 17:52:04 -0500, "Robert" <soundhack at hotmail.com>
wrote:

>Hi all,
>    After getting bored creating dialogs by making dialog templates
>programmatically,
>I would instead like to use VC++'s dialog editor to format the dialog.
>Looking at the dialog.Dialog class in PythonWin, apparently
>it accepts a DLL filename to get resource information.
>
>   My question is this: How can I make this DLL that contains
>only the dialog resource? Using the appwizards to make a DLL
>project, I either get a big DLL file (which works, but it has DLLMain() and
>run time libraries linked in that i dont really need) or an error linking,
>saying there is an unresolved external
>reference _DllMainCRTStartup. The ideal situation would be just
>to save the resource file and have pythonwin read that, but if i
>have to use DLLs, I would like to keep unnecessary runtime stuff out of it.

I believe you should be able to do the following:

1. Use the studio wiz to create a win32 dll.

2.  Add a file called say frog.c containing something like
#include <windows.h>
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID frog)
{
    return 1;
}
i think the DLL loader needs an entry point called DllMain and the
parameters will allow you to check for stuff, but i don't know why
that would be useful; anyway it doesn't cost much, and using a
resource DLL is a fairly standard thing.

3. Go to project settings/link/input and remove everything from the
object/library modules, you probably don't need any of them.

4. Go to build/set active configuration and select win32 release.
(This minimises your disk image and also improves memory footprint,
and there's nothing to debug).

5. build. This should result in about 30K or so of disk image (depends
on your cluster size or whatever it's called these days). If this is
too big then there are other things you can do, but...

6. Add the resource .rc. The DLL should grow roughly by the size of
your resources. I think that's it.

phil.

The world is divided into two sorts of people:
Those that believe the world is divided into
two sorts of people and those that don't.



More information about the Python-list mailing list