我需要澄清一下Delphi Type Casting
我写了两个类的例子:TClassA和TClassB,TClassB派生自TClassA.
代码如下:
program TEST;
{$APPTYPE CONSOLE}
uses
System.SysUtils;
type
TClassA = class(TObject)
public
Member1:Integer;
constructor Create();
function ToString():String; override;
end;
type
TClassB = class(TClassA)
public
Member2:Integer;
constructor Create();
function ToString():String; override;
function MyToString():String;
end;
{ TClassA }
constructor TClassA.Create;
begin
Member1 := 0;
end;
function TClassA.ToString: String;
begin
Result := IntToStr(Member1);
end;
{ TClassB }
constructor TClassB.Create;
begin
Member1 := 0;
Member2 := 10;
end;
function TClassB.MyToString: String;
begin
Result := Format('My Values is: %u AND %u',[Member1,Member2]); …Run Code Online (Sandbox Code Playgroud) 我的应用程序(在Delphi和ZEOS组件中开发)使用PostgreSQL 8.4并将一些缩略图存储到一bytea列中.
我想迁移到PostgreSQL 9.2并恢复转储,一切正常,除非我尝试检索这些图像:Postgres 9.2 hex用于输出表示而不是escape在Postgres 8.4 中使用.
有两种可能的解决方案:更改Postgres 9.2设置以进行escape表示,或hex通过应用程序更改二进制数据中的字符串.但什么是最好的解决方案?为什么PostgreSQL的9.X改变hex的bytea代表性?
这是一个简单的设置还是有技术原因?
我正在Delphi XE2中开发一个应用程序,它通过EnumWindows和EnumChildWindows函数检查一个运行应用程序的窗口,该窗口也是用Delphi编写的.
这是主要代码(改编自一个例子:http://www.swissdelphicenter.ch/torry/showcode.php?id = 410)
function EnumChildWindowsProc(Wnd: HWnd; Form: TForm1): Bool; export;
{$ifdef Win32} stdcall; {$endif}
var
Buffer: array[0..99] of Char;
begin
GetWindowText(Wnd, Buffer, 100);
if StrPas(Buffer) = '' then Buffer := 'Empty';
new(AWindows);
with AWindows^ do
begin
WindowHandle := Wnd;
WindowText := StrPas(Buffer);
end;
CNode := Form1.TreeView1.Items.AddChildObject(PNode,
AWindows^.WindowText + ':' +
IntToHex(AWindows^.WindowHandle, 8), AWindows);
if GetWindow(Wnd, GW_CHILD) = 0 then
begin
PNode := CNode;
Enumchildwindows(Wnd, @EnumChildWindowsProc, 0);
end;
Result := True;
end;
function EnumWindowsProc(Wnd: HWnd; …Run Code Online (Sandbox Code Playgroud) delphi ×3
bytea ×1
casting ×1
delphi-xe2 ×1
postgresql ×1
spy++ ×1
tcombobox ×1
tlabel ×1
types ×1