Custom Control 3rd

Started by Christian Weilguny, September 12, 2010, 09:40:32 PM

Previous topic - Next topic

Christian Weilguny

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

Christian Weilguny

Hi,

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

Christian


Christian Weilguny

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

Paul Squires

Hi Christian,

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

Paul Squires
PlanetSquires Software

Christian Weilguny

#4
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