Delphi

Does Delphi offer an event handler for form creation notifications?

China☆狼群 提交于 2020-03-19 04:46:37
问题 Does Delphi provide some kind of event or hook for form creation (or more generally, form lifecycle events)? So that if somewhere in the code a form is created and shown (modal or non-modal, dynamically or in the usual app starup stage), Delphi calls an event handler which allows to log / analyse / modify the form before it is shown? I know there are options which involve introducing a base form class or a custom form creation procedure, but for existing applications which already have many

Does Delphi offer an event handler for form creation notifications?

孤街醉人 提交于 2020-03-19 04:45:32
问题 Does Delphi provide some kind of event or hook for form creation (or more generally, form lifecycle events)? So that if somewhere in the code a form is created and shown (modal or non-modal, dynamically or in the usual app starup stage), Delphi calls an event handler which allows to log / analyse / modify the form before it is shown? I know there are options which involve introducing a base form class or a custom form creation procedure, but for existing applications which already have many

Is it possible to use Microsoft Edge (Chromium engine) in Delphi like TWebBrowser?

江枫思渺然 提交于 2020-03-19 03:47:07
问题 Microsoft announce new browser Edge browser based on chromium engine. Just wondering if it is possible embed the browser like TWebBrowser into a VCL application? 回答1: At present, Microsoft developer is developing a Microsoft Edge WebView2 control, it enables you to host web content in your application using Microsoft Edge (Chromium) as the rendering engine. More detail information, see this article. You could feedback your request at the bottom of this link. 来源: https://stackoverflow.com

使用Delphi快速开发ActiveX控件

寵の児 提交于 2020-03-18 15:37:27
ActiveX控件也就是一般所说的OCX控件,它是ActiveX技术的一部分。ActiveX是微软公司推出的基于组件对象模型COM的技术,包括对Windows 32位应用编程接口(Win32 API)和组件对象模型的一系列扩充和增强,目标是把计算机桌面环境与因特网环境集成起来,同时保护在Windows技术中现有的开发投资。微软的ActiveX技术根本上就是修改过的OCX技术,使它能够跨越Internet,主要是使用WWW来传递控件。 ActiveX控件可以被集成到很多支持ActiveX的应用当中去,或者直接用来扩展应用的功能,这些支持ActiveX的应用包括C++ Builder、Delphi、Visual dBASE、 Visual Basic、Visual C++、Internet Explorer、Netscape Navigator等。ActiveX控件还可以使用在因特网上,在网页上使用它来发布信息、处理与用户的交互,但是需要使用支持ActiveX的浏览器才能阅读这些网页。目前已经开发出来的ActiveX控件越来越多,由于ActiveX控件具有很好的特性,我们可以在编程的时候选择使用合适的控件来加快自己的应用开发。可以不夸张地说,ActiveX控件是Windows平台编程必不可少的法宝。 使用ActiveX控件是相对比较简单的。但是

基于Delphi的融合DLL中的窗口

和自甴很熟 提交于 2020-03-18 04:36:15
        摘要:提出了一种简单的方法将DLL中的窗口融合(嵌入)到其他应用程序或DLL的窗口中,使用本方法可以简便地实现具有强扩展性和升级能力的软件系统。      1、引言   在开发一个大型通用控制系统时曾遇到这么一个问题:该系统软件包由若干个可执行文件和动态链接库组成,因为扩展性和兼容性的要求,需要将系统划分为若干个可执行文件和动态链接库,并且在大部分DLL中封装各自的操作界面,在调用DLL时将其中包含的部分界面嵌入地显示在主界面的某个区域或某个窗口内,与主界面的其他部分浑然一体。这样主程序与DLL在功能操作上各司其职,在外部界面上又彼此交融,使用户可以通过增加和修改DLL来实现对系统内部、外部的扩展和升级;同时因为DLL的跨语言特性,内部包含操作界面的DLL可以更为方便地在以后的不同工作、不同语言环境中更好地重复使用。   这一问题的应用较为广泛,但没有充分的资料来帮助解决,经过不断的试验,笔者将初步体会总结出来,用以抛砖引玉。本文中涉及的主程序和DLL都是在Delphi5.0下实现的,但因为其中所依赖的基础还是Windows本身的窗口机制,所以对于其他的语言平台也有实际意义。   在Delphi中如何创建DLL及输出DLL中的函数有较多资料进行过介绍,在本文中不再赘述,本文只针对DLL中的窗口部分做重点介绍。   2、DLL中自带窗口的创建和显示  

Delphi操作XML文件(1)

