Delphi 实现程序 动态 类名


本文整理自网络,侵删。

  1、首先将delphi中Controls单元提取
2、修改Controls单元中如下部分:
procedure TWinControl.CreateParams(var Params: TCreateParams);
begin
FillChar(Params, SizeOf(Params), 0);
with Params do
begin
    Caption := FText;
    Style := WS_CHILD or WS_CLIPSIBLINGS;
    AddBiDiModeExStyle(ExStyle);
    if csAcceptsControls in ControlStyle then
    begin
      Style := Style or WS_CLIPCHILDREN;
      ExStyle := ExStyle or WS_EX_CONTROLPARENT;
    end;
    if not (csDesigning in ComponentState) and not Enabled then
      Style := Style or WS_DISABLED;
    if FTabStop then Style := Style or WS_TABSTOP;
    X := FLeft;
    Y := FTop;
    Width := FWidth;
    Height := FHeight;
    if Parent <> nil then
      WndParent := Parent.GetHandle else
      WndParent := FParentWindow;
    WindowClass.style := CS_VREDRAW + CS_HREDRAW + CS_DBLCLKS;
    WindowClass.lpfnWndProc := @DefWindowProc;
    WindowClass.hCursor := LoadCursor(0, IDC_ARROW);
    WindowClass.hbrBackground := 0;
    WindowClass.hInstance := HInstance;
    //////////////////
   StrPCopy(WinClassName, IntToStr(GetTickCount));
    //StrPCopy(WinClassName, ClassName);

end;
end;

相关阅读 >>

Delphi与sqlite3数据库

Delphi快速地删除一个目录

Delphi 操作webbrowser 元素值

Delphi firemonkey的stylebook皮肤控件的使用

Delphi [函数] unicode 检查字符串是否含中文字

Delphi 系统服务状态获取管理员用户名

Delphi opendialog使用方法

Delphi 校验手机号及身份证号

Delphi 调用js脚本

Delphi如何在tmemo控件光标当前位置插入字符串

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...