Delphi

move project into dll

半世苍凉 提交于 2020-01-01 19:52:09
问题 i moved my project into a DLL and in there I declared a procedure like this procedure StartApp; var myForm : TmyForm; begin myForm:=TmyForm.Create(Application); myForm.Show; end; exports StartApp; my main application's contains a dpr file containing: procedure StartAPP; external 'myDLL.dll'; begin StartAPP; end; when i run my project it opens myForm and then it exits my application. Can anyone tell me what i have done wrong? 回答1: Your procedure in the dLL is showing a non-modal form, in your

Delphi - Simple TCP client / server using Indy to check clients status

ぃ、小莉子 提交于 2020-01-01 19:29:07
问题 I started playing with Indy 10 (from Delphi XE3) and TCP connections recently. For now, I am trying to create a simple server application to check clients status. But when I try to deactivate TCPServer with some client already connected, clients do get disconnected but TCPServer stops answering. I read somewhere that TCPServer should handle client's disconnection without problems. Must I add some code on OnExecute event to solve this problem? Here is the code: procedure TfrmMain

GetKeyState in firemonkey

最后都变了- 提交于 2020-01-01 19:20:08
问题 In VCL (Delphi 2010) I used this function to check whether control key is pressed: function IsControlKeyPressed: Boolean; begin Result := GetKeyState(VK_CONTROL) < 0; end; GetKeyState is function in windows library that I do not want to include it into my project. How can I check if control or shift key is pressed in XE3 for firemonkey application? 回答1: If it helps for anyone else, this is my unit: unit uUtils; interface uses {$IFDEF MSWINDOWS} Winapi.Windows; {$ELSE} Macapi.AppKit; {$ENDIF}

How to get timeleft in Timer? [duplicate]

房东的猫 提交于 2020-01-01 19:15:31
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Delphi Timer: Time before next event How to get current timeleft when timer will be executed ? for example: I create a timer with interval 60 000 procedure TForm1.my_Timer(Sender: TObject); begin // do something end; Then I create another timer (interval 1000) which reason is to get the timeleft of the first timer procedure TForm1.second_Timer(Sender: TObject); begin second_Timer.Interval := 1000; Label1.Caption

How can I restart a Windows service application written in Delphi?

一笑奈何 提交于 2020-01-01 19:12:12
问题 I have a Windows service written in Delphi. One of the third-party resources it uses occasionally gets corrupted, and the only way I've found to fix the situation is to exit and restart the program. I can detect when the resource is corrupted from within the program, and I can tell Windows to restart the service after it stops, but I can't figure out how to have the service tell itself to stop. The program is pretty simple. I created a service application in what seems to be the normal way. I

How do I fix Delphi Prism ASP.NET error: “Parser Error Message: 'Oxygene' is not a supported language”

a 夏天 提交于 2020-01-01 19:00:50
问题 I have written an ASP.NET web application (not site) in Delphi Prism. Everything works fine on my devlopment machine, but when I install it on a test server I get the following error: Server Error in '/MyApp' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: 'Oxygene' is not a supported language.

Delphi XE: idHttp & Request.Range, a bug?

青春壹個敷衍的年華 提交于 2020-01-01 18:16:13
问题 I have Delphi XE. I try to set Request.Range of idHttp but I cannot do this. Delphi doesn't allow me to do this neither at design time nor at run time. E.g. I set '6000-' in a design time -> a property gets empty all time. I do (in a thread): Downloader.Request.Range:=(IntToStr(DFileStream.Position) + '-'); synchronize(procedure begin showmessage(Downloader.Request.Range) end); showmessage(Downloader.Request.Range) shows me nothing (an empty string). I checked a request in HTTPAnalyzer -> my

Scan all classes for a given custom attribute

ぃ、小莉子 提交于 2020-01-01 17:28:06
问题 I'm looking for a way of scanning all loaded classes for classes which contain a custom attribute, if possible, without using RegisterClass(). 回答1: at first you have to create TRttiContext , then get all loaded classes using getTypes . after that you can filter types by TypeKind = tkClass ; next step is to enumerate attributes and check if it has your attribute; attribute and test-class delcaration: unit Unit3; interface type TMyAttribute = class(TCustomAttribute) end; [TMyAttribute] TTest =

File Open Dialog with Encodings combobox under Vista

╄→尐↘猪︶ㄣ 提交于 2020-01-01 17:14:12
问题 I currently use the TOpenTextFileDialog as it has the Encodings option, but under Vista it appears using the older open dialog style. I'd like the new style open dialog, but with an encoding combobox that I can fill with custom strings. Basically I want the exact open dialog that Notepad shows under Vista. Of course I also need the corresponding save dialog as well. I've done some research and it seems that the OFN_ENABLETEMPLATE flag causes the Vista common dialog to fall back to the old

HTTPRio.HTTPWebNode.OnBeforePost changed in Delphi 10.3, lost parameter Data

馋奶兔 提交于 2020-01-01 16:56:33
问题 I have a component that uses HTTPRio.HTTPWebNode.OnBeforePost that previously used the data parameter, but in version 10.3 of Delphi this parameter was replaced. Before Delphi 10.3: procedure TNotaBlu.BeforePostHTTPRequest(const HTTPReqResp: THTTPReqResp; Client: THTTPClient); var Certificado: ICertificate2; CertContext: ICertContext; PCertContext: Pointer; begin try Certificado := VCertificadoDigital.GetCertificate.DefaultInterface; CertContext := Certificado as ICertContext; CertContext.Get