delphi-xe2

Delphi custom Form Icon setting

无人久伴 提交于 2019-12-12 05:25:41
问题 I am a Delphi learner. I have some Delphi projects. In all my projects, I have used seperate FormIcon other than the ApplicationIcon. FormIcon have 256X256, 48X48, 32X32 and 16X16 different sizes of Icons. I hve noticed that in WinXP and Win7 "Alt+Tab" shows a blurred FromIcon. In Win7 FormIcon is also blurred in Taskbar. I think this due to stretched size created using 16X16 size Icon. There is no automatic solution for this. I have googled in internet and I found that I have to call

Generic factory looping

℡╲_俬逩灬. 提交于 2019-12-12 05:13:51
问题 I am trying to figure out how to write a generic factory in XE2. Lets say I have this: type TObjectTypes = (otLogger, otEmail); type TLoggerTypes = (lFile, lConsole, lDatabase); type TEmailTypes = (etPOP3, etSMTP); Classes: TSMTPEmail = class(TInterfacedObject, IEmail); // Supports emailing only TPOP3Email = class(TInterfacedObject, IEmail); // Supports emailing only TFileLogger = class(TInterfacedObject, ILogger); // Supports logging only etc. Now I do this to loop thru all TObjectTypes:

creating idhttpserver with ssl encryption

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:17:03
问题 I am not good with delphi yet, but based on some examples I have managed to create simple http server with no more than 10 users. There are 2 main problems I don't know how to solve yet. proper way to authenticate, manage users - sessions main problem, connection must be secure, so SSL encryption is needed, how to implement it? Any example I found in relation with idhttpserver and openssl, was not quite complete or with older version of Indy. I am currently working with Delphi XE2 with Indy

What is the recommended naming for scoped units in Delphi XE2 onwards?

ⅰ亾dé卋堺 提交于 2019-12-12 02:43:22
问题 With the advent of Delphi XE2 scoped units like Xml.Internal.AdomCore_4_3 or System.StrUtils came in fashion. I like the ability to use such descriptive names but I am puzzled what are the naming conventions and preffered directory structure. Should it be com.company.project.Security.Compression.ZLib.pas like in Java System.Security.Compression.ZLib.pas like in .NET or something else? Should I place my files in a directory strcuture like this System\Security\Compression\System.Security

Why do I get E2029 error when trying to implement a class helper for string?

强颜欢笑 提交于 2019-12-12 02:32:12
问题 We want to create a very convenient and stable conversion of data types, here string data type conversion using class helper feature in Delphi. type TStringHelper = class helper for String public function AsBoolean: Boolean; ... end; { TStringHelper } function TStringHelper.AsBoolean: Boolean; begin Result := False; try Result := StrToBool(Self); except end; end; When I try to compile the above code in Delphi XE2, I get: E2029 "declaration expected but string found" What's the problem with my

TurboPower LockBox 3: AES128 and padding ISO 10126

大兔子大兔子 提交于 2019-12-12 01:47:00
问题 I know this is a withdrawn standard. Nevertheless, the customer wants it (and we know who's always right). So, how do I do it? Ho can I choose ISO 10126 padding for an AES128 encryption? Edit: The LB version in use is 3.4.1 (I didn't have the time/knowledge to fix the latest release to run with XE2) 回答1: (1) You can roll your own padding. If you roll your own padding to make the message size an exact multiple of block cipher, TPLB3 will not try to add any additional padding. (2) For most

Typecast Generic type to other type

只愿长相守 提交于 2019-12-12 00:52:14
问题 i have a base class TEventMulticaster = class(Tobject) public procedure Notify(aMap: WideString); end; procedure TEventMulticaster.Notify(aMap: WideString); begin // Do something end; And a derived generic class TEventMulticaster<T> = class(TEventMulticaster) public procedure Notify(aMap: T ); reintroduce; end; procedure TEventMulticaster<T>.Notify(aMap: T); begin inherited Notify(aMap) // ERROR end; when base class Notify is call it give me error "Incompatible types: 'WideString' and 'T'"

Delphi -drawgrid shows multiple instance of painted cells when any arrow key is pressed. how to correct it

不羁岁月 提交于 2019-12-12 00:25:27
问题 when I press the button selected cells get painted in Delphi drawgrid. but when I press any arrow key the painted cells appear multiple times. the picture shows 3 blocks. the blue one is the actual and the 2 aqua ones are the ones painted after pressing any arrow key the current (or some date) date is passed when calling the create_env procedure. unit bookings2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl

background value if empty

只谈情不闲聊 提交于 2019-12-11 20:12:26
问题 I have property Background: TPicture read FBackground write SetBackground; if nothing is ever assiged to it, what would the value be of background? i have tried if Background = NULL then begin ... .. ... end; 回答1: It depends. When the field is created in the constructor and FBackground is assigned, then use: if FBackground.Graphic = nil then Or: if not Assigned(FBackground.Graphic) then If the Graphic is assigned, then use: if FBackground.Graphic.Empty then And if both property and field are

Idhttp post session expire

谁都会走 提交于 2019-12-11 19:35:59
问题 I'm using Idhttp (indy10 with delphi-xe2) to post form, but I get session expired message from the site, although I've already set cookie manager. Thank you. procedure TForm2.IdCookieManager1NewCookie(ASender: TObject; ACookie: TIdCookie; var VAccept: Boolean); begin ShowMessage(Acookie.CookieText); end; The result from ShowMessage is: ASP.NET_SessionId=enn1xnqde1o1rduedels5fqp; Path=/; Domain=www8.ticketingcentral.com; HttpOnly; Max-Age=252028195945; Expires=Fri, 31-Dec-9999 16:59:59 GMT 回答1