在我的GUI应用程序中,我运行控制台应用程序并需要其窗口的句柄.我尝试使用EnumWindows(),请参阅下面的代码,但它不起作用.在列表中没有我的控制台应用程序.
type
TEnumWindowsData = record
ProcessId: Cardinal;
WinHandle: THandle;
List: TStrings; // For test only
end;
PEnumWindowsData = ^TEnumWindowsData;
function FindWindow(hWnd: THandle; lParam: LPARAM): BOOL; stdcall;
var
ParamData: TEnumWindowsData;
ProcessId: Cardinal;
WinTitle: array[0..200] of Char; // For test only
begin
ParamData := PEnumWindowsData(lParam)^;
GetWindowThreadProcessId(hWnd, ProcessId);
if ProcessId <> ParamData.ProcessId then
Result := True
else begin
ParamData.WinHandle := hWnd;
Result := False;
end;
// For test only
GetWindowText(hWnd, WinTitle, Length(WinTitle) - 1);
ParamData.List.Add(IntToStr(ProcessId) + ' ' + IntToStr(hWnd) + ' ' …Run Code Online (Sandbox Code Playgroud) 使用XE3程序进行数据处理的时间比使用XE2编译的相同程序多10倍.这是已知问题(可能主要指TStringField),向QC 111942报告,但尚未修复.有没有人针对这个问题进行修复/解决?
TIA Branko
type
TMyClass = class
...
public
...
property P1: Integer Index 1 read GetInteger write SetInteger;
property P2: Integer Index 2 read GetInteger write SetInteger;
property P3: Integer Index 3 read GetInteger write SetInteger;
...
end;
Run Code Online (Sandbox Code Playgroud)
是否有可能获得类属性的索引?例如,像
I := IndexOfProperty(TMyClass.P2);
Run Code Online (Sandbox Code Playgroud) TPath记录具有类构造函数TPath.Create,它初始化类变量.但是,我找不到任何使用TPath.Create /被称为dispite的单元,所有变量都具有正确的值(TPath.PathSeparator,...).
我必须创建具有更多具有相同名称的值的节点的xml文档
<PstlAdr>
<Ctry>SI</Ctry>
<AdrLine>Gosposvetska 12</AdrLine>
<AdrLine>Kranj</AdrLine>
</PstlAdr>
Run Code Online (Sandbox Code Playgroud)
使用oNode.ChildValues['AdrLine'] := ...它是不可能的 - 只能添加一个具有相同名称的值.如何添加更多具有相同名称的值?
最好的祝福
我无法使用Delphi 2010和dbGo连接到SQL Azure.有什么不对,怎么解决?
细节:
带有以下连接字符串的TADOConnection(登录信息已更改):
Provider=SQLNCLI10.1;Integrated Security="";Persist Security Info=False;User ID=me@tyasdgerj5;Initial Catalog=Northwind;Data Source=tcp:tyasdgerj5.database.windows.net;Initial File Name="";Server SPN=""
返回以下错误文本:
无法确定服务器名称.它必须显示为服务器的dns名称的第一个段(servername.database.windows.net).某些库不发送服务器名称,在这种情况下,服务器名称必须作为用户名(username @ servername)的一部分包含在内.此外,如果使用两种格式,则服务器名称必须匹配..
请注意,SQL Server Management Studio连接没有问题.
是否有可能通过 rtti 获得类属性?下面的代码有什么问题?
...
type
TTest = class
private
class function GetCP: string; static;
public
class property CP: string read GetCP;
end;
class function TTest.GetCP: string;
begin
Result := 'ABC';
end;
...
procedure TForm1.Button5Click(Sender: TObject);
var
oTest: TTest;
oType: TRttiType;
begin
oTest := TTest.Create;
try
oType := TRttiContext.Create.GetType(oTest.ClassType);
ShowMessage(Length(oType.GetProperties).ToString); // oType.GetProperties = nil !!!
finally
oTest.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
TIA 和最诚挚的问候,布兰科
随着RttiContext.FindType('Classes.TStringList')我得到的TStringList的RttiType没有问题.但是RttiContext.FindType('MyUnit.TMyClass')我总是得到零(当然MyUnit是在使用条款中).为什么,出了什么问题?
例:
unit MyUnit;
interface
uses
Classes;
type
TMyClass = class(TStringList)
end;
implementation
end.
Main unit:
...
uses
MyUnit,
...
var
oCont: TRttiContext;
oType: TRttiType;
begin
oCont := TRttiContext.Create;
try
oType := oCont.FindType('MyUnit.TMyClass'); <== oType = nil !!
...
Run Code Online (Sandbox Code Playgroud) 我的TMemo后代有构造函数
constructor TMyMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Lines.Clear;
end;
Run Code Online (Sandbox Code Playgroud)
当我把TMyMemo放在表单上时,我得到错误"控件''没有父窗口." 为什么?
链接到原始问题是否有可能获得类属性的索引?并由Remy Lebeau和RRUZ回答
program Demo;
{$APPTYPE CONSOLE}
uses
System.SysUtils, Winapi.Windows,
System.Rtti, System.TypInfo;
type
TMyClass = class
private
function GetInteger(const Index: Integer): Integer;
procedure SetInteger(const Index, Value: Integer);
public
property P1: Integer Index 1 read GetInteger write SetInteger;
property P2: Integer Index 2 read GetInteger write SetInteger;
property P3: Integer Index 3 read GetInteger write SetInteger;
end;
{ TMyClass }
function TMyClass.GetInteger(const Index: Integer): Integer;
begin
Result := Index;
end;
procedure TMyClass.SetInteger(const Index, Value: Integer);
begin
//
end;
{------------------------------------------------------------------------------}
function …Run Code Online (Sandbox Code Playgroud) 我必须在"Everyone"用户组的某个文件夹上设置prmissions,所以我需要这个组的SID.当我打电话时,ConvertStringSidToSid()我得到错误"System Error. Code: 87 - Parameter is incorrect".为什么?我的代码出了什么问题?
...
function ConvertStringSidToSid(StringSid: LPCTSTR; Sid: PSID): BOOL; stdcall;
external Advapi32 name 'ConvertStringSidToSidW';
...
var
Sid: PSID;
...
Sid := Nil;
ConvertStringSidToSid(LPCTSTR('S-1-1-0'), Sid);
...
Run Code Online (Sandbox Code Playgroud)
TIA Branko
我需要用于Delphi 2010控制台应用程序的Crt单元(ReadKey,GotoXY,...).Delphi 2010是否有任何Crt单元?
delphi ×13
delphi-2010 ×3
rtti ×3
delphi-xe2 ×2
delphi-xe3 ×2
winapi ×2
windows-7 ×2
crt ×1
properties ×1
txmldocument ×1
vcl ×1