Delphi

Delphi (-XE) : casting to a record type with implicit conversion

倖福魔咒の 提交于 2020-01-02 04:40:10
问题 I have a record type with methods, representing an specific hardware measurement type, read from the instrument as a string. The record contains implicit coversion to (and from) a string. If I cast a string as a record type, it seems to work, but is this safe? That is, does casting a string to a record with implicit string conversion call the implicit conversion as per assigning a temporary value? var a: MeasurementRecord; // record type with implicit string conversion & decode methods b:

How to build android apk from command line?

让人想犯罪 __ 提交于 2020-01-02 04:37:07
问题 How can I build an APK file from the command line? I've tried MSBuild myProject.dproj /p:Config=Release /p:Platform=Android but no APK file is produced, only the .so file. 回答1: Some experimentation shows that the following aspects of the various proposed courses of action come into play for a more complete picture. When you create a new Delphi multi-target project (let's call it Foo) you have one MSBuild-compatible file created: the Foo.dproj Delphi project file. In the case of Android (the

Run normal Win32 applications in Docker for Windows

泄露秘密 提交于 2020-01-02 04:33:25
问题 I'm a little bit confused about the concept of Docker for Windows. Can I create a docker container for windows (and a windows host like Server 2016) and install a normal windows application into that container (simple: notepad.exe; advanced some more complex application programmed in Delphi)? And can I run this container on every Docker enabled (windows) Host? Does the container starts automatically the application inside? Or can a windows docker container only provide service or webbased

Skip welcome page in Delphi 2010? [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 04:12:05
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Embarcadero D2010 hide welcome page I have Delphi 2010. How do I skip the welcome page on startup and/or create a new project like Delphi 7? Thanks 回答1: Remove the package startpageide150.bpl from the registry at HKEY_CURRENT_USER\Software\Embarcadero\BDS\8.0\Known IDE Packages , and you will not get a welcome page. But you will still need to click File -> New -> Delphi VCL Forms application to create a new

Is a Delphi global procedure threadsafe

不羁岁月 提交于 2020-01-02 04:06:46
问题 If two or more threads call a standard Delphi/Pascal procedure (not a method of an object), is this threadsafe ? There is no instance data, just local variables in the procedure. My guess is that the local storage being used by one thread could be corrupted by the other thread. 回答1: Local storage is maintained on the stack, which is unique to each thread. If no global data is being manipulated by the routine, it is safe. 回答2: if only local vars you should be ok. if I were you I would test

How can I get source code of page thru WebBrowser-Control (ActiveX InternetExplorer)?

百般思念 提交于 2020-01-02 03:57:21
问题 How can I get source code of page thru WebBrowser Control (ActiveX InternetExplorer)? I have an xml document "foo.xml". var Web: TWebBrowser; begin ... Web.Navigate("foo.xml"); // How can I get source code thru WebBrower control<---- ... end; 回答1: In the DocumentCompleted event, look at the DocumentText property of the WebBrowser control. It should have the complete text of the loaded page. 回答2: IHTMLDocument2(Web.Document).Body.InnerHTML; This should return the source of the page. 回答3: I

Scrolling RichEdit without it having focus

半世苍凉 提交于 2020-01-02 03:54:06
问题 I need to scroll a RichEdit to the very end after a line is added. I have this RichEdit in a separate form, that I don't want to get focus at all. I tried often suggested solution: RichEdit.Lines.Add(someText); RichEdit.SelStart:=RichEdit.GetTextLen; SendMessage(RichEdit.handle, EM_SCROLLCARET, 0, 0); But this doesn't work for me. However, when I focus the RichEdit before calling the SendMessage using RichEdit.SetFocus; it works just fine. That, however, ruins my other needs for the app. I'm

Why do the System.IOUtils functions and TStreamReader use fmShareCompat?

萝らか妹 提交于 2020-01-02 03:50:29
问题 When I first saw the System.IOUtils unit with functions like TFile.ReadAllBytes and TFile.ReadAllText and the TStreamReader and TBinaryReader classes in System.Classes I was quite excited to have easy ways to read binary and text files. After using them for a while I noticed that the default share mode is implicitly fmShareCompat , since they all use TFileStream.Create , but do not explicitly specify a share mode. Since fmShareCompat is treated as fmShareExclusive on Windows this leads to

Delphi : Setting OnGetText Event Handler for fields of a dynamic query

折月煮酒 提交于 2020-01-02 03:37:08
问题 I want to set my own procedure to OnGetText event of fields in a dynamic query My procedure is like this : procedure TMainFrm.MyFieldGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin ... end; "...Captions" are String array constants I set the event handler in OnAfterOpen event of ADOQuery : procedure TImportFrm.ADOQueryAfterOpen(DataSet: TDataSet); var I : Integer; begin for I := 0 to ADOQuery.FieldCount - 1 do ADOQuery.Fields[I].OnGetText := MainFrm.MyFieldGetText; end;

Shouldn't calling Free on an object reference set to nil throw an Access Violation every time it is called?

倾然丶 夕夏残阳落幕 提交于 2020-01-02 03:14:07
问题 I'm getting access violations from the unit DBXCommon.pas (in Delphi XE). When I look at the code I see things like the following (at the exclamation marks): function TDBXConnectionFactory.GetConnection(const DBXContext: TDBXContext; const ConnectionProperties: TDBXProperties): TDBXConnection; var ConnectionBuilder: TDBXConnectionBuilder; DelegatePath: TDBXDelegateItem; Connection: TDBXConnection; CombinedProperties: TDBXProperties; begin //... ConnectionBuilder := TDBXConnectionBuilder