How to disable vcl styles on external dll forms in delphi

百般思念 提交于 2019-12-11 07:16:47

问题


I have an issue in Delphi 10.1 Berlin using VCL Styles and an external DLL.

I'm using a Nitgen DLL to enroll fingerprints in my application. The process is handled by a COM object in NBSPCOM.dll.

When I call the method to enroll, the form from the DLL appears odd. It shows the Form background, images and controls are wrong, etc.

If I compile the application in XE8, the problem vanishes and all works fine.

I can't find the class of the DLL forms to try a VCL Styles hook.

Some screenshots of the form:

Original form

Wrong Form


回答1:


When you uses the VCL Styles the native winapi controls (Static, Button, RebarWindow32, ...) are styled using a WH_CBT Hook, My guess is which the dll is using a static or Button winapi control where the background of the image is drawn. To overcome this you can disable the styling of these controls using the Vcl.Themes.TStyleManager.SystemHooks property like so

TStyleManager.SystemHooks := [];


来源:https://stackoverflow.com/questions/42537615/how-to-disable-vcl-styles-on-external-dll-forms-in-delphi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!