Delphi

RegisterPowerSettingNotification use in Delphi

假如想象 提交于 2020-02-16 07:01:26
问题 How to use the RegisterPowerSettingNotification in conjuction with GUID_MONITOR_POWER_ON in Delphi XE2? 回答1: You have to call RegisterPowerSettingNotification with the desired GUID Power Setting GUIDs to registers the application to receive power setting notifications for a specific power setting event, if not needed anymore the call UnregisterPowerSettingNotification. A delphi example could look like this: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics,

Failed to decode response content using IdHttp

淺唱寂寞╮ 提交于 2020-02-16 05:48:50
问题 I use TIdHttp to fetch web content. The response header indicates the content encoding to be utf8. I want to print content in console as CP936 (simplified chinese), but the actual content is not readable. Result := TEncoding.Utf8.GetString(ResponseBuffer); I do the same thing in python (using httplib2) without any problems. def python_try(): conn = httplib2.HttpConn() respose, content = conn.get(...) print content.decode('utf8') # readable in console UPDATE 1 I debugged the raw response and

超强震撼!纪念每一位老Delphi程序员已经逝去的青春!Delphi发布25周年盛大纪念活动网址!

Deadly 提交于 2020-02-15 15:18:18
Delphi万岁!Delphi发布25周年盛大纪念活动网址! https://delphi.embarcadero.com/ 分析 25年前的这一天,Borland Software推出了Delphi应用程序开发产品的1.0版,并在旧金山举行的Software Development '95活动中宣布了这一消息。 那年,Windows的当前版本为3.11(或NT 3.5),Windows 95为beta。对自定义业务应用程序的需求很高,开发人员可以选择很多工具:用于16位应用程序的Microsoft Visual C ++ 1.52,用于32位的Visual C ++ 2.0,Borland的Pascal或C ++,各种面向数据库的工具,如PowerBuilder或Microsoft访问,还有更多。 还有Visual Basic(VB)3.0,对ODBC和Microsoft JET数据库都提供了集成支持。VB凭借其可视化的表单生成器和无威胁的编程语言(不区分大小写且没有花括号)易于使用,并且在急于或不愿与C / C ++纠缠的开发人员中广受欢迎。 但是,VB存在一些问题。它是一种解释型语言,这意味着应用程序依赖于安装运行时,并且与C或C ++相比,它运行缓慢。该语言也很古怪(VB专家布鲁斯·麦金尼(Bruce McKinney) 写道 :“带上斧头” ),并且不支持面向对象的编程。

Accessing classes that are in another DLL?

北城以北 提交于 2020-02-15 10:05:57
问题 Is there is a way of exporting and using classes from another dll, I have 2 dll's and I am trying to access classes in between, was wondering if this is possible. 回答1: There are a variety of ways to achieve this, including but not limited to the following: Use runtime packages rather than DLLs. Then you can use any types, variables, etc. from another module. Note that this forces you to use runtime packages in all of your modules, and to compile all of the modules with the same version of

Warning on comparing a SmallInt with result of Ord function

