freepascal

Lazarus & Free Pascal - How to recursively copy a source directory of files to another directory?

≡放荡痞女 提交于 2019-12-04 19:12:42
I need to add some functionality to my Lazarus & Free Pascal GUI program - I need it to also copy files from a users chosen dir to another dir. I have a "Choose Source" TSelectDirectoryDialog button onclick event for the source directory and a "Choose Destination" TSelectDirectoryDialog button onclick event for the destination dir. I have a 3rd button to do the copying from Source to Destination. So far, I have found CopyFile that copies the files and the original date attributes, but it doesn't recreate the subdirectory structure of any subdirectories of the users chosen source directory. I

Is there a Template Engine like Velocity or Freemarker for Delphi? [closed]

两盒软妹~` 提交于 2019-12-04 12:33:58
问题 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 . For web applications, it would be helpful if Delphi object properties and methods could be "connected" with HTML code. This could be used in many ways, both during the HTML response build stage and the request processing stage: access a server-side object property value to output it in the HTML code bind a

What are the differences between implementation of Interfaces in Delphi and Lazarus (FPC)?

瘦欲@ 提交于 2019-12-04 05:12:51
We have a project full of custom components that today is working in Lazarus and Delphi. I'm thinking in code interfaces on it, but I am not much familiar with them. What I would like to know is: What are the implementation nuances from Delphi and Lazarus interfaces? There is something that I should be specially aware? Will I have to code really different things? Background explanation: I think the components could benefit from interfaces, or at least, I will learn more from them. For example, one of the components make communication to many different hardwares using serial port. But user

How to get Windows user privileges information with Lazarus/Free Pascal

做~自己de王妃 提交于 2019-12-03 20:42:07
Using Lazarus/Free Pascal, how can I get the user privileges of the user running my program (whether he's an Administrator, Regular user, or Guest)? As David says in a comment you can use the CheckTokenMembership function to determine the membership of an user account. check this sample which runs on FPC and Delphi. program Test; {$IFDEF FPC} {$mode objfpc}{$H+} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} uses SysUtils, Windows, Classes; Const SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)); SECURITY_BUILTIN_DOMAIN_RID = $00000020; DOMAIN_ALIAS_RID_ADMINS = $00000220;

Writing a Scheme interpreter with FPC: Recursive data structures

对着背影说爱祢 提交于 2019-12-03 17:33:53
Essentially, this is a question about recursive data structures in Pascal (FPC). As I would like to implement a Scheme interpreter like it is shown in SICP chapter 4, this question may be relevant for Schemers as well. :) S-expressions shall be represented as tagged data. So far, I have constructed a variant record, which represents numbers and pairs. Hopefully the code is readable and self-explanatory: program scheme; type TTag = (ScmFixnum, ScmPair); PScmObject = ^TScmObject; TScmObject = record case ScmObjectTag: TTag of ScmFixnum: (ScmObjectFixnum: integer); ScmPair: (ScmObjectCar,

How do install OmniPascal into vscode

我是研究僧i 提交于 2019-12-03 17:22:37
From the OmniPascal page on Visual Studio Marketplace : How to install Install Visual Studio Code and open it. Open View -> Command Palette... and type ext install OmniPascal Restart Visual Studio Code and open File -> Preferences -> User Settings Add the key "objectpascal.delphiInstallationPath" to the right editor and set its value to the Delphi installation path. Don't forget to escape the backslashes! Example: "objectpascal.delphiInstallationPath" = "C:\\Program Files (x86)\\Embarcadero\\Studio\\16.0", Except that seems to be wrong; it complains that it shouldn't be an = (equals) , but a :

Webview not displaying in MacOS using Delphi XE2

五迷三道 提交于 2019-12-03 14:17:40
问题 I have started to convert the Webview interfaces to be consumed in Delphi. I have managed to get the webkit library to load, and the interface methods that is called appears to work correctly, however, I cannot seem to display the Webview on the main form. Below is my interfaces that is declared WebFrameClass = interface(NSObjectClass) ['{7BE750C8-DFEC-4870-851A-12DBCB0B78F6}'] end; WebFrame = interface(NSObject) ['{BCFA04BE-41AB-4B78-89C0-3330F12C7695}'] procedure loadRequest(request:

Webview not displaying in MacOS using Delphi XE2

末鹿安然 提交于 2019-12-03 04:08:16
I have started to convert the Webview interfaces to be consumed in Delphi. I have managed to get the webkit library to load, and the interface methods that is called appears to work correctly, however, I cannot seem to display the Webview on the main form. Below is my interfaces that is declared WebFrameClass = interface(NSObjectClass) ['{7BE750C8-DFEC-4870-851A-12DBCB0B78F6}'] end; WebFrame = interface(NSObject) ['{BCFA04BE-41AB-4B78-89C0-3330F12C7695}'] procedure loadRequest(request: NSURLRequest); cdecl; end; TWebFrame = class(TOCGenericImport<WebFrameClass, WebFrame>) end; WebViewClass =

How to fix run-time error 201

会有一股神秘感。 提交于 2019-12-02 23:05:57
问题 help me, please. I don't know how to fix this error. Program Polynomial; type arrayOfInt = Array[1..21] of Integer; biggerArrayOfInt = Array[1..41] of Integer; function isNumber(c : Char): Boolean; var res : Boolean; code : Longint; begin code := Ord(c); if ((code > 47) AND (code < 58)) then begin res := true end else begin res := false; end; isNumber := res; end; function parsePolynomial(polynomial : String): arrayOfInt; var coeficients : Array[1..21] of Integer; number : Integer; coef :

Difference between armeabi and armeabi-v7a

白昼怎懂夜的黑 提交于 2019-12-02 22:15:07
As far as I can tell from the docs, the difference between the two supported flavors of ARM architecture in Android NDK is only in the set of supported CPU instructions. Is that really so? Is there no difference in calling conventions, or system call sequence, or something else? I'm wondering what will happen if I compile a module to an ARM object file (with a compiler other than NDK - Free Pascal specifically), specifying ARMv6 as the architecture, and then link it to both armeabi and armeabi-v7a shared libraries. The FPC bits are not supposed to perform neither system calls nor Java calls,