我在Install and Readme文件中找不到哪个版本号是Update 1.
在Delphi中,About框说我有Embarcadero®Delphi®XE版本15.0.3890.34076.这是否意味着它包含更新1?
我有一个使用库(DPK /可视控件)的程序.该库是在调试模式下编译的.这意味着Optimizations为OFF,RangeChecking为ON等,库设置为"根据需要重建".我不打算重新分发它(仅限内部使用).
如果我在"发布"模式下编译程序会发生什么?库中包含的代码将自动重新编译为"发布"模式?或者我必须首先加载DPK并在"发布"模式下重新编译我的库?
更新:
与"根据需要重建"相关Embarcadero的帮助说明了一切:"根据需要构建软件包".我将其解释为"如果程序是在发布模式下编译的,则需要重新编译库,以便我们为您完成".我的解释也是......圣经吗?
此实验表明(在上述条件下)库中包含的代码将根据DPR的设置编译到EXE中,而不是DPK的设置.
编译器在重新编译其PAS文件时不关心DPK文件(仅在未在IDE中加载DPK时才适用).**
所以这里(很容易在所有系统中重现)证明:让我们调用我的程序Prog.DPR(包含Prog.pas)和我的库Lib.DPK(包含LibUnit.pas).该库包含TMyPanel可视化控件.DPR处于发布模式.DPK处于调试模式.
I install the library. I exit the library ('Close all').
I load the DPR in IDE, I also load LibUnit (Attention: I load only the unit, not the DPK)
I put TMyPanel on my program's form.
The LibUnit is automatically added to the USES clause on my program.
I edit LibUnit. I compile. It works. New DCU file is generated for LibUnit.
I go to library's folder and I delete the DPK …Run Code Online (Sandbox Code Playgroud) 我尝试通过CalColors更改TMonthCalendar的设置,但它不起作用.无论是在设计时还是在运行时.日历保持不变.
更新:
看起来有人在Quality Central上报告了同样的问题:http:
//qc.embarcadero.com/wc/qcmain.aspx?d = 5394
我想启动远程dbg会话,并且删除计算机上的路由器阻止调试器.我可以做端口转发,但我找不到它正在使用的端口.
我想在程序的标题中显示程序是如何编写的.最重要的是,我想展示编译器优化是否开启/关闭.
(范围检查和其他类似的东西也很有趣,但主要是我对编译器优化感兴趣).
知道怎么做吗?
基于Arioch的即用型功能答案:
function CompilerOptimization: Boolean; { Importan note: $O+ has a local scope, therefore, the result of the function reflects only the optimization state at that specific source code location. }
begin
{$IfOpt O+}
Result:= TRUE;
{$Else}
Result:= FALSE;
{$EndIf}
end;
function CompilerOptimizationS: String;
begin
Result:= 'Compiler optimization is ' +
{$IfOpt O+}
'enabled'
{$Else}
'disabled'
{$EndIf}
end;
Run Code Online (Sandbox Code Playgroud)
重要提示:如果您使用{$ O}开关来优化代码片段,则必须将其用作此类子函数,否则,如果仅使用全局开关(在"项目选项"中),则可以将其用作正常(声明)功能.
// {$O+} or {$O-}
procedure TFrmTest.FormCreate(Sender: TObject);
function CompilerOptimizationS: String;
begin
Result:= 'Compiler optimization is ' +
{$IfOpt …Run Code Online (Sandbox Code Playgroud) 我正在尝试绘制一个源图像(GR32 TBitmap32),它在正常(TBitmap)图像上包含一些完全透明和部分透明的像素,同时保留源图像中的透明度。
我用这个:
BMP32.DrawTo(BMP.Canvas.Handle, 0, 0);
Run Code Online (Sandbox Code Playgroud)
但图像不是透明绘制的。
代码:
一切都很基本:我有一个背景位图 (Bkg),在应用程序启动时,我在其中加载了一个图像。然后在应用程序中,我从磁盘加载第二张图像(具有透明度的图像)并将其绘制在背景上。
var Bkg: TBitmap;
procedure TfrmPhoto.FormCreate(Sender: TObject);
begin
Bkg:= LoadGraphEx(GetAppDir+ 'bkg.bmp'); { Load bitmap from file }
{
Bkg.Transparent:= TRUE;
Bkg.PixelFormat:= pf32bit;
Bkg.TransparentColor:= clPink;
}
end;
procedure TfrmPhoto.Apply2;
VAR
Loader: TBitmap;
BMP32: tbitmap32;
begin
BMP32:= TBitmap32.Create;
TRY
Loader:= TBitmap.Create;
TRY
Loader.LoadFromFile('c:\Transparent.BMP');
BMP32.Assign(Loader);
FINALLY
FreeAndNil(Loader);
END;
{ Mix images }
BMP32.DrawTo(Bkg.Canvas.Handle, 0, 0); <----- The problem is here
imgPreview.Picture.Assign(Bkg); { This is a TImage where I see the result }
FINALLY
FreeAndNil(BMP32); …Run Code Online (Sandbox Code Playgroud) 我有这个基本代码,应该编码一个字符串,然后将其取回.但是,解码后的文本是垃圾.
procedure TForm5.Button2Click(Sender: TObject);
VAR s1, s2, s3: String;
i: Integer;
begin
for i:= 1 to 200
DO s1:= s1+ char(Random(255));
s1:= EncdDecd.EncodeString(s1);
s3:= EncdDecd.DecodeString(s2);
if s1= s3
then Caption:= 'Equal'
else Caption:= 'Not equal';
end;
Run Code Online (Sandbox Code Playgroud)
更新:
如果我做char(Random(128))而不是255,它可以工作!
我目前的问题与Delphi中动态数组的最大长度有关吗?.在2009年64位编译器不可用时,问了这个问题.我准备迁移到Delphi XE2(或任何可供购买的版本)或Lazarus,因为我需要64位支持.
我想知道在Delphi 64bit中改变了什么(与动态数组最大长度有关).我现在可以创建更大的阵列吗?
我需要处理一些数据并且每5-10秒显示一次进度(我以百分比显示进度但我也更新了一些图表).我想在没有多线程的情况下这样做.循环可能很大.它可以从数百万开始,可以高达数十亿.
我可以使用GetTickCount:
const
RefreshEvery= 5000;
for x:= 1 to 10000000000 do
if GetTickCount-OldTime> RefreshEvery then
begin
OldTime:= GetTickCount;
if Assigned(FProgress) then FProgress(Self);
end;
Run Code Online (Sandbox Code Playgroud)
但是在循环中调用GetTickCount会执行数十亿次...
有关最有效的方法的任何想法?
为什么没有多线程?
这是一个很大的应用程序,在GUI进度模块中有一个小故障.我想解决这个问题,重新打包并交付它而不需要对其进行大的更改,这需要再次进行密集测试.多线程?......很酷,但后来......
我需要执行一个'DOS'程序(控制台应用程序)并动态检索它的输出(能够随时结束DOS程序也很好,因为DOS程序可能会运行几个小时).
我有这个功能,但它有时(很少)冻结.我需要一个新功能或修复下面的功能.
procedure ExecuteAndGetOutDyn(CONST ACommand, AParameters: String; AMemo: TMemo);
CONST
CReadBuffer = 128*KB; //original was 2400bytes
VAR
SecurityAttrib: TSecurityAttributes;
hRead: THandle;
hWrite: THandle;
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
pBuffer: array[0..CReadBuffer] of AnsiChar;
dRead: DWord;
dRunning: DWord;
WasOK: Boolean;
begin
SecurityAttrib.nLength := SizeOf(TSecurityAttributes);
SecurityAttrib.bInheritHandle := True;
SecurityAttrib.lpSecurityDescriptor := nil;
if CreatePipe(hRead, hWrite, @SecurityAttrib, 0) then
begin
FillChar(StartupInfo, SizeOf(TStartupInfo), #0);
StartupInfo.cb := SizeOf(TStartupInfo);
StartupInfo.hStdInput := hRead;
StartupInfo.hStdOutput := hWrite;
StartupInfo.hStdError := hWrite;
StartupInfo.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow:= SW_HIDE;
if CreateProcess(NIL, PChar(ACommand + …Run Code Online (Sandbox Code Playgroud)