陌路散爱 提交于 2020-02-15 04:42:40
问题 I'm comparing a SmallInt variable with the result of the Ord function. Example: var MySmallInt : SmallInt; begin MySmallInt := 5; if(MySmallInt > Ord('C')) then ShowMessage('True') else ShowMessage('False'); end After doing this, the following warning message is shown (W1023): W1023 Comparing signed and unsigned types - widened both operands Delphi's hint on the Ord function says that it should return a SmallInt and that's why I can't understand what causes the warning message. (I've looked

Warning on comparing a SmallInt with result of Ord function

末鹿安然 提交于 2020-02-15 04:39:38
问题 I'm comparing a SmallInt variable with the result of the Ord function. Example: var MySmallInt : SmallInt; begin MySmallInt := 5; if(MySmallInt > Ord('C')) then ShowMessage('True') else ShowMessage('False'); end After doing this, the following warning message is shown (W1023): W1023 Comparing signed and unsigned types - widened both operands Delphi's hint on the Ord function says that it should return a SmallInt and that's why I can't understand what causes the warning message. (I've looked

Delphi中分隔字符串函数的使用

匆匆过客 提交于 2020-02-15 01:54:59
下面介绍Delphi自带的字符串分割函数,根据你的需要来使用。 1、ExtractStrings function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer; 第一个参数是分隔符,可以是多个,例如 [ ';', ',', ':'] 可以按分号、逗号、分号来同时分割。 第二个参数是开头被忽略的字符,例如[ '<', '>', ''],被分割出的字符,如果开头有大于号,小于号,或者分号,被分割出来后会被忽略。 第三个参数是被分割的字符串。 第四个参数返回分割出的字符串数量。 注:该函数只能按单个字符进行分割,不能按字符串进行分割。 2、SplitString function SplitString( const S, Delimiters: string): TStringDynArray; 第一个参数是被分割的字符串。 第二个参数是分隔符,可以包含多个分隔符,例如 ';,:',可以按分号、逗号、分号来同时分割。 返回值是分割的结果。 注:这个函数在早期的Delphi中没有,跟ExtractStrings的用法相近,参数更少,使用更方便一些,要引用这个单元System.StrUtils 3、使用正则式 TRegEx.Split

Delphi中的DBGrid控件

ⅰ亾dé卋堺 提交于 2020-02-14 07:47:47
在Delphi中,DBGrid控件是一个开发数据库软件不能不使用的控件,其功能非常强大,可以配合SQL语句实现几乎所有数据报表的显示,操作也非常简单,属性、过程、事件等都非常直观,但是使用中,有时侯还是需要一些其他功能,例如打印、斑马纹显示、将DBGrid中的数据转存到Excel97中等等。这就需要我们定制DBGrid,以更好的适应我们的实际需要。本人根据使用Delphi的体会,定制了DBGrid,实现了以上列举的功能,对于打印功能则是在DBGrid的基础上联合QuickReport的功能,直接进行DBGrid的打印及预览,用户感觉不到QuickReport的存在,只需调用方法WpaperPreview即可;对于转存数据到Excel也是一样,不过这里使用的是自动化变量Excel而已。由于程序太长,不能详细列举,这里介绍一个完整的实现斑马纹显示的DBGrid,名字是NewDBGrid。根据这个小程序,读者可以添加其他更好、更多、更实用的功能。    NewDBGrid的实现原理就是继承DBGrid的所有功能,同时添加新的属性:Wzebra,WfirstColor ,WsecondColor。当Wzebra的值为True时,显示斑马纹效果,其显示的效果是单数行颜色为WfirstColor,双数行颜色为WsecondColor。具体的见下面程序清单: unit NewDBGrid;

delphi 根据数据库结构生成TreeView

可紊 提交于 2020-02-14 01:28:32
procedure TUIOperate.FillTree(treeview: TTreeView); var findq: TADOQuery; node: TTreeNode; //这个方法是根据记录的id字段值,查找TreeView上的父节点 function FindParentNode(id:Integer):TTreeNode; var i:Integer; begin Result := nil; for i := 0 to treeview.Items.Count - 1 do begin //比较Node的Data值和记录的id值 if Integer(treeview.Items[i].Data) = id then begin Result := treeview.Items[i]; Break; end; end; end; begin findq := TADOQuery.Create(nil); findq.Connection := controler.DataConnect.Connection; //这里的Connection指向你的数据连接 try treeview.Items.BeginUpdate; treeview.Items.Clear; //选出所有记录,并按parentid排序,这样可以保证先添加顶级节点,在下级记录添加时

FastReport 6.5.10 Enterprise Installer + FS--最新实用型

女生的网名这么多〃 提交于 2020-02-12 15:01:56
FastReport.Net还包括单独的程序 - Designer和Viewer。 如您所知,第一个用于创建和编辑报表模板。它具有报表预览模式,您可以从中查看报表,将其导出为所需的数据格式并将其发送到打印。 Viewer用于以fpx预览格式查看报表。 FastReport 6.5.10 VCL Enterprise FS (Full Source) 是最新版本的报表控件。 企业版完全源代码,正式版本,无任何限制!支持D7~D10.3.1 (Delphi all) 增加所有源代码路径到Delphi Lib路径中,请用recompile.exe 自带编译工具编译, FastReport.Net also includes separate programs-Designer and Viewer. As you know, the first one is for creating and editing report templates. It has a report preview mode where you can view the report, export it to the desired data format and send it to print. Viewer is used to view reports in fpx preview format.