Delphi abc
1. 字符串连接直接用+,与Java和Python中的相同
2. 执行外部命令使用winexec,ShellExecute
eg. ShellExecute(0, 'open', 'jre/bin/java', '-lang zh-CN', 'E:\myfolder', SW_SHOW);
3. 判断文件、文件夹是否存在
FileExists('C:\Users\bill\somefile.txt')
DirectoryExits('C:\WINDOWS')
4. if else 结构
if FileExists(Edit1.Text) then
begin
....
end // 不可加分号
else if DirectoryExits('Edit1.Text') then
begin
....
end // 不可加分号
else
begin
....
end;
5. 获取屏幕宽度高度直接使用 Screen.Width Screen.Height
6. 设置窗口位置 SetBounds(left. top, width, height)
相关文档:
屏幕的分辨率用这个
x=GetSystemMetrics(SM_CXSCREEN)
y=GetSystemMetrics(SM_CYSCREEN)
同上。
.而且获得屏幕上的像素好像应该使用
screen.pixelsperinch函数
int GetDeviceCaps(
  ......
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
......
类的事件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMyEvent = procedure of object; //不带参数的过程
TMyEventExt = procedure(AName: string) of object; //带参数的过程
TForm1 = class(TForm)
......
查找另外一个窗口的句柄: handle := FindWindow(nil,PChar('窗口的标题'));//查到窗体句柄
查找子窗体:childHandle := FindWindowEx(handle,0,'子窗体类','子窗体标题');
另外有个枚举子窗体的API,EnumChildWindows(主创体句柄,@回调函数,用户参数);
用这个函数需要自己写一个回调的函数,比如:
function EnumChil ......