我尝试使用Delphi 2010自定义属性调查DeHL,但出现问题。
TAppParamTest = class
public
User: string;
Password: string;
end;
TAppParam = class
private
FTest: TAppParamTest;
public
constructor Create;
destructor Destroy; override;
property Test: TAppParamTest read FTest write FTest;
end;
Run Code Online (Sandbox Code Playgroud)
这很好用:当我序列化时我有这个
<TAppParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:DeHL="http://alex.ciobanu.org/DeHL.Serialization.XML" DeHL:class="AppParam_unt.TAppParam" DeHL:refid="1">
<FTest DeHL:class="AppParam_unt.TAppParamTest" DeHL:refid="2">
<User>User</User>
<Password>Psw</Password>
</FTest>
</TAppParam
Run Code Online (Sandbox Code Playgroud)
但我想要这个:
<TAppParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:DeHL="http://alex.ciobanu.org/DeHL.Serialization.XML" DeHL:class="AppParam_unt.TAppParam" DeHL:refid="1">
<Test DeHL:class="AppParam_unt.TAppParamTest" DeHL:refid="2">
<User>User</User>
<Password>Psw</Password>
</Test>
</TAppParam
Run Code Online (Sandbox Code Playgroud)
所以我想在类中添加自定义属性:
TAppParam = class
private
[XmlElement('Test')]
FTest: TAppParamTest;
public
constructor Create;
destructor Destroy; override;
property Test: TAppParamTest read FTest …Run Code Online (Sandbox Code Playgroud) 当我试图从动态加载的dll中访问主机程序中的TDictionary变量时,我遇到了一个非常严重的问题.这是完整的代码,任何人都可以提供一些帮助?谢谢!
===========主程序项目源代码===================
program main;
uses
ShareMem,
Forms,
uMain in 'uMain.pas' {Form1},
uCommon in 'uCommon.pas';
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
==============单位uMain ================
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, uCommon;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
type
Tfoo = function(ADic: TMyDic): string; stdcall;
procedure TForm1.Button1Click(Sender: TObject);
var
Dic: …Run Code Online (Sandbox Code Playgroud) 正如您所知,我在使用Delphi 2010开发的应用程序中使用TTimer VCL组件时遇到了一些麻烦.
每当我打电话:
Self.Timer1.Enabled := False;
Self.Timer1.Enabled := True;
Run Code Online (Sandbox Code Playgroud)
计时器组件似乎确实停止了,但是,它永远不会再次启动.就像,它从不调用OnTimer事件.
我将它与Indy10 IRC组件(TIdIRC)结合使用.
提前致谢 :)
我想将这样的字符串显示为注释文本:
姓名:约翰
它有一个大胆的部分和一个常规的部分.有没有办法可以做到这一点?
有没有办法让Delphi 2010命令行编译器(dcc32.exe)行号传回管道中的GUI应用程序进度条?
作为替代方案,从以下字符串返回(行号)是一个很好的函数:
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(20)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(339)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(341)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(512)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1024)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1536)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2048)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2560)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3072)
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3342)
Run Code Online (Sandbox Code Playgroud) 我们在Delphi 10中使用Unidac Stored Proc组件和Sybase 12.5驱动程序
在Sybase proc我们提出错误如下,我发现它正在重新启动但它没有显示错误消息.我没有在Unidac或任何其他问题?
if @number <> null
begin
select @errmsg = 'Already active for location '
raiserror 20001 @errmsg
return 1
end
Run Code Online (Sandbox Code Playgroud)
我在delphi中执行storedproc,如下所示
try
ExecProc;
except on E:Exception do
begin
ErrorMsg(EDatabaseError(ExceptObject).Message,0);
Exit;
end;
Run Code Online (Sandbox Code Playgroud)
但我们仍然无法捕获异常.
即使我尝试过如下.
try
UniStoredProc.StoredProcName := 'test';
UniStoredProc.ExecProc;
except
on E:EUniError do
ShowMessage(E.Message);
end
Run Code Online (Sandbox Code Playgroud)
相同的代码适用于Sybase 15客户端库
我们使用Sybase 15服务器和Sybase 12.5 Client库连接到服务器,这会有问题吗?之前我们使用BDE和Sybase 12.5客户端库,所以我们没有遇到任何问题,现在我们发现unidac存在这个问题
我一直在使用Delphi 2010中的Category Panel Control.我已经能够修改颜色并让它们以我喜欢的方式工作.但是,每个面板标题之间都有一个银色的"水平分隔符"(我不知道还有什么可以称之为).
如何更改此"水平分隔符"的外观或将其全部删除?

我试过了
但是没有一个支持内联ASM.是否有一些图书馆支持它?
Delphi 2010
我有一个列表框,我填写了所有进程ID的列表.
function EnumProcess(hHwnd: HWND;lParam : integer): boolean; stdcall;
var
pPid : DWORD;
title, className : string;
begin
if(hHwnd=NULL) then
begin
result := false;
end
else
begin
GetWindowThreadProcessId(hHwnd,pPid);
SetLength(className, 255);
SetLength(className, GetClassName(hHwnd, PChar(className), Length(className)));
SetLength(title, 255);
SetLength(title, GetWindowText(hHwnd, PChar(title), Length(title)));
//form1.ListBox1.Items.Add('Class Name = ' + className + '; Title = ' + title + '; HWND = ' + IntToStr(hHwnd) + '; Pid = ' + IntToStr(pPid));
form1.ListBox1.Items.Add(IntToStr(pPid));
result := true;
end;
end;
Run Code Online (Sandbox Code Playgroud)
有没有办法隐藏和显示PID?我需要一个Hide函数和一个可以处理它们的函数
function HidePID(Value: DWord): Boolean;
function …Run Code Online (Sandbox Code Playgroud) 我尝试定义一个私有方法,我有:
unit FormENP;
interface
uses
....
type
TENPDataEntry = class(TForm)
........
private
{ Private declarations }
function getLastIdMuestra(): integer;
public
{ Public declarations }
end;
var
ENPDataEntry: TENPDataEntry;
implementation
{$R *.dfm}
{ Devuelve el id de la última muestra insertada en <MUESTRA> }
function getLastIdMuestra(): integer;
var
query: TIBQuery;
id: integer;
begin
query := TIBQuery.Create(nil);
....
id := query.Fields[0].AsInteger;
query.Destroy;
getLastIdMuestra := id;
end;
...
End.
Run Code Online (Sandbox Code Playgroud)
但是编译器说:
[DCC错误] FormENP.pas(30):E2065不满意的前向或外部声明:'TENPDataEntry.getLastIdMuestra'
第30行是方法签名:
function getLastIdMuestra():integer;
我是德尔福的新手,有什么想法吗?我认为代码很好......