Most TWinControl descendant in Delphi has an override method CreateParams to define it’s subclass such as: ‘EDIT’, ‘COMBOBOX’, ‘BUTTON’, ‘RICHEDIT’ and etc.
CreateSubClass(Params, 'EDIT');
CreateSubClass(Params, 'COMBOBOX');
CreateSubClass(Params, 'BUTTON');
There are quite a number of rich edit control for Delphi including controls from third party vendors. All those controls are sub class of RichEdit.
I am wondering if there is a way to test a control is RichEdit regardless of it’s original vendor by testing the SubClass defined in CreateParams?
Thanks for all the feedback. I think there is no way to get the windows class name for the TWinControl.
Here is another version of IsRichEdit modified from JamesB’s version:
We may modify array A if there is newer version of RichEdit class from Windows.
Another possible but risky solution is I just check if the control’s VCL class name contain ‘RichEdit’ string as almost rich edit VCL class from Delphi or 3rd party vendors name the controls that way.