delphi-5

How to print TPanel contents?

佐手、 提交于 2019-12-07 13:41:52
问题 I have TPanel. On this Panel there is an TImage descendant , few other panels with controls, etc. In fact, picture contains some diagram, while additional panels with labels are created during runtime to provide user with additional info. Recently I was told, that it would be nice, if it was possible to print this panel, and have it on the paper just as it appears in form. Any clues, how to do it? 回答1: I found an old usenet post that provides a solution, by copying the contents of the panel

How to debug division by zero exception in Internet Explorer?

好久不见. 提交于 2019-12-06 19:25:30
问题 i am hosting Internet Explorer in a Windows application. i can scroll down to the bottom of the document. When i then try to scroll back up i get a division by zero exception : When i scroll using Page Up the crash appears to happen at the call to - IOleInPlaceActiveObject:TranslateAccelerator When i scroll using the mouse the crash happens during the call to DispatchMessage Either way, the crash is happening in Internet Explorer. The stack trace shown by Delphi at the time of the exception:

How to convert float or currency to a localized string?

一世执手 提交于 2019-12-06 17:30:41
问题 In Delphi 1 , using FloatToStrF or CurrToStrF will automatically use the DecimalSeparator character to represent a decimal mark. Unfortunately DecimalSeparator is declared in SysUtils as Char1,2: var DecimalSeparator: Char; While the LOCALE_SDECIMAL is allowed to be up to three characters: Character(s) used for the decimal separator, for example, "." in "3.14" or "," in "3,14". The maximum number of characters allowed for this string is four, including a terminating null character. This

How to get selected cells from TDBGrid in Delphi 5

跟風遠走 提交于 2019-12-06 13:30:47
问题 I have a DBGrid on a form and I have made multiple selections, I now need to send the selected cells (they are email addresses) to the "TO Box" of Outlook how can I do this, I will appreciate any help ( Delphi5) Thanks in advance 回答1: To get list of selected E-Mails you can use this procedure. For outlook you might want to use shellexec and mailto: or use API if there's any. var i: Integer; S: TStringList; begin S:=TStringList.Create; if DBGrid1.SelectedRows.Count > 0 then begin for i:=0 to

BDE, Windows 7 and UAC

走远了吗. 提交于 2019-12-06 12:36:00
I have a very old application written in delphi 5 running in some customers which uses the BDE. Now some users with Windows Vista and 7, had experimented some problems with the multiuser access. i' think which these problems are related to the location of the net .and .lck files. so the question is which is the proper way to confgure the BDE under Windows Vista and 7 to avoid permissions and UAC conflicts? In addition to the above answer, you'll want to make sure that the .net and .lck files are located in a user-specific directory under Windows 7, specifically: C:\Users\{User Name}\AppData

Does Delphi assign the variable before the object is constructed?

青春壹個敷衍的年華 提交于 2019-12-06 02:32:48
问题 Does Delphi assign an instance variable before the object is fully constructed? In other words, given a variable: var customer: TCustomer = nil; we then construct a customer and assign it to the variable: customer := TCustomer.Create; Is it possible that customer can be not nil , but not point to a fully constructed TCustomer ? This becomes a problem when performing lazy initialization: function SacrifialCustomer: TCustomer; begin if (customer = nil) then begin criticalSection.Enter; try

How to print TPanel contents?

跟風遠走 提交于 2019-12-05 22:02:17
I have TPanel. On this Panel there is an TImage descendant , few other panels with controls, etc. In fact, picture contains some diagram, while additional panels with labels are created during runtime to provide user with additional info. Recently I was told, that it would be nice, if it was possible to print this panel, and have it on the paper just as it appears in form. Any clues, how to do it? I found an old usenet post that provides a solution, by copying the contents of the panel to a bitmap, which can be printed: procedure TFormPrintWindows.ButtonPrintPanelClick(Sender: TObject); var

How to render WebBrowser to device context?

给你一囗甜甜゛ 提交于 2019-12-05 19:17:27
问题 i want to render a web-page (i.e. TWebBrowser ) to a device context. i want to use Internet Explorer's layout engine to render content to a device context (i.e. metafile, pdf metafile). Starting with Internet Explorer 9 the IHTMLElementRender interface is no longer supported : IHTMLElementRender interface Use this interface to draw the contents of an element to a specified device context, normally a printer. Members The IHTMLElementRender interface inherits from the IUnknown interface but

Delphi “default” keyword with Record types in older Delphi versions

时光怂恿深爱的人放手 提交于 2019-12-05 05:48:21
I have this code in Delphi Detours library which I'm trying to port: type TInstruction = record Archi: Byte; { CPUX32 or CPUX64 ! } AddrMode: Byte; { Address Mode } Addr: PByte; VirtualAddr: PByte; NextInst: PByte; { Pointer to the Next Instruction } OpCode: Byte; { OpCode Value } OpType: Byte; OpKind: Byte; OpTable: Byte; { tbOneByte,tbTwoByte,... } OperandFlags: Byte; Prefixes: Word; { Sets of Prf_xxx } ... end; var Inst: TInstruction; begin ... Inst := default (TInstruction); // <- Inst.Archi := CPUX; Pvt := PPointer(AIntf)^; // vTable ! PCode := PPointer(Pvt + Offset)^; // Code Entry !

DUnit: How to run tests?

会有一股神秘感。 提交于 2019-12-05 01:34:55
How do i run TestCase 's from the IDE? i created a new project, with a single, simple, form: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) private public end; var Form1: TForm1; implementation {$R *.DFM} end. Now i'll add a test case to check that pushing Button1 does what it should: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var