Delphi

Delphi

Delphi 不重复运行外部程序exe

33 0

procedure RunSysExe(const exeprocessname: String;exeTitle:String);var //引用单元shellapi OFile:String; HWndCalculator:HWnd;begin HWndCalculator:=FindWindow(nil,pwidechar(exeTitle)); if (HWndCalculator=0) then begin OFile:=exeprocessname; Shellexe

Delphi

Delphi xe 播放 GIF 动画

47 0

Delphi xe 播放 GIF 动画以前要在 Delphi 中显示 GIF 动画,一种办法是使用第三方组件,别一种方法就是使用 WebBrowser 组件。在 Delphi 2007 之后其内部已支持 GIF 了(可能在 Delphi 2005 和 Delphi 2006 中已支持了,未确认)。关于 GIF 的相关类是 TGIFImage,在 GIFImg 单元中,看下面的代码,窗体中的 GIF 就动起来了:uses GIFImg;procedure TForm1.FormCreate(Sender:

Delphi

Delphi TXT 指定行复制器

35 0

unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,clipbrd,strutils;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; Edit1: TEdit; Edit2: TEdit; Label1: TLabel

Delphi

Delphi xe中 Exit 的新用法

34 0

Delphi 2009 中 Exit 的新用法Nick 描述了 Exit 在 Tiburon 中的新语法,看代码:function foo(const I: Integer): string;begin if I < 0 then Exit('负数'); Result := '正数'; end; function foo(const I: Integer): string;begin if I < 0 then begin Result :

Delphi

Delphi三种弹窗

116 0

1: ShowMessage(' ');缺点:标题是项目名称,不能控制2 :MessageBox( handle, '内容' ,'标题' ,MB_OK);比较常用的一个信息对话框,不仅能够显示信息内容、信息提示图标,而且可以定义按钮组合及对话框的标题MB_OK:确定MB_OKCANCEL:确定和取消……3:MessageDlg( '内容 ', 对话框类型 , 对话框中的按钮 , 帮助)mtwarning:含有感叹号的警告对话框mte

Delphi

delphi中几种注释方法

71 0

在Pascal中,注释括在大括号中或带星号的圆括号中。Delphi 也认可C++ 风格的注释,即把注释放在双斜线后。例如{this is a comment}(* this is another comment *)// this is a comment up to the end of the line第一种注释方式较简略,使用也较为普遍;第二种方式在欧洲使用较广 ,因为欧洲的键盘缺少大括号;第三种方式的注释是从C++借用来的,只在32位版本的Delphi中可用,它在给一行代码加短注释时非常有用。上

Delphi

Delphi APP如何禁掉安卓锁屏

71 0

我要写一个 APP 是播放视频的。播放视频的时候,手机过一会自动锁屏。这个是手机本身的设置。如何在我的程序中禁止掉这个?经过搜索,安卓下有办法了。请见:安卓下如何用 WakeLock上述 StackOverflow 问题解答里面,给出了一个单元:Android.JNI.PowerManager.pas,我搜了一下 Delphi 提供的源代码,一堆 Android.JNI.xx 但没有这个文件。我自己写了个测试程序,把这个单元放进去,然后在程序里增加一个按钮,代码:procedure TForm2.But

Delphi

Indy TIdTCPClient 的一个用法上要留意的问题,以及 HTTP

62 0

Delphi 10.3 社区版测试用 TIdTCPClient 去连接一个 HTTP 服务器,自己写 HTTP 请求,发现一个问题。 大致步骤如下:1. 首先,用 TCP 客户端,连接一个 HTTP 服务器;2. 向服务器发送 HTTP 请求字符串;3. 从服务器读返回值;向服务器发送字符串的方法是:IdTCPClient1.IOHandler.Write(IB1); //这里的 IB1 是 TIdBytes;读返回值的方法是:IdTCPClient1.IOHandler.ReadBytes(IB2