Delphi

How to determine whether a user account is a (indirect) member of an AD group?

元气小坏坏 提交于 2021-02-04 12:25:00
问题 How to determine whether a user account is a member of an AD group, especially when then user is not a direct member of the group An example: user1 is member of group1 group1 is member of group2 result of a (fictional) function call IsUserMemberOf('user1', 'group2') should be TRUE For .NET there is a solution: static bool IsUserMemberOf(string userName, string groupName) { using (var ctx = new PrincipalContext(ContextType.Domain)) using (var groupPrincipal = GroupPrincipal.FindByIdentity(ctx,

Call dotNET from Delphi and return a string

丶灬走出姿态 提交于 2021-02-04 11:30:24
问题 How does a Delphi application call an exported function (non-COM) dotNET assembly and have the function return a string? COM is not a possible solution for my particular application. I have control over both ends of the call. What I have tried so far - Delphi client side type TStrProc = procedure( var x: widestring); stdcall; function TryIt: string; var Handle: THandle; Proc: TStrProc; InData: widestring; OutData: widestring; begin Handle := LoadLibrary( 'DelphiToDotNet.dll'); if Handle = 0

Call dotNET from Delphi and return a string

Deadly 提交于 2021-02-04 11:30:06
问题 How does a Delphi application call an exported function (non-COM) dotNET assembly and have the function return a string? COM is not a possible solution for my particular application. I have control over both ends of the call. What I have tried so far - Delphi client side type TStrProc = procedure( var x: widestring); stdcall; function TryIt: string; var Handle: THandle; Proc: TStrProc; InData: widestring; OutData: widestring; begin Handle := LoadLibrary( 'DelphiToDotNet.dll'); if Handle = 0

Build event macros in Delphi XE

依然范特西╮ 提交于 2021-02-04 10:54:07
问题 According to Delphi's help file, when I open the dialog box to add build events to my project's options, the dialog box should show a list of macros (placeholders) that I can use on the command line for the build event. When I try this in Delphi XE, the list of macros is empty. The help file doesn't say which macros are available either (that I could find). So, which macros are available? Right now I need a macro for the full path to the compiled .exe file (post-build), and the full path to

PaClient error: E0002 Missing profile name

谁说我不能喝 提交于 2021-02-04 08:29:45
问题 I try to make an android application in delphi but when i build the project i get this error: [PAClient Error] Error: E0002 Missing profile name; use paclient -? for Help How can i fix this? 回答1: For building Android applications in delphi, you do not use the PAServer nor PAClient, so there is no profile: these are only needed for iOS or OS X development. To figure out what is calling PAClient and why the call fails, follow these steps: Run Delphi while the free Process Monitor from

Why UrlDownloadToFile::OnProgress always return ulProgress and ulProgressMax with the same value

余生颓废 提交于 2021-02-04 07:38:06
问题 This is my delphi code: TDownloadCallback = class(TInterfacedObject, IBindStatusCallback) private fOwner: TDownload; fUrl: string; public constructor Create(owner: TDownload; url: string); function OnStartBinding(dwReserved: DWORD; pib: IBinding): HResult; stdcall; function GetPriority(out nPriority): HResult; stdcall; function OnLowResource(reserved: DWORD): HResult; stdcall; function OnProgress(ulProgress, ulProgressMax, ulStatusCode: ULONG; szStatusText: LPCWSTR): HResult; stdcall;

【Delphi】 FMX 下 TImageList的使用方法:获取其中一张图片

余生颓废 提交于 2021-02-03 07:08:58
按照此前的VCL里使用TImageList非常简单,在IDE中添加好图片资源后,使用ImageList的GetBitmap或GetIcon即可获取图片,很好理解。 但是在FMX中,TImageList不是这样使用了,需要多一些步骤,下面一步一步来演示。 1.添加图片资源 首先添加一个TImageList控件,双击该控件来添加图片资源。 如上图,点击新建来增加Item(如Item 0,Item 1,这些Item名称是有作用的,在Item 0上选中后再单击一下可以修改名称), 双击Item 0,弹出新界面,选中一张本地图片,关闭窗口时自动会添加,如下图 回过头看看,刚才添加Item 时,所在的区域是叫Sources Of Images,这里正是和VCL使用差别的地方,如果想和VCL的TImageList使用方法接近,则可以直接在下面的 List Of Images区域里添加,在过程中会自动添加到Sources Of Images区域。 而如果先在Sources Of Images区域添加,则必须在List Of Images区域里点击新建按钮进行添加(此时Sources Of Images里选择哪个Item则自动添加对应的图片)。 2. 图片尺寸说明 在 Sources Of Images区域添加图片时,可以看到一个图片尺寸,而在List Of Images区域添加并选择后

关于 字符串的 存储和编码转换

試著忘記壹切 提交于 2021-01-30 14:52:43
http://www.2pascal.com/forum.php?mod=viewthread&tid=2621&fromuid=4 字符串 在 DELPHI 的移动版本中,只存在 string 这一种类型。 string 的编码是 unicode ,也就是过去的 WideString ,虽然官方说两者不天一样。其实效果是一样的。 但是字符串保存在内存中,或者保存在 文件中,不一定使用这个 unicode 编码。 特别是 记事本的默认保存。 你们可自己用记事本 另存为的 功能 来看看, 记事本提供了几种 文本的编码格式。 当选择非 ANSI 格式的时候。被保存的数据中,最前面会出现 BOM 这种数据。 不懂的去百度。 地球上所有的 正规 文本读写工具,都支持 BOM 。例如 记事本 新版本 DELPHI 以及 TStringList TMemo.Items TInifile 等。 但是也有一些工具 不支持 BOM。比如一些老外的开发工具,他们要求必须是 UTF8 编码,但是不能存在 BOM。 文本文件用 文件流 或内存流加载成流之后,和保存在文件中,没有任何区别。都是数据。 数据 是不考虑编码的。 数据 也不一定就是字符串。 当你 把一个 非 unicode 编码的字符串数据,强加给 string ,就会出现乱码。 但是,如果你将 数据先转码成 unicode 就不会出现 乱码了。

Delphi : SSL routines:SSL3_GET_RECORD:wrong version number

倾然丶 夕夏残阳落幕 提交于 2021-01-29 21:15:44
问题 I found several topics about the same problem but it didn't help me to resolve my problem. I'm trying to connect to a FTPS server (with Delphi 10.3) using this code: IdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); IdSSLIOHandler.SSLOptions.Method := sslvSSLv3; IdSSLIOHandler.SSLOptions.SSLVersions := [sslvSSLv2, sslvSSLv23, sslvSSLv3, sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]; IdFTP.IOHandler := IdSSLIOHandler; IdFtp.UseTLS := utUseExplicitTLS; IdFtp.DataPortProtection := ftpdpsPrivate;

FireDAC SQLITE : No such table column :PRAGMA_TABLE_INFO

假装没事ソ 提交于 2021-01-29 13:27:06
问题 i'm building app with delphi rio 10.3 with firedac sqlite3 pragma function not working with 'SELECT COMMAND' AS I Try Below: procedure Tamdf.Button31Click(Sender:TObject); begin MyFDQuery.Open('SELECT name FROM PRAGMA_table_info("DOCM")'); ShowMessage(MyFDQuery.Fields[0].AsString); end; i receive ERROR message :"ERROR: no such table column: PRAGMA_table_info.name" what i did wrong ? 回答1: With FireDAC you can use workaround with create temp table "table_info": MyFDQuery.Open( 'DROP TABLE IF