PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Christian Weilguny on September 12, 2010, 09:40:32 PM

Title: Custom Control 3rd
Post by: Christian Weilguny on September 12, 2010, 09:40:32 PM
Hi,

now I have an absolute unexpected behavior with my custom controls.
When I drop one ore more of it in my exe-file, it works completely ok. Also when more then one of them on one form is.
If I drop it in a dll on a form and call the form from the exe, the controls are mostly invisible.
Evertime I call the form for the first time, only the last created custom control is visible.
If I close the form and open a second time, no custom control is visible.
But they must be created, because they will be addressed from code and there is no error.

What may this be?

Christian
Title: Re: Custom Control 3rd
Post by: Christian Weilguny on September 13, 2010, 04:11:21 PM
Hi,

in the meantime I've figured out, the built in custom controls like FireTextBox have the same behaviour.

Christian

Title: Re: Custom Control 3rd
Post by: Christian Weilguny on September 14, 2010, 10:03:13 AM
Hi,

now I found the reasen for this behaviour.

The "GetClassInfoEx"-function always return 0, regardless of which parameter for the modul is passed. I tried the 'Byval %NULL', then the resulted modul is the calling .exe. I tried to pass the name of the custom-control-dll and I tried the name of the dll where is the form located. Every time the "GetClassInfoEx" returns 0 - the class is not registerd.

So every time when the code tries to register the class the second time, the result is: Exit Function.

Christian
Title: Re: Custom Control 3rd
Post by: Paul Squires on September 14, 2010, 10:14:47 AM
Hi Christian,

Sorry that I haven't looked into this yet..... I won't be able to until tomorrow.

Title: Re: Custom Control 3rd
Post by: Christian Weilguny on September 14, 2010, 10:38:19 AM
no matter Paul,

I've found the solution by myself (brain-jogging :)

Fact is, the "GetClassInfoEx" expects not a module-handle, it expects the instance-handle.
Then it works fine in exe and in dll.

This is the right syntax:

If GetClassInfoEx(GetWindowLong(hWndFrm, %GWL_HINSTANCE), szClassName, wc)

Christian