Delphi

SendMessageTimeout in Delphi XE4 64-bit produces Access violation

假装没事ソ 提交于 2020-02-03 18:54:09
问题 I want to Broadcast the change of a few environment variables in my program. So a few other utilities can make use of the new values. When I compile the next routine in Delphy XE4 32-bit on a Windows 7 platform, everything seems to work fine. When I switch in Delphy to the 64-bit platform, the debugger produces an Access Violation. Any suggestions? procedure BroadcastChange; var lParam, wParam : Integer; Buf : Array[0..10] of Char; aResult : PDWORD_PTR; begin Buf := 'Environment'; wParam := 0

How to access with ctypes to functions returning custom types coded in a Delphi dll?

不羁的心 提交于 2020-02-03 16:46:07
问题 I have a Delhi DLL that is exposing a function with the following signature: Function MyFunc(ObjID : Cardinal) : TMyRec; stdcall; where the records are defined so: type TMyRec = record Count : Cardinal; Items : array of TMyItemRec; end; type TMyItemRec = record ID : Cardinal; Params : array of String; end; Now my question is: how can I acces results of MyFunc calling the dll with Python ctypes? I coded two classes that mimic the types from ctypes import * class TMyItemRec(Structure): _fields_

How to access with ctypes to functions returning custom types coded in a Delphi dll?

折月煮酒 提交于 2020-02-03 16:45:31
问题 I have a Delhi DLL that is exposing a function with the following signature: Function MyFunc(ObjID : Cardinal) : TMyRec; stdcall; where the records are defined so: type TMyRec = record Count : Cardinal; Items : array of TMyItemRec; end; type TMyItemRec = record ID : Cardinal; Params : array of String; end; Now my question is: how can I acces results of MyFunc calling the dll with Python ctypes? I coded two classes that mimic the types from ctypes import * class TMyItemRec(Structure): _fields_

Get string return value from C DLL in Delphi

拜拜、爱过 提交于 2020-02-03 08:52:31
问题 I have a legacy DLL written in C that contains a function that returns a string, and I need to access this function from Delphi. The only info I have about the DLL is the VB declare for accessing the function: Public Declare Function DecryptStr Lib "strlib" (Str As String) As String I've tried the following without success: Declaration: function DecryptStr(s: PChar): PChar; cdecl; external 'strlib.dll'; Usage: var p1, p2 : pchar; begin GetMem( p1, 255 ); StrPCopy( p2, 'some string to decrypt'

Get string return value from C DLL in Delphi

余生长醉 提交于 2020-02-03 08:51:07
问题 I have a legacy DLL written in C that contains a function that returns a string, and I need to access this function from Delphi. The only info I have about the DLL is the VB declare for accessing the function: Public Declare Function DecryptStr Lib "strlib" (Str As String) As String I've tried the following without success: Declaration: function DecryptStr(s: PChar): PChar; cdecl; external 'strlib.dll'; Usage: var p1, p2 : pchar; begin GetMem( p1, 255 ); StrPCopy( p2, 'some string to decrypt'

Range Check Error and Delphi 7.0

回眸只為那壹抹淺笑 提交于 2020-02-03 05:38:06
问题 After spending a week checking and fixing my program for memory leaks through FastMM4, I finally test ran my program on a different PC. Now, I am getting "Range Check Error." I have spent hours researching online about this, but none of them seem to give me what I am looking for. My program was complied with the Runtime Error option Range Check. So, I know that's why I am getting the error, but I needed to know exactly why the error is raised. The program was compiled on XP with Delphi 7.0.

BCB 6.0真的是垃圾么?

扶醉桌前 提交于 2020-02-03 05:15:23
一不留神,看到这个玩意: BCB6.0是垃圾的二十条理由 。于是决心废话几句,我只针对他说的那二十条理由,至于后面的关于什么删帖子纭纭,我觉得私人恩怨还是不要跟技术撤上关系比较好。 1. IDE经常出现非法操作,有时重起动还会出错,需要重装BCB。 有意思的很,很多不太会电脑的朋友问我电脑出现问题了该怎么办的时候,我都告诉他们“重装系统!”我用BCB是从5.0开始的,由于受不了DELPHI那BT的OBJECT PASCAL语法,所以转用BCB。至今吧,遇到过不少次IDE出现非法操作,后来发现都是安装的一些插件与库没有配置合适造成的。当然,从新安装BCB可以解决,不过这似乎也是最笨的办法。 2. 自动完成和智能提示功能超慢,慢到可以去泡一杯咖啡。 自动提示是BCB受到指责最多的东西,我也没办法忍受。不过我一般都是将自动提示关掉。程序还是自己打的好,自动提示用得多了,离开IDE就不会写程序了,那样可就真成代码工人了。 3. 上面两个功能经常导致出错信息,最底下那相信息框动不动就弹出来。 “ 最底下那相信息框”这个描述好有意思,我怎么不记得有什么框? 4. VCL库里BUG无数,随便写个程序,用自带的内存检查工具一查就有内存泄露。 VCL库里BUG无数?要知道VCL库是从DELPHI那里来的,按照这个说法,其实DELPHI也是很烂喽。其实VCL库的封装非常不错,虽然灵活性比MFC差点

Interfaces with Generics - Setting to NIL

大城市里の小女人 提交于 2020-02-03 03:15:15
问题 I am trying to implement clear in the following example code in Delphi 2009. interface ... TFoo<T : IInterface> = class(TObject) FField : T; procedure Clear; end; ... implementation ... procedure TFoo<T>.Clear; begin // Line Below Results In // E2010 Incompatible types: 'T' and 'Pointer' FField := nil; end; ... I could understand the complie time error if "T" was not constrained. But since "T" must be an Interface, I would have thought this syntax would have worked. Is there away to set

Interfaces with Generics - Setting to NIL

浪子不回头ぞ 提交于 2020-02-03 03:15:06
问题 I am trying to implement clear in the following example code in Delphi 2009. interface ... TFoo<T : IInterface> = class(TObject) FField : T; procedure Clear; end; ... implementation ... procedure TFoo<T>.Clear; begin // Line Below Results In // E2010 Incompatible types: 'T' and 'Pointer' FField := nil; end; ... I could understand the complie time error if "T" was not constrained. But since "T" must be an Interface, I would have thought this syntax would have worked. Is there away to set

How to get the current project name in Delphi directories settings?

不打扰是莪最后的温柔 提交于 2020-02-02 14:53:26
问题 In the project directory settings, I often need to use the project name, say 'MyProject' , as part of the output paths. I would prefer to avoid hardcoding the project name in the settings. Is there a variable, like $(Config) and $(Platform) , to dynamically obtain the current project name (without extension)? 回答1: You can use $(SanitizedProjectName) for this purpose. Be aware that the debugger might not support that. 来源: https://stackoverflow.com/questions/58461383/how-to-get-the-current