delphi

How to copy array?

Hello, I have such a basic problem in Delphi,I can't solve it. My Code: Note:DataR is local in the methods below,but usually it's a class var.Just for the concept it's local. class procedure TCelebrity.BeginRead(var input:Array of byte); var DataR:Array of byte; begin VirtualFree(@DataRead,High(DataRead),MEM_RELEASE); SetLength(D...

How to get the address of Result?

Hello, This is my function: class function TCelebrity.ReadArray<T>(length:integer): byte; var b:pointer; begin b := @Result; if IndexR + SizeOf(T) * length > High(DataRead) + 1 then raise Exception.Create('error'); Move(DataRead[IndexR],b,SizeOf(T) * length); Inc(IndexR,SizeOf(T) * length); end; IndexR is an integer,DataR...

D2009 TStringlist ansistring

The businesswise calm of the summer has started so I picked up the migration to D2009. I roughly determined for every subsystem of the program if they should remain ascii, or can be unicode, and started porting. It went pretty ok, all components were there in D2009 versions (some, like VSTView, slightly incompatible though) but I now ha...

Find the serial port settings in Delphi

Hi I have the need to find the Baud rate and other settings for a serial port, Looking about on the web, it looks like I should be using GetCommConfig, This returns a TCommConfig record with what I assume is the data I need. The problem is the function I wote returns the wrong values. The code below looks like it is working, but the bau...

MVP : other constructor's parameters than view and model ?

Hi all, I'm experimenting with implementing a lightweight mvp framework with Delphi 2009. Views are passive but supports databinding (via an interface property). I'm facing a dilemna: I've several very similar views/presenter/model triad, ie : order form and a customer form = behavior and logic is the same but the datasource for data...

SQL Return values in Delphi via ADO

Hi. Im having this function to determine weather a user exists in a database or not DM is my DataModule AQ_LOGIN an ADOQuery BENU is my Table filled with Users and their Password Here comes the code: function UserCheckExist(Login, pw: string): boolean; begin with DM do begin AQ_LOGIN.Close; AQ_LOGIN.SQL.Clear...

COM problem between Unmanaged C++ and Delphi

Hi I have a DLL in unmanaged C++ : EditArticleManagerFactory.h: class __declspec(dllexport) EditArticleManagerFactory : public NamedClassFactory<SCEditArticleManager>, public SCBLEditArticle:ICOMEditArticleManagerFactory { public: STDMETHODIMP CreateManager(BSTR bstrName, SCBLEditArticle::ICOMEditArticleManager** pEditArticleMan...

Why differ(!=,<>) is faster than equal(=,==) ?

Hello, I've seen comments on SO saying "<> is faster than =" or "!= faster than ==" in an if() statement. I'd like to know why is that so. Could you show an example in asm? Thanks! :) EDIT: Source Here is what he did. function Check(var MemoryData:Array of byte;MemorySignature:Array of byte;Position:integer):boolean; var i:by...

Convert a delphi TColor with PHP

I have some colors that seem to come from a Delphi TColor variable (e.g 8388608, 128, 12632256). I need to convert those colors to their rgb values with a PHP script. How can this be done in PHP? ...

How to inherit if the child class is TForm?

I admit this is the first time I use inheritance,so I might even have choosen the wrong way,that's why I'm here asking you. I wrote a Message Handler in my delphi application to catch the messages from WSAAsyncSelect() procedure FormMain.MessageHandler(var Msg:Tmessage); begin case WSAGetSelectEvent(MSG.LParam) of FD_READ: //OnSo...

How to create an instance of two classes at the same time?

Hello, This is my problem - shortly: var c1:TClass1; c2:TClass2; begin c1 := c1.Create; c2 := c2.Create; //<<Exception; end; Both classes inherit from TObject.If they don't inherit then I can't use the debugger in the class so I have to use TObject. My real problem is that I have to create the instance of the second class inside...

ImageList_Add returns -1 on PC controlled with pcAnywhere

One of our applications fails on computers that are controlled via pcAnywhere because the ImageList_Add() WinAPI function fails to add the image/mask after some time. The function returns -1 and the number of icons in the imagelist doesn't change. On all other computers this is no problem. What is interesting is that we can add 99 bitmap...

Delphi 2009 Handling of With

Anybody know what is different about Delphi 2009's handling of "with"? I fixed a problem yesterday just by deconstructing "with" to full references, as in "with Datamodule, Dataset, MainForm". Delphi 2006 and earlier applied "Close" to the Dataset. Delphi 2009 applied "Close" to the MainForm and exited the application! ...

How to get a stack trace from FastMM

I've noticed in this post that you can get stack trace out of FastMM to show what appears to be where the object was allocated. http://stackoverflow.com/questions/271850/how-to-track-down-tricky-memory-leak-with-fastmm I can't find any information on how to enable this in Delphi 2009. I have set ReportMemoryLeaksOnShutdown to true so ...

Abstraction in Delphi

Hello, If I have child class,the child class inherits all methods from the parent,but how do I use functions from the child class in the parent class? Is that what abstraction is? How do I accomplish it? My code: type cParent = class(TObject) private function ParentFunction:byte; function ChildFunction:byte;virtual;abstract; end; ...

Printing HTML, with faithful CSS formatting, from IE/Delphi?

I've got a small program that displays third-party generated HTML pages. It's really just a wrapper around a locked-down TWebBrowser component (which is just an IE wrapper, I believe). The client wants to print these pages now too - but the TWebBrowser print method doesn't render all of the CSS. For instance, where the client uses block...

Speech recognition with file as input

Possible Duplicate: speech recognition from audio file instead of microphone How can someone perform speech recognition with a file (.wav or .mp3) as input and using Delphi ? I want to use an audio file as input rather than the microphone. ...

Subversion Exclusive Checkout and Subversion Plugin for Delphi

Is there currently a feature that allows a exclusive checkout in SVN? and Is there a good plugin for Delphi that allows the access via IDE? ...

How to leak a string in Delphi

I was talking to a co-worker the other day about how you can leak a string in Delphi if you really mess things up. By default strings are reference counted and automatically allocated, so they typically just work without any thought - no need for manual allocation, size calculations, or memory management. But I remember reading once ...

Is the dif or patch adder for Delphi IDE, ie if someone makes patch and I want to add it to my project automatically?

Is there DIFF plugin availaple for Delphi? I need simple add diff or patch file to my project, replaceing the porject code, that was changed in the patch, but keeping also the old one incase of falling back to old file without the patch. ...