delphi

How to have a program option set by an admistrator that the user can't change?

My application needs to read an option on startup to check if it should start in read-only mode. The option should not be allowed to be changed by the user. I usually do this now using a value set in the HKLM\Software section of the system registry. The administrator sets the value and the users can't change it (they don't have writ...

Why do I get an AccessViolation in Indy Sockets 9 IdTcpServer ServerExecute?

First Question: Is the following routine a correct implementation of an Indy 9 IdTcpServer.OnExecute routine? procedure TMyConnServer.ServerExecute(AContext: TIdPeerThread); var buffSize: integer; str: string; begin AContext.Connection.ReadFromStack(True, 600, False); buffSize := AContext.Connection.InputBuffer.Size; if ...

Build server: Best practices managing third party components ?

I'm maintaining a quite large legacy application. The source tree is a real mess. I'm trying to set up a build server. On the source tree, i've third party component with sources (also in the project's include path). These components are also installed within the IDE. My question is : How to manage those components ? I thought to man...

Empty strings in Delphi

Hi, my problem is as follows: WideCompareStr(FName,'')<>0 returns false even with FName set to ''. WideCompareStr(trim(FName),'')<>0 returns the desired result. Why do I have to trim an empty string ('') for a comparison with another empty sting to get the correct result? EDIT: to clear things up: I had the following Code to t...

Use a function from dll

I've a dll and a library file to use the Dll. In a file TOnPortStatusChanged = procedure (cardNo:integer; portNo:integer; newPortStatus:byte); stdcall; TOnPortDataReady = procedure (cardNo:integer; portNo:integer; dataBuff:PByteArray; buffLen:integer); stdcall; T_API_INIT_PARAMS = record OnPortStatusChanged :TOnPortStatu...

Can I use string "IsEmpty" methods in Delphi.

Embaracdero documents "IsEmpty" methods for string types, which I've used successfully with C++ Builder code. WideString s; if (s.IsEmpty()) .... I tried the same from Delphi, and couldn't get it to compile: var s: WideString; begin if s.IsEmpty then .... I know you can compare with an empty string, or call the Length func...

Where to start OOP in Delphi mainly focusing on database development?

I want to isolate database code from GUI design. For a reasonable time I've been reading/searching/skimming on topics like mgm/mvp/mvc/persistence/objects etc. I really have difficulty in designing a reusable object hierarchy/framework. Delphi is a great tool for RAD but when you want to work things out in a different way the documentat...

Delphi TOracleQuery Bind Variable

I am trying to call a query from Delphi 6 with bind variables, using the DOA component set's TOracleQuery object. I have 6 variable, 1 of which is a string (VarChar2 in Oracle lingo). I have tried calling query.DeclareVariable with the otVarchar2 enumeration, which intuitively makes sense, the otString enumeration (as the documentation r...

Process for localization of Delphi 2009 app by volunteer translators?

I have a freeware scientific app that is used by thousands of people in nearly 100 countries. Many have offered to translate for free. Now that D2009 makes this easier (with integrated and external localization tools, plus native Unicode support) I'd like to make this happen for a few languages and steadily add as many as user energy w...

Freeing multiple Objects in delphi

Below, I inserted a code written by Ray Konopka (part of the Coderage presentation). I am planning to use it, however, I am not sure how to clean (on the fly) multiple objects. All my attempts were unsucesfull and rendered memory leak. Any thoughts are appreciated. Thanks, program stringlistDictionary; {$APPTYPE CONSOLE} uses Cl...

Delphi 2009 documentation

does the new Delphi IDE (2009) come with some documentation ? (kind of like the MSDN with VS). where can you get it ? (want to have a look at it) is the documentation good ? i picked up a copy of Delphi in 21 days . is it good for beginners in Delphi ? ...

Where can I find many Delphi 7 packages?

For my program for auto installing Delphi 7 packages I need to find about 50 packages (for testing required time to install them to the palette). Maybe someone have many packages in archive and can upload it to the free file hosting or FTP server? ...

Delphi and SAPI

does anyone have a resource from where I can learn to use SAPI from Delphi ? how to use Speech Recognition from Delphi Applications ? thanks. ...

What's the better option?

procedure MyProc(Eval: Boolean); begin if not Eval then Exit; /* do stuff */ /* do more stuff */ end; OR procedure MyProc(Eval: Boolean); begin if Eval then begin /* do stuff */ /* do more stuff */ end; /* no Exit needed, but now we got what I think unp...

How do you set the Result value?

function MyFunc: Boolean; begin if eval then Result := True else Result := False; /* Note it's a fancy example, I know that in this case I can do: Result := Eval */ end; OR function MyFunc: Boolean; begin Result := False; if eval then Result := True; /* good by else statement */ end; ...

How list all instantiated objects?

How can I list all instantiated objects in all application, using FASTMM4 or default memory manager? ...

How do you skin Delphi components using graphic files?

Just like using CSS for Web applications, can we use graphics from clip art to skin buttons, edits, and form components without dealing with TCanvas or developing new components? Are there any fully free libraries to work with existing components? (No 3rd-party TSkinnedEdit etc.) ...

Is there a safe way to clean up stack-based code when jumping out of a block?

I've been working on Issue 14 on the PascalScript scripting engine, in which using a Goto command to jump out of a Case block produces a compiler error, even though this is perfectly valid (if ugly) Object Pascal code. Turns out the ProcessCase routine in the compiler calls HasInvalidJumps, which scans for any Gotos that lead outside of...

Delphi: Is it necessary to convert string to WideString?

I found a Windows API function that performs "natural comparison" of strings. It is defined as follows: int StrCmpLogicalW( LPCWSTR psz1, LPCWSTR psz2 ); To use it in delphi, I declared it this way: interface function StrCmpLogicalW(psz1, psz2: PWideChar): integer; stdcall; implementation function StrCmpLogicalW; e...

Comparing a pointer to function's value in Delphi

How can I compare the value of a variable that contains a pointer to a function with a function address? I'm maintaining some code, and it is failing in Delphi 2007. The declaration is: var EditorFrameWindow: Function: HWnd Of Object = Nil; In a form activation, I've got: procedure TEditForm.FormActivate(Sender: TObject); begin ...