delphi-2009

How can I reduce PageControl flicker in Delphi?

主宰稳场 提交于 2019-11-30 13:34:12
In Delphi 2009 I found that the flicker of a PageControl - which occurs during resizing of the form - can be reduced by setting its DoubleBuffered property to true. However if I add controls to the PageControl tabsheets, they will flicker regardless of their DoubleBuffered property setting. I have also tried with and without runtime themes enabled. Setting ParentBackground to False for components on the PageControl helped a lot. However this results in a different color of these panel components, they all have a darker background now. Maybe this can be fixed easily (without losing Theme

How to implement thread which periodically checks something using minimal resources?

南笙酒味 提交于 2019-11-30 12:07:20
I would like to have a thread running in background which will check connection to some server with given time interval. For example for every 5 seconds. I don't know if there is a good "desing pattern" for this? If I remember corretly, I've read somewehere that sleeping thread in its execute method is not good. But I might be wrong. Also, I could use normal TThread class or OTL threading library. Any ideas? Thanks. You could use an event and implement the Execute method of the TThread descendant by a loop with WaitForSingleObject waiting for the event, specifying the timeout. That way you can

Is WideString identical to String in Delphi 2009

一笑奈何 提交于 2019-11-30 11:43:10
I'm getting some weird behaviour recompiling some applications in 2009 that used widestrings at various points. In a Delphi 2009 App is Widestring identical to String? Roddy No, they are not idenitical. WideString is just a wrapper for the ActiveX/COM BSTR type. You need it when working with with strings in ActiveX/COM. String in Delphi 2009 and later is an alias for UnicodeString , which can hold Unicode characters, just like BSTR does, but it's NOT the same as WideString . WideString is allocated by the COM memory manager, and is not reference counted. UnicodeString is allocated by the RTL

Delphi 2009, Indy 10, TIdTCPServer.OnExecute, how to grab all the bytes in the InputBuffer

痞子三分冷 提交于 2019-11-30 11:41:30
问题 I am messing around with the Indy 10 supplied with Delphi 2009 and am having trouble with getting all the data from the IOHandler when OnExecute fires... procedure TFormMain.IdTCPServerExecute(AContext: TIdContext); var RxBufStr: UTF8String; RxBufSize: Integer; begin if AContext.Connection.IOHandler.Readable then begin RxBufSize := AContext.Connection.IOHandler.InputBuffer.Size; if RxBufSize > 0 then begin SetLength(RxBufStr, RxBufSize); AContext.Connection.IOHandler.ReadBytes(TBytes(RxBufStr

How to increase the startup speed of the delphi app?

 ̄綄美尐妖づ 提交于 2019-11-30 11:09:06
问题 What do you do to increase startup speed (or to decrease startup time) of your Delphi app? Other than application specific, is there a standard trick that always works? Note: I'm not talking about fast algorithms or the likes. Only the performance increase at startup, in terms of speed. 回答1: Try doing as little as possible in your main form's OnCreate event . Rather move some initialization to a different method and do it once the form is shown to the user. An indicator that the app is busy

Easiest way to compose Outlook 2010 mail from Delphi?

萝らか妹 提交于 2019-11-30 10:25:03
Some of our applications which work fine with different ways of email integration, using mailto: , simulated "Send To..." , and SMTP in Windows 2000 and 2003 environments, now move to a new Windows 2008 system with Exchange 2010 and Outlook 2010 clients. We have one use case where the application creates a new mail, sets recipient(s) and subject, adds one or more attachments and then opens it in the default mail client so it can be edited by the user before sending. Do you know a solution which works in the new environment? Should we use a third party library? Or is there some OLE automation

What is the best way to display a PDF file in Delphi 2009 [closed]

廉价感情. 提交于 2019-11-30 09:38:38
What component should I use to display a PDF file in a Delphi 2009 application? EDIT: I have been using PDF Viewer by Synactis - a very nice free PDF Viewer But it has no Delphi 2009 support. So I need to designing it out of the product We embedded the Acrobat Reader in our Delphi application. Take a look at this article " How to embed Adobe Acrobat into your application ". Once you have added the Acrobat Reader ActiveX component to your Form you can use following code: procedure TForm1.Button1Click(Sender: TObject); begin // This example assumes that you have a TOpenDialog // and TPdf dropped

Is there, or is there ever going to be, a conditional operator in Delphi?

北城余情 提交于 2019-11-30 07:54:22
I kept my hands off Delphi for too long, I guess; busied myself with Java and PHP a lot over the last couple of years. Now, when I got back to doing a little Delphi job, I realised I really miss the conditional operator which is supported by both Java and PHP. On how many places would you find lines like these in your Delphi programs? var s : string; begin ...<here the string result is manipulated>... if combo.Text='' then s := 'null' else s := QuotedStr(combo.Text); result := result + s; end; where a simple result := result + (combo.text='')?'null':quotedStr(combo.text); would suffice. What I

Scope of anonymous methods

喜夏-厌秋 提交于 2019-11-30 07:03:27
One nice thing about anonymous methods is that I can use variables that are local in the calling context. Is there any reason why this does not work for out-parameters and function results? function ReturnTwoStrings (out Str1 : String) : String; begin ExecuteProcedure (procedure begin Str1 := 'First String'; Result := 'Second String'; end); end; Very artificial example of course, but I ran into some situations where this would have been useful. When I try to compile this, the compiler complains that he "cannot capture symbols". Also, I got an internal error once when I tried to do this. EDIT I

How to specify MSbuild output folder?

天大地大妈咪最大 提交于 2019-11-30 04:55:20
When I execute delphi 2009 project using MSBuild command line, output always goes to C: drive C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:OutDir="C:\Output\bin\" Why is this happening? I know the docs say otherwise , but try OutputPath instead of OutDir. For Delphi projects you need to use DCC_ExeOutput to specify where the EXE should go. C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:DCC_ExeOutput="C:\Output\bin\" Take a look inside Test.dproj for any other options you might want to specify. 来源: https://stackoverflow.com/questions/1083334/how-to-specify