delphi-2010

How to convert UTC to local time

﹥>﹥吖頭↗ 提交于 2019-12-11 06:34:00
问题 I have to develop an application for ePrescribe and need to convert an UTC Time value (for example '2010-01-01T16:09:04.5Z') to local time. Delphi 2010, any suggestions? 回答1: You have to parse the string manually first. Extract the individual values from it, then you can put them into a Win32 SYSTEMTIME record and call SystemTimeToTzSpecificLocalTime() to convert it from UTC to local. You can then use the converted SYSTEMTIME however you need, such as converting it to a TDateTime using

How do set the timeout on a wcf service caller in Delphi?

北城以北 提交于 2019-12-11 06:28:00
问题 I have a straightforward call to a wcf service hosted by iis I'm Delphi 2010 The operation being called on the service could take several minutes What is the best way of avoiding a timeout error in Delphi? I deliberately put a Thread.Sleep inside my WCF Service force it to wait for 31 seconds After 30 seconds I got the error Project raised exception class ESOAPHTTPException with message 'The handle is in the wrong state for the requested operation - URL:http://10.1.1.4/STC.WcfServices.Host

How to use Delphi 2010's new WIC capability on Canon files?

混江龙づ霸主 提交于 2019-12-11 06:26:48
问题 Does anyone know of some sample code that shows how Delphi 2010 can read RAW files using its new COM interface to WIC? I want to read Canon RAW images and then access specific pixels... 回答1: This is the simplest usage: procedure TForm116.Button1Click(Sender: TObject); var WIC: TWICImage; begin WIC := TWICImage.Create; try WIC.LoadFromFile('MyFilename.raw'); Image1.Picture.Graphic.Assign(WIC); finally WIC.Free; end; end; There are many, many, many different types of "raw" image file formats,

(Indy) TIdHTTP EIdSocketError Socket Error # 0 exceptions when downloading files

雨燕双飞 提交于 2019-12-11 06:09:24
问题 I have this delphi code that basically download files from a secure server (using Indy build 10.5.8 r4743 if I'm not mistaken): The problem is: I'm getting random "Socket Error # 0" exceptions that I couldn't get fix or even understand: Project MyProject.exe raised exception class EIdSocketError with message 'Socket Error # 0 Stack is here, pascal code is: IdHTTP := TIdHTTP.Create(nil); TheSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil); TheCompressor := TIdCompressorZLib.Create(nil);

Delphi 2010 for loop count

徘徊边缘 提交于 2019-12-11 04:34:49
问题 I have a problem with a For Loop. I need it to count a random amount of shopping sprees and amounts but display them in order like below. It also needs to take the amount of sprees and display it before. Currently it displays total sprees as 0 and only displays 20 sprees which is not random. You have won a total of 3 shopping sprees On spree #1 you may spend R100 On spree #2 you may spend R341 On spree #3 you may spend R451 TotalCost := 0; Sum := 0; ListHead := 'Max per spree is R500.00 Max

Delphi 2010 or 2007 for upgrading Delphi 3 project?

家住魔仙堡 提交于 2019-12-11 04:05:51
问题 I've just received an assignment to upgrade an old Delphi 3 project that I wrote in 1999 to a newer version and add features (I previously discussed this in related questions here and here). I was assuming that the appropriate route would be to first upgrade my development environment to Delphi 2010 and then port the application. I'm now considering whether to upgrade the application to my existing copy of Delphi 2007 instead in order to avoid the Unicode complications. The application runs

Amazon MWS API Call Using Delphi/Indy

北城以北 提交于 2019-12-11 03:31:30
问题 I'm developing a simple application to "talk" to the Amazon MWS API. Because a lot of existing code is at play here, I need to get this done in Delphi 2010 with Indy 10 (10.5.5) components, which I have used successfully to integrate with many other APIs in the past. However, the Amazon API seems to be incredibly sensitive to the smallest of details, to the point that all my calls are being denied with the already infamous "SignatureDoesNotMatch" error message. Here's what I have accomplished

Delphi TIdHTTP POST does not encode plus sign

孤者浪人 提交于 2019-12-11 03:18:21
问题 I have a TIdHTTP component on a form, and I am sending an http POST request to a cloud-based server. Everything works brilliantly, except for 1 field: a text string with a plus sign, e.g. 'hello world+dog', is getting saved as 'hello world dog'. Researching this problem, I realise that a '+' in a URL is regarded as a space, so one has to encode it. This is where I'm stumped; it looks like the rest of the POST request is encoded by the TIdHTTP component, except for the '+'. Looking at the

Enum Const Record Fields

天涯浪子 提交于 2019-12-11 02:56:11
问题 I got some problems with RTTi .. i wana to enumerate all constans values in Record type type TMyRecord = record const value1: Integer=10; value2: Integer=13; value3: Integer=18; value4: Integer=22; end; procedure TForm3.Button1Click(Sender: TObject); var ctx:TRttiContext ; Field:rtti.TRttiField ; begin for Field in ctx.GetType(TypeInfo(TMyRecord)).GetFields do ListBox1.Items.Add(Field.Name ); // i got nothing end; but when my Record is not a const , my code work fine type TMyRecord = record

Delphi 5 to 2010

半腔热情 提交于 2019-12-11 01:22:48
问题 I used same function ( OneWayEncrypt(edit1.Text) ) in Delphi 5 and 2010. Why the results are different? (Or how can I give the same results from Delphi 2010?) uses Sysutils, Windows, Dialogs, classes; function OneWayEncrypt(AStr: string): string; PROCEDURE CalcCRC32 (p: pointer; ByteCount: DWORD; VAR CRCvalue: DWORD); implementation const table: ARRAY[0..255] OF DWORD = ( //table consts are here ); PROCEDURE CalcCRC32(p: pointer; ByteCount: DWORD; VAR CRCvalue: DWORD); VAR i: DWORD; q: ^Byte;