delphi-2007

How to display a table in ShowMessage?

孤街浪徒 提交于 2021-02-18 12:59:31
问题 I am trying to display a table using ShowMessage that looks like this: short | Description for "short" verylongtext | Description for "verylongtext" How do I get two correctly aligned columns like that in a simple message dialog? I tried to align the columns using spaces, but the font of ShowMessage is variable. Then I tried to align them using tab characters, but I do not know how to calculate the proper tab count for each row. Is there a reliable way to calculate the tab count? PS: I would

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,

Why code in any unit finalization section of a package is not executed at shut down?

徘徊边缘 提交于 2020-06-25 18:46:25
问题 I have an application that uses statically-linked runtime packages as well as designtime packages that use them. For some reason the code in any unit finalization section is not being run at runtime (I can't tell when this started happening). finalization ShowMessage('Goodbye'); end. Shutting Delphi down shows the message, but not when my application shuts down. It gets weirder in that if I put a breakpoint on ShowMessage, it breaks there but does not execute the line. If there are multiple

How to load a TImage using task dialog common icons?

微笑、不失礼 提交于 2020-05-15 09:13:37
问题 I'm trying to load icons used by Delphi's task dialogs into a TImage control. As I've learned here, I'm using LoadImage function but icons appear lightly different from the ones which are used by the MessageDlg function. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public {

How to load a TImage using task dialog common icons?

女生的网名这么多〃 提交于 2020-05-15 09:09:12
问题 I'm trying to load icons used by Delphi's task dialogs into a TImage control. As I've learned here, I'm using LoadImage function but icons appear lightly different from the ones which are used by the MessageDlg function. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public {

The difference between PopupMenuItem Click and MouseOver

跟風遠走 提交于 2020-02-28 07:52:07
问题 When a Menu Item has a sub Menu hovering the mouse expands the sub-menu it fires a click event. Is there any difference between this click event and if the user actually clicks? I'm using a TPopupMenu as dropdown property of a cxButton. EDIT Delphi 2007 回答1: Not sure this will work with D2007; it does in D7. Can you try the following? type THackPopupList = class(TPopupList) private FActuallyClicked: Boolean; protected procedure WndProc(var Message: TMessage); override; public property

Why casting an open array parameter to an array type causes E2089 Invalid typecast?

和自甴很熟 提交于 2020-02-24 00:34:13
问题 I'm using Delphi 2007 (Pre generics) and I've defined many functions who can be used for all arrays of TObject 's descendants, example: function IndexOf(AArray : array of TObject; AItem : TObject) : integer; begin //... end; For passing them dynamic arrays of TObject 's descendants, I've defined an array type TObjectArray = array of TObject . In this way I can cast dynamic arrays and pass them to my functions without any problems: type TChild = class(TObject); ... procedure Test(); var Items

how connect excel 2007 for delphi7 [closed]

China☆狼群 提交于 2020-01-25 09:17:07
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I can connect with paradox base, oracle etc. Now I want to work with excel how can I do it ? 回答1: With ADO, you can set the connectionstring like this: ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data

Save Bitmap with transparency to PNG in Delphi 2007

断了今生、忘了曾经 提交于 2020-01-24 09:42:25
问题 I have a Delphi bitmap (32Bit) that has transparency information. I need to convert and save it to a PNG file while preserving the transparency. The tools I currently have are the graphics32 Library, GR32_PNG (by Christian Budde), and PNGImage (by Gustavo daud). What is the best way to do this? EDIT 1 : There is not just one color in my bitmap that's transparent but pixels with varying levels of transparency that needs to be preserved. EDIT 2 : I am getting my bitmap with alpha information by

Delphi 2007 : How to Set TSAWARE?

妖精的绣舞 提交于 2020-01-22 19:52:08
问题 In Delphi 2009 and up you can add this line to your project .dpr to set the TSAWARE PE flag in your application executable: {$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE} I thought (wrongly) that this syntax is not supported in Delphi 2007. I have an application that I cannot port from 2007 to a newer Delphi version just yet (the task is underway, but it will not be done in the next few months). Update it was simply that Windows must be added to the project .dpr also. 回答1: My