Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!rutgers!pyrnj!mirror!bobg From: bobg@mirror.UUCP (Bob Goodearl) Newsgroups: comp.windows.ms Subject: Re: RegisterClass in DLL Message-ID: <34458@mirror.UUCP> Date: 29 Dec 89 16:52:57 GMT References: <6970014@hpmcaa.mcm.hp.com> Reply-To: bobg@mirror.TMC.COM (Bob Goodearl) Organization: Mirror Systems, Cambridge Mass. Lines: 22 In article <6970014@hpmcaa.mcm.hp.com> marco@hpmcaa.mcm.hp.com (Marco Dalla-Gasperina) writes: =>I'm having a problem registering a window class inside a DLL... It seems =>to work for a "few" times (usually 3) but then it fails? => When writing DLL code, I found that a window class registered using the DLL instance handle caused problems. If the application calling the DLL was closed and then started a second time without exiting windows first, the call to RegisterClass in the DLL would fail the second time. The solution I found was to use the parent application's instance handle when calling RegisterClass in the DLL. This works for the code I'm writing because only 1 application can use the DLL and only 1 instance of the application can exist at any one time. Along the way, I tried bypassing RegisterClass if the DLL had been initialized previously, but then the call to CreateWindow failed when using that class. Hope this is of some use to you. === Bob