delphi-xe2

Delphi wrapping TXMLData in SOAP request with <schema> tag

扶醉桌前 提交于 2019-12-06 09:56:39
I'm sending a XML using TXMLData and Delphi is adding a tag in the request, my code is like this: RequestData := TXMLData.Create; RequestData.LoadFromXML('<MyXML>[contents here]</MyXML>'); MyService.ExecuteRequest(RequestData); I used the OnBeforeExecute of the THTTPRIO to get the content of the Request and the content is wrapped in a tag, something like this: <SOAP-ENV:Body> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <MyXML> </schema> </SOAP-ENV:Body> I can't figure out why this tag is being added. How can I prevent it from being added? Also, I don't like the idea of editing the

DBGrid custom draw gdRowSelected not working

半世苍凉 提交于 2019-12-06 09:27:00
I'm custom drawing in a DBGrid by monitoring OnDrawColumnCell to color the column. When I read the event handler's State , I successfully capture gdSelected and color the font in the selected cell. But when I monitor gdRowSelected , it's never there, and thus I can't tell when a row is selected. Why doesn't gdRowSelected ever apply? Is this a bug, or intentional functionality? Here's how I currently draw. When a row is selected, it should show the text in that row in the color red. procedure TForm1.gItemsDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;

How can I download a huge file via TIdHTTP?

ぃ、小莉子 提交于 2019-12-06 08:58:00
问题 I use this code to download small files: Var ms:TMemoryStream; begin ms:=TMemoryStream.Create; Idhttp1.get('http://mydomain.com/myfile.zip',ms); ms.SaveToFile('myfile.zip'); ms.Free; end; But file is saved in RAM before storing to disk, so it may be difficult to download files >1Gb, for example. Is there a way to download a file by its parts? Or do I need to use the WinInet? Thanks in advance! 回答1: TMemoryStream provides an in-memory buffer, so if you download into one, you need to have

how to internationalize a delphi application [duplicate]

a 夏天 提交于 2019-12-06 08:14:02
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Translate application What is the best way to internationalize my application written in delphi xe2 ? I've seen the stringtable resource but I'm worried because I've got the feeling that the implementation could be time consuming and laborious. Are there other equally valid methods to do this? 回答1: Maybe not the best tool for translations, but I'm using GNU Gettext for many years. The process is quite simple:

Call Delphi Function From C#

馋奶兔 提交于 2019-12-06 08:04:45
问题 I have a below DLL source code. library Project1; uses System.SysUtils, System.Classes; type IStringFunctions = interface ['{240B567B-E619-48E4-8CDA-F6A722F44A71}'] function GetMethodValueAsString():PAnsiChar; stdcall; end; TStringFunctions = class(TInterfacedObject, IStringFunctions) public function GetMethodValueAsString():PAnsiChar; stdcall; end; {$R *.res} function TStringFunctions.GetMethodValueAsString():PAnsiChar; stdcall; begin Result := 'test'; end; procedure GetImplementation(out

Access violation casting IDispatch in XE2

非 Y 不嫁゛ 提交于 2019-12-06 06:22:27
问题 We're using some old code (ComLib.pas created by Binh Ly) so we can use the enumeration interface on an (OleVariant) object: type TDispNewEnum = dispinterface ['{97079E31-6957-11D2-9154-0000B4552A26}'] // dummy property _NewEnum: IUnknown readonly dispid -4; // DISPID_NEWENUM function _NewEnumFunc: IUnknown; dispid -4; // DISPID_NEWENUM end; procedure TEnumVariant.AttachUnknown (const Unk: IUnknown); var pDisp: IDispatch; _NewEnumPropFailed: boolean; Unknown: IUnknown; begin Detach; Unknown :

TStreamWriter (Auto)Flush does not?

一世执手 提交于 2019-12-06 06:05:48
Despite what is said in Text File Writing performances in Delphi (comments under Ken White's answer), I see the TStreamWriter not flushing with the following code: procedure TFrmAddEvents.LogEvent(AEvent: TcxSchedulerEvent); begin if not Assigned(FStreamWriter) then begin FStreamWriter := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(ParamStr(0),'.log'),fmCreate or fmOpenRead)); FStreamWriter.AutoFlush := true; end; FStreamWriter.WriteLine(TcxEventDescription(AEvent)); // Even this has no effect: FStreamWriter.Flush; end; Even after executing the if Assigned(FStreamWriter) then

Does TRichEdit support Unicode?

一曲冷凌霜 提交于 2019-12-06 05:55:21
I'm trying to write a wrapper class around TRichEdit that can encode and decode RTF to/from plaintext. This is what I've written so far: type TRTF = class private FRichEdit : TRichEdit; procedure SetText(const AText: string); function GetText: string; class function Convert(const AInput: string; AEncode: Boolean): string; inline; static; public constructor Create; destructor Destroy; override; class function Decode(const AInput: string): string; static; class function Encode(const AInput: string): string; static; end; constructor TRTF.Create; begin FRichEdit := TRichEdit.CreateParented(HWND

open source component for postgreSQL

这一生的挚爱 提交于 2019-12-06 05:33:13
I would like to know if there are any open source components available for Delphi XE-2 that can connect to postgreSQL other than using outdated techniques like ODBC. For now just Win32 support is needed, but if Win64 and OS-X support is also available that would be a bonus. I googled around a bit, but the only lib that's available (ZEOS) looks like it is no longer in active development. There does seem to be a patch for Delphi XE2 but I could not get it to compile. As of right now: No. You either route through ADO -> ODBC, dbExpress -> ODBC (for XE2*, see below), hope to make Zeos work, or pay

Delphi XE2: Disabling vcl Style on a component

谁都会走 提交于 2019-12-06 05:13:38
问题 I am trying to follow the example about to disable the color on a control on my form. TStyleManager.Engine.RegisterStyleHook(ClrMeans.TwwDBComboDLG, TEditStyleHook); But I am getting an exception when either registering or unregistering either a the 3rd party control (infopower TwwDBComboDlg) or a standard VCL TEdit. Anybody had any issues with this or any suggestions 回答1: The link here explains what you need to know. Basically, you need to either put a "null hook" in, which is what you