delphi-xe2

F2047 Circular unit reference

*爱你&永不变心* 提交于 2021-02-05 07:15:48
问题 i working with overload of operator, and i have this situation, fra a side: unit _TIns; interface uses _TExtract; type TIns = record private type TInsArray = array [1..90] of Boolean; var FInsArray: TInsArray; public class operator Implicit(const Value: TExtract): TIns; class operator Implicit(const Value: TIns): TExtract; end; implementation // Code end. and, from other side: unit _TExtract; interface uses _TIns; type TExtract = record private type TExtractEnum = 1 .. 90; var FExtractEnum:

F2047 Circular unit reference

[亡魂溺海] 提交于 2021-02-05 07:12:06
问题 i working with overload of operator, and i have this situation, fra a side: unit _TIns; interface uses _TExtract; type TIns = record private type TInsArray = array [1..90] of Boolean; var FInsArray: TInsArray; public class operator Implicit(const Value: TExtract): TIns; class operator Implicit(const Value: TIns): TExtract; end; implementation // Code end. and, from other side: unit _TExtract; interface uses _TIns; type TExtract = record private type TExtractEnum = 1 .. 90; var FExtractEnum:

How to create a parameter of type PSafeArray?

允我心安 提交于 2021-01-29 03:14:50
问题 How to create a parameter of type PSafeArray? I take the following error from C# COM library: SafeArray with range 65262 transfered to the method that requires array with range 1 Delphi XE2 should call C# COM library procedure using Generated RIDL type-library with a parameter of type PSafeArray. Delphi XE2 code: function GetObjects: PSafeArray; var aObjects: Variant; begin aObjects := VarArrayCreate([0, 2], varVariant); aObjects[0] := ADOConnection.ConnectionObject; aObjects[1] :=

Why do I get the error Missing implementation of interface method in Delphi XE2?

落花浮王杯 提交于 2021-01-28 19:24:24
问题 Consider the following code: uses {... } ComObj, ShlObj; type TContextMenu = class(TComObject, IShellExtInit, IContextMenu) private {(*} const GUID: TGUID = '{99D8B139-0855-4C5D-95E7-BC8EC6254B3D}'; {*)} private FCmdCount: LongWord; FDm: Tdm_ContextMenu; protected function IShellExtInit.Initialize = IShellExtInit_Initialize; function IShellExtInit_Initialize(_pidlFolder: PItemIDList; _lpdobj: IDataObject; _HKeyProgID: HKEY): HResult; stdcall; function QueryContextMenu(_Menu: HMENU; _indexMenu

Can I restrict (compile or runtime) a generic to being an array [0..n] of char

守給你的承諾、 提交于 2021-01-28 03:30:36
问题 I have a program with a lot of structures defined as static arrays of char and records (usually consisting of arrays of char, but that's not so important). I am trying to create a generic interface for these structures, so they can be passed to a back-end C DLL. I am able to handle all types of records by using the <T: record> constraint, but array[0..n] of char falls foul of the 'non-nullable value type' rule. I can use unconstrained generics by declaring types for my different static arrays

Can I restrict (compile or runtime) a generic to being an array [0..n] of char

情到浓时终转凉″ 提交于 2021-01-28 02:14:11
问题 I have a program with a lot of structures defined as static arrays of char and records (usually consisting of arrays of char, but that's not so important). I am trying to create a generic interface for these structures, so they can be passed to a back-end C DLL. I am able to handle all types of records by using the <T: record> constraint, but array[0..n] of char falls foul of the 'non-nullable value type' rule. I can use unconstrained generics by declaring types for my different static arrays

Conditional Compilation in common unit depending from specific project?

荒凉一梦 提交于 2021-01-27 14:13:58
问题 In Delphi XE2, I have a unit MyUnit.pas which is used by two different projects ProjectA and ProjectB . MyUnit contains a statement DoSomething; (which is a procedure implemented in an other unit OtherUnit.pas ). Now I want to use Conditional Compilation to include DoSomething only in ProjectA compilation and not in ProjectB compilation, so to avoid ProjectB including/compiling OtherUnit.pas indirectly. This MUST be Conditional Compilation , as a simple if/else statement obviously does not

Save canvas as an image

烈酒焚心 提交于 2021-01-27 07:15:32
问题 I am writing a program using Delphi XE2. I draw some lines and shapes on a Canvas. I want to save that Canvas as an image file using a save dialog. So I have a save button on my form and by clicking it, it opens the save dialog. How should I proceed to be able to save the Canvas? 回答1: At the moment you most likely have code in an OnPaint event for a TPaintBox or the form itself. That code might look like this: procedure TMyForm.PaintBox1Paint(Sender: TObject); begin with PaintBox1.Canvas do

Save canvas as an image

99封情书 提交于 2021-01-27 07:15:24
问题 I am writing a program using Delphi XE2. I draw some lines and shapes on a Canvas. I want to save that Canvas as an image file using a save dialog. So I have a save button on my form and by clicking it, it opens the save dialog. How should I proceed to be able to save the Canvas? 回答1: At the moment you most likely have code in an OnPaint event for a TPaintBox or the form itself. That code might look like this: procedure TMyForm.PaintBox1Paint(Sender: TObject); begin with PaintBox1.Canvas do