delphi-2010

How can I pass a Delphi string to a Prism DLL?

 ̄綄美尐妖づ 提交于 2019-12-28 06:24:17
问题 We try to pass a string from a native Delphi program to a Delphi Prism DLL. We have no problem passing integers, but strings are mismatched in the DLL. We saw Robert Love's code snippet in response to another question, but there is no code for the native Delphi program. How can we pass strings from Delphi to a Delphi Prism DLL? 回答1: The best way would be to use WideString. For several reasons. It is Unicode and works before D2009 It's memory is managed in ole32.dll, so no dependency on either

Convert Record to Serialized Form Data for sending via HTTP

别来无恙 提交于 2019-12-28 03:11:04
问题 Is there a way to convert this Record TError = record code: Word; message: String; end; TState = record caption: String; address: Cardinal; counters: TArray<Word>; errors: TArray<TError>; end; to serialized Form Data string ( Content-Type: application/x-www-form-urlencoded ) like caption=Foo& address=175896& counters[]=2& counters[]=2& errors[0][code]=52& errors[0][message]=ERR_NOT_AVAILABLE for sending via HTTP? Maybe there is some function similar to JQuery.param()? 回答1: Ok, here is a

How do I download only a little part of a big file? [closed]

喜你入骨 提交于 2019-12-26 14:37:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How do I download only a little part of a big file in Delphi? (like Download Manager) For example, suppose I want to get the first 300 bytes of a 100MB text file over HTTP. 回答1: getting the first 300 bytes of a 100MB file. Using WinInet library you can specify in the parameters how many bytes from the beginning

How do I download only a little part of a big file? [closed]

左心房为你撑大大i 提交于 2019-12-26 14:36:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How do I download only a little part of a big file in Delphi? (like Download Manager) For example, suppose I want to get the first 300 bytes of a 100MB text file over HTTP. 回答1: getting the first 300 bytes of a 100MB file. Using WinInet library you can specify in the parameters how many bytes from the beginning

How do I (or if I can't) use Variants on simple DLLs?

廉价感情. 提交于 2019-12-25 16:24:10
问题 I want to expose some functionality of a internal object as a DLL - but that functionality uses variants. But I need to know: I can export a function with Variant parameters and/or return - or is better to go to an string-only representation? What is better, from language-agnostic POV (the consumer is not made with Delphi - but all will run in Windows)? 回答1: You could use OleVariant, which is the variant value type that is used by COM. Make sure not to return it as a function result as

Reading a text file as bytes (byte by byte) using delphi 2010

淺唱寂寞╮ 提交于 2019-12-25 07:59:14
问题 I would like to read a UTF-8 text file byte by byte and get the ascii value representation of each byte in the file. Can this be done? If so, what is the best method? My goal is to then replace 2 byte combinations that i find with one byte (these are set conditions that I have prepared) for example, If I find a 197 followed by a 158 (decimal representations), i will replace it with a single byte 17 I don't want to use the standard delphi IO operations AssignFile ReSet ReWrite(OutFile); ReadLn

Sending large data from WCF Server to Delphi Client

对着背影说爱祢 提交于 2019-12-25 05:16:19
问题 I need to create a WCF Service that will have a download file function. This WCF will be consumed by a Delphi application. The problem: The files that will be downloaded are very large and may cause memory problems on Delphi side. So far, I have this code: [OperationContract] byte[] DownloadFile(string filePath); But this code will cause the client app to hold all data in memory which can be an issue. I have read that WCF is capable of streaming data as you can read at: How to: Enable

Retrieving a string from array of string const

天涯浪子 提交于 2019-12-25 03:27:28
问题 How do I get the string representation if I know the enum of integer value ? type MyEnum = (tmp_one, tmp_two, tmp_three); const MyTypeNames: array[tmp_one..tmp_three] of string = ('One', 'Two', 'Three'); 回答1: I'm assuming that you have an ordinal value rather than a variable of this enumerated type. If so then you just need to cast the ordinal to the enumerated type. Like this: function GetNameFromOrdinal(Ordinal: Integer): string; begin Result := MyTypeNames[MyEnum(Ordinal)]; end; 回答2: I

Retrieving a string from array of string const

走远了吗. 提交于 2019-12-25 03:27:10
问题 How do I get the string representation if I know the enum of integer value ? type MyEnum = (tmp_one, tmp_two, tmp_three); const MyTypeNames: array[tmp_one..tmp_three] of string = ('One', 'Two', 'Three'); 回答1: I'm assuming that you have an ordinal value rather than a variable of this enumerated type. If so then you just need to cast the ordinal to the enumerated type. Like this: function GetNameFromOrdinal(Ordinal: Integer): string; begin Result := MyTypeNames[MyEnum(Ordinal)]; end; 回答2: I

Install SynEdit into Delphi 2010 - SynEdit_R2010.bpl is missing

北战南征 提交于 2019-12-25 00:16:12
问题 I am attempting to install SynEdit_D2010 into my Delphi 2010 IDE, and I get an error stating that the program can't start because SynEdit_R2010.bpl is missing from my system. As far as I can tell, SynEdit_R2010.bpl is not missing on my system, and I even have it in my $(BDSCOMMONDIR)\Bpl directory. However, for some reason Delphi doesn't seem to think it is there! Any ideas how i can solve this? 回答1: Are you sure all your directories are correctly defined ? I think the BPL has to be visible