delphi

Is it memory safe to provide an object as a function result?

Here I provide simple piece of code. function GetStringList:TStringList; var i:integer; begin Result:=TStringList.Create; Result.Add('Adam'); Result.Add('Eva'); Result.Add('Kain'); Result.Add('Abel'); end; procedure ProvideStringList(SL:TStringList); var i:integer; Names:TStringList; begin Names:=TStringList.Cre...

Delphi 7 and Vista/Windows 7 common dialogs - events do not work

I'm trying to modify the Delphi 7 Dialogs.pas to access the newer Windows 7 Open/Save dialog boxes (see Creating Windows Vista Ready Applications with Delphi). I can display the dialogs using the suggested modifications; however, events such as OnFolderChange and OnCanClose no longer function. This appears to be related to changing t...

Why use exception handling in apparently "safe" code?

Please, may somebody explain me, what can raise an exception in this code? function CreateBibleNames: TStrings; begin Result := TStringList.Create; try Result.Add('Adam'); Result.Add('Eva'); Result.Add('Kain'); Result.Add('Abel'); except Result.Free; raise; end; end; Since I use delphi I have use...

Delphi OnClick Problem with Multiple Units

When I make a dynamic component from unit I have no problem creating the OnClick event. When I make a dynamic component from unit 2 I am unable to access the OnClick event. unit Unit1 type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public Proc...

JSplitPane analogue for Delphi

Can someone point to good delphi component that is an analogue for java JSplitPane. I know about standard TSplitter in Delphi, but I sick and tied of using it. ...

Closing a secondary delphi form causes the main form to lose focus

When showing a secondary form from the main form and from the second form showing a third form and then closing both forms will cause the main form to lose focus. Using Delphi 2009 with XP SP3 Here are my steps for reproducing the problem: Create a new VCL forms applications Drag a button onto the created form In the click handler cr...

ShareMem/ string-exchanging with Delphi DLL

Quick one I hope - I'm just about to delve into a Delphi 5 legacy app that makes calls to a DLL (also written in D5), passing a string which the DLL can modify if required. I have the code to both the DLL and the app. Pasted right at the top of the DLL source is a remark about using ShareMem, and it needing to be the first line in the ...

How to get enumeration type into stringlist?

This single line of code: ShowMessage(GetEnumName(TypeInfo(TAlign), 1)); returns "alTop". How can I get all values of enumerated type into stringlist, when I want to use string variable: 'TAlign' instead of TAlign? Something like: ShowMessage(GetEnumName(TypeInfo('TAlign'), 1)); Thanx ...

Why does building with runtime packages make the EXE file smaller?

I have a query about the option in Delphi to build with or without runtime packages (Project->Option->Packages). The executable file size seem to be smaller (389KB) when I checked the box "Build with runtime packages" compared to when I uncheck the box (3,521KB). Why is that the case? I am having so much trouble building an installation...

Are parameters of TWebModule event handlers global?

I'm using the TWebModule component to write a web server application with Delphi. Clicking on the Actions property of the TWebModule a new action can be defined and a "OnAction" event handler created. For example: procedure TMainWeb.MyAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin ...

WinInet google maps data api receive error Invalid Token

I am trying to login to Google maps data API (get MyMaps) with wininet and delphi but always recevied response: Invalid Token. I have gotten auth toke with wininet HTTPS call. What's the problem ? Please help.Here a example code : ServerURL='maps.google.com'; pathURL='/maps/feeds/maps/default/full'; headers='Authorization: Googl...

Delphi - Creating controls before form Create is run?

Well, my problem is as follows: I have a Delphi 5 application that I'm essentially porting to Delphi 2010 (replacing old components with their latest versions, fixing the inevitable Ansi/Unicode string issues, etc.) and I've run into kind of a hitch. Upon creation of one of our forms, an access violation happens. After looking it over,...

Example for DevExpress QuantumGrid Master-Detail

Hi, Where can I find a basic example of using QuantumGrid 6 of Developer Express in a Master-detail relation. Thanks in advance. ...

Processes timing

How to calculate the total execution time of each application Win (process) with the group on day. For example: the process - notepad.exe - 10 minutes today (in total) ...

What bookkeeping data does a Delphi dynamic array contain?

Here's a simple program to check memory allocation. Checking before and after values with Task Manager suggests that each dynamic array takes up 20 bytes of memory at size = 1. The element size is 4, which means 16 bytes of overhead for bookkeeping data. From looking through system.pas, I can find an array length field at -4 bytes, an...

Problem adding lots of strings to a TStringList

Hello!!! I have a problem adding strings to a TStringList. I've searched other posts but couldn't find an answer to this. What I'm trying to do is to add a big amount of strings to a TStringList (more than 14000) but somewhere in the process I get an EAccessViolation. Here's the code I'm using: procedure TForm1.FormCreate(Sender: TOb...

Handles being released corrupted somehow?

Strange problem. Maybe someone can give some insight. Scenario 1. I have a TBitmap in memory that is written to while complex calculations take place to calculate the color of each pixel. Every so often (usually after every horizontal line that the bitmap is filled) the TBitmap is drawn to an image on a form (image1.Canvas.Draw(0, 0...

Modify a Delphi DFM resource to close upon showing?

Is it possible to edit a DFM (Delphi's form script format) in such a way that a form closes itself when shown? I don't code in Delphi, so I'm not familiar with how these forms work, but it seems I could put code (but not standard Delphi code as it seems) in the OnShow or OnCreate events of the form. However, after trying several stateme...

What is the preferred method of passing data between a service and an application

Possible Duplicate: Delphi 2009: How to communicate between Windows service & desktop application under Vista? I have a server running as a Windows service. To control the service and to display it's state I have an application running as a tray icon. I would like to pass data (log strings) from the service to the application. ...

How do you quickly check if a network location exists using Delphi 5?

Possible Duplicates: Speed up File.Exists for non existing network shares Faster DirectoryExists function? We need to write text to a file on our network, but there may be a situation where that location does not exist and we need to write to another location instead. How do you check quickly that a network location exists? At...