delphi-2010

How to set event handlers via new RTTI? [D2010]

╄→гoц情女王★ 提交于 2021-02-19 03:19:29
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

How to set event handlers via new RTTI? [D2010]

巧了我就是萌 提交于 2021-02-19 03:19:19
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

How to set event handlers via new RTTI? [D2010]

*爱你&永不变心* 提交于 2021-02-19 03:18:56
问题 Playing with new RTTI module, I couldn't find a way to set an event handler with the new utilities. Trying something like this: LProp := TRttiContext.Create.GetType(Form1.ClassInfo).AsInstance.GetProperty('OnClick'); LProp.SetValue(Form1, {a TValue!}); SetValue needs a TValue passed but I've yet to find a way to represent a TMethod via a TValue. Any comments? ps. And a side question.. It seems prefixing RTTI variables with "L" is a convention (and a good one IMO, meta code turns into a puzzle

How to specify File Version when building EXE using MSBuild?

为君一笑 提交于 2021-02-16 15:15:08
问题 I'm trying to compile an EXE using MSBuild / Delphi 2010, I tried this: MSBuild.exe /t:Clean;Build /p:config=Release;ExtraDefines="CodeTest" /property:FileVersion=1.0.0.15 "D:\MyProject\MyFile.dproj" File is built but version isn't set What's wrong anyway? 回答1: Your property "FileVersion" is available inside the MSBuild session, but unless you have a Task or Target that uses it somehow, it's not being used for anything. You'll either need to (as DHeffernan says) create a version resource that

WinHTTP - The connection with the server was terminated abnormally

别来无恙 提交于 2021-02-10 18:52:54
问题 I import WinHTTP and try execute a request in a https url, like this: function TForm1.GetPage(AURL: String): String; var WinHttpRequest: IWinHTTPRequest; begin CoInitialize(nil); try WinHttpRequest := CoWinHttpRequest.Create; WinHttpRequest.Open('GET', AURL, False); WinHttpRequest.Send(EmptyParam); Result := WinHttpRequest.ResponseText; finally WinHTTPRequest := nil; CoUninitialize; end; end; It works in same pages (ex: https://www.google.com), but not in others (ex: https://sourceforge.net),

Delphi Writing to HKEY LOCAL MACHINE

这一生的挚爱 提交于 2021-02-08 07:42:01
问题 I have a back up application that I wrote and I need it to run on start up, always for all users. I want to use key := '\Software\Microsoft\Windows\CurrentVersion\Run'; Reg := TRegIniFile.Create; try Reg.RootKey:=HKEY_LOCAL_MACHINE; Reg.CreateKey(Key); if Reg.OpenKey(Key,False) then Reg.WriteString(key, 'Backup', 'c:\backup.exe'); finally Reg.Free; end; I have written a manifest and added it as a resource, It asks for admin privileges every time it runs. However, it is not adding the the reg

delphi - strip out all non standard text characers from string

此生再无相见时 提交于 2021-02-06 15:28:40
问题 I need to strip out all non standard text characers from a string. I need remove all non ascii and control characters (except line feeds/carriage returns). 回答1: Something like this should do: // For those who need a disclaimer: // This code is meant as a sample to show you how the basic check for non-ASCII characters goes // It will give low performance with long strings that are called often. // Use a TStringBuilder, or SetLength & Integer loop index to optimize. // If you need really

delphi - strip out all non standard text characers from string

五迷三道 提交于 2021-02-06 15:28:36
问题 I need to strip out all non standard text characers from a string. I need remove all non ascii and control characters (except line feeds/carriage returns). 回答1: Something like this should do: // For those who need a disclaimer: // This code is meant as a sample to show you how the basic check for non-ASCII characters goes // It will give low performance with long strings that are called often. // Use a TStringBuilder, or SetLength & Integer loop index to optimize. // If you need really

delphi - strip out all non standard text characers from string

两盒软妹~` 提交于 2021-02-06 15:27:28
问题 I need to strip out all non standard text characers from a string. I need remove all non ascii and control characters (except line feeds/carriage returns). 回答1: Something like this should do: // For those who need a disclaimer: // This code is meant as a sample to show you how the basic check for non-ASCII characters goes // It will give low performance with long strings that are called often. // Use a TStringBuilder, or SetLength & Integer loop index to optimize. // If you need really

delphi - strip out all non standard text characers from string

浪子不回头ぞ 提交于 2021-02-06 15:26:59
问题 I need to strip out all non standard text characers from a string. I need remove all non ascii and control characters (except line feeds/carriage returns). 回答1: Something like this should do: // For those who need a disclaimer: // This code is meant as a sample to show you how the basic check for non-ASCII characters goes // It will give low performance with long strings that are called often. // Use a TStringBuilder, or SetLength & Integer loop index to optimize. // If you need really