泄露秘密 提交于 2020-03-18 02:09:19
拜读了万一老师的博客之Delphi中的XMLDocument类详解,受益颇深,但可能有些初学者读后不易理解(例如本人),特记录如下。 XML基本语法 看一个简单的XML文档: <?xml version="1.0" encoding="ISO-8859-1"?> <people> <name>yufuzi</name> <sex>man</sex> <age>27</age> <description>I am a good man! </description> </people> XML 文档由一个 XML 声明和包含一些嵌套元素的一个根元素或标签构成。   1.声明语句<?xml ... ?>的作用是告诉浏览器或其它处理程序这个文档是XML文档。在每个 XML 文档的开始处必须包含声明.声明语句中的version表示文档遵守的XML规范的版本。encoding表示文档所用的语言编码,这个例子用的是"ISO-8859-1"西欧字符集。 2.XML元素指的是从该元素的开始标签到结束标签之间的这部分内容,如:<name>yufuzi</name>就称为一个元素,XML元素命名必须遵守下面的规则: 元素的名字可以包含子母,数字和其他字符。 元素的名字不能以数字或者标点符号开头。 元素的名字不能以XML(或者xml,Xml,xMl...)开头。 元素的名字不能包含空格。

DELPHI中BUG修改备忘

纵然是瞬间 提交于 2020-03-17 19:47:38
1. 关于sizeof 同样的代码 var LWindCode : array [0..15] of char; begin showmessage(inttostr( sizeof(LWindCode))); end; 在Delphi7和Delphi2009下结果分别是16/32,为什么? 这是因为widechar和AnsiChar的问题,2009默认的是WideChar了,而Delphi7是AnsiChar,导致String的长度也发生了变化!以后要注意了! 2. 关于Assigned Assigned只是判断当前值是否为空,而不判断当前指着的内存是不是被释放,因此释放的时候要这样写: if assigned(frm) then begin frm.close; frm:=nil; end; 或者 if assigned(frm) then begin frm.close; freeandnil(frm); end; 3. 关于assert(断言) 用法: Assert(表达式); 如果为假, assert会产生一个EAssertionFailed异常,显示信息为: Assertion Failed (C:\src\unit1.pas, [size=+0]line 34) 当你不想再使用这些检查时,可以使用 {$ASSERTIONS OFF} 或 {$C-} 编译指令.

delphi轻松实现输入法编程

我是研究僧i 提交于 2020-03-17 10:41:55
某厂面试归来,发现自己落伍了!>>> 打开delphi 2010窗口进行编程, 编程时,一般把输入西文或以西文为主的元件的ImeMode属性设为缺省值;而把输入中文或以中文为主的元件的ImeMode属性设为ImOpen;ImeName属性值则在程序运行时由用户设定。这个方法的灵活性就在于此。另外,还需要把Edit1.Text、Edit2.Text、Memo1.Lines的值设为空。 (3)在Form1中添加一个标签Label4,设定其属性为: Caption = 选择最喜欢的输入法 Font.Size=12 Font.Color=红色 (4)在Form1中添加一个下拉组合框ComboBox1,在对象观察器Object Inpector中选择Events选项卡,双击OnDropDown,对此事件进行编程,其代码如下: ComboBox1.Items.CommaText:=Screen.Imes.CommaText; 上面这个语句可以将中文Windows 95中安装的汉字输入法添加到下拉组合框中,它巧妙地运用了TScreen类的Imes特性,而Imes特性本身又是一个Tstring类,其属性Commatext包含了Windows 95已安装的汉字输入法,可以将其直接赋值给ComboBox1的相应属性。如果直接编辑ComboBox1的属性Items来添加汉字输入法名称

Should I not pass an interface as const?

喜你入骨 提交于 2020-03-17 07:13:10
问题 I recently came across (again) the Delphi compiler code-gen bug when passing an interface as const leaks a reference. This happens if your method is declared to pass an interface variable as const , e.g.: procedure Frob(const Grob: IGrobber); and the fix is to simply remove the const : procedure Frob(Grob: IGrobber); I understand that const (and var , and out ) allow you to pass items by reference . In the case of a structure this saves an argument copy; letting you instead simply pass the

Should I not pass an interface as const?

岁酱吖の 提交于 2020-03-17 07:11:32
问题 I recently came across (again) the Delphi compiler code-gen bug when passing an interface as const leaks a reference. This happens if your method is declared to pass an interface variable as const , e.g.: procedure Frob(const Grob: IGrobber); and the fix is to simply remove the const : procedure Frob(Grob: IGrobber); I understand that const (and var , and out ) allow you to pass items by reference . In the case of a structure this saves an argument copy; letting you instead simply pass the