delphi-2007

Why use string[1] rather than string while using readbuffer

Hi, I am having a record like this TEmf_SrectchDIBits = packed record rEMF_STRETCHDI_BITS: TEMRStretchDIBits; rBitmapInfo: TBitmapInfo; ImageSource: string; end; --- --- RecordData: TEmf_SrectchDIBits; If i am reading data into it by using TStream like this an exception is occuring SetLength(RecordData.ImageSo...

Migrate Delphi 2007 component to .NET

Hello everybody. I need some help. I have generated a component in Delphi 2007 Code Gear and I need to migrate it to .NET to be used by VB.NET platform. I generated an ActiveX dll but I have been told that only the declaration of the class is visible in .NET. Actually the component I have generated is inherited by another component o...

Initialise string function result?

I've just been debugging a problem with a function that returns a string that has got me worried. I've always assumed that the implicit Result variable for functions that return a string would be empty at the start of the function call, but the following (simplified) code produced an unexpected result: function TMyObject.GenerateInfo: s...

Delphi 2007 and Windows 7: Debugger fails to stop host application.

I'm running Delphi 2007 with Windows 7 Ultimate. The code I'm working on compiles to a DLL file. To use Delphi's debugger I launch a standard EXE application via Delphis' Run command. The application loads the DLL file and the debugger is automatically attached to the correct process. The problem occurs when resetting the host applica...

Stringlist with delimiter as a string ?

I have an attribute called HistoryText in a object that is stored as a string. I want to show all rows in a grid. I should be able to delete and edit rows in the grid. The format is: 16.5.2003-$-12:09-$-anna-$-Organization created 2.6.2005-$-13:03-$-jimmy-$-Organization edited 19.12.2005-$-13:33-$-madeleine-$-Organization edited So ea...

Delphi 2007 Visual Component

Hello, I have been making components for Delphi for a couple months now. Currently I am extending the TButton to create another form that has 20 or so components on it. I have done this recently and just created everything dynamically in click event. Is there a way to create to form and have it compiled into the component so I can ...

delphi new project not starting at form1

So this is just a pet peeve maybe but when I start delphi and start a new project just to test something out I expect it to be form1, unit1, etc. But its starting out new projects at form 2. How can I fix this? I suspected to find a default save space for projects but I did not. I am using delphi 2007 and windows 7. ...

delphi non visual component image

I am building a delphi non-visual component. How do I set the image I want it to have in the IDE? ...

Acquire PDF returned after Posting to a web site using TWebBrowser

I am using Delphi 2007. I can successfully Post data to a web site using WebBrowser.Navigate, but afterwards, when that site returns a PDF, while it appears on the screen of the Browser, I cannot figure out how to acquire the PDF programmatically. I can see some text and HTML using Document.Body.InnerHTML, but not the PDF. Can someone ...

Deadlock on tidtcpserver.active = false (Delphi2007/indy10)

I am having a problem with some code that was written by a developer that has now left our company, the code implements a tcpserver that responds to an XML based protocol. This appears to be working absolutely fine in our test environment but one or two customers are having problems with application shutdown. I have traced this to what...

How to deal with TcxCustomGrid-TcxCustomGrid Drag and Drop when I drag an object to the outside of the window?

I have a TcxGridDBTableView in a window, and dragmode is set to dmAutomatic. When I drag and drop a row above another, it works fine. But when i drag and drop a row to the outside of the window, I'm not getting to the TcxGridDBTableView's 'OnEndDrag' event. Ex.: procedure TfrmMyForm.cxGridDBTableViewEndDrag(Sender, Target: TObject; X,...

How to use a TcxCustomDataSource in a TcxExtLookupComboBox ?

I use a TcxExtLookupComboBox from Devexpress and try to implement a custom datasource. I have set the customdatasource like this: procedure TMainForm.FormCreate(Sender: TObject); begin fDataSource := TMyDataSource.Create; cbotestSearch.Properties.View.DataController.CustomDataSource := fDataSource; end; TMyDataSource is defined h...

What can cause SysFreeString to hit an Int 3 breakpoint?

I've got some code that worked fine under Delphi 2007 but breaks under D2010. It involves passing in a string, converting it to a PWideChar (specifically, a WideString pointer, not a UnicodeString pointer), doing some processing, and then calling SysFreeString on it. It works fine until a blank string is passed in, then SysFreeString b...

List search results in a combobox.

I want to change our search as it is a bit hacky now. Currently it works like this: User enter a text in a textbox, for example Volvo and start searching. This search with SQL all posts containing Volvo. The result is a list with 2 columns, BoldID and DisplayValue. BoldID is just an unique number to identify the object in datab...

How to return an error code with Halt(n) from an Exception block with D2007?

Update: It seems to be specific to D2007. It works in D2010 like it worked in older version. I would like to return an exit code depending on the type of Exception caught in the Eception Handler block like: program test; {$APPTYPE CONSOLE} uses SysUtils; var Exitcode: Integer; begin Writeln('Enter error code:'); Readln(Exi...

Can I pass an interface (IInterface) to a DLL?

I have got a DLL and a program, both written with Delphi 2007. The program passes an interface, which descends from IInterface and does not have a GUID (so no COM here) to the DLL which stores it for later use. This seems to work fine but sometimes I get access violations when the program is closed and the DLL is unloaded. I am not sure...

Interface method as event handler

Is it possible to use interface method as event handlers in Delphi 2007? The simple versions don't work: type TMyEvent = procedure of object; IMyInterface = interface procedure Handler; end; TMyClass = class(TInterfacedObject, IMyInterface) public procedure Handler; end; var ev: TMyEvent; obj: TMyClass; intf...

tIdHttpServer - EidConnClosed before sending a reply to POST

I am having trouble implementing a HTTP server with indy 10 in delphi 2007. I have set up a simple event handler for the CommandGet event. When replying to data sent using the GET method I can parse the params and send XML data back with no problems. (see code below) Download := ARequestInfo.Params.Values['dld']; Config := ARe...

How can I avoid refresh with TWebBrowser

I have a TWebBrowser component that show a Google maps page. The problem is that when user press F5 the page refresh and page reloads. This cause javascript variables to reinitialize and get out of sync with Delphi and a scripting error dialog appear, 'undefined' is null or not an object. I want to stop refresh from the user. I tried ...

gethostbyaddr too slow

Hi, I use the following code, results are correct, but gethostbyaddr takes around 30 seconds. function IPAddrToName(IPAddr: string): string; var SockAddrIn: TSockAddrIn; HostEnt: PHostEnt; WSAData: TWSAData; begin WSAStartup($101, WSAData); SockAddrIn.sin_addr.s_addr := inet_addr(PChar(IPAddr)); HostE...