delphi

Including client files for shared file

Okay, so I have 2 projects for a game. One is the server and one is the client. I keep the shared units into a shared folder that I use to include in my client/server project. There is a problem however: I have a shared file that needs a different file for client / server. Example: mySharedLib needs to print to the console, however the c...

problems opening a form with a predefined tabsheet

The following code works ! with pagecontrol1 do begin case Myindex of 0: activepage := tabsheet1; 1: activepage := tabsheet2; 2: activepage := tabsheet3; end; end; show; The following code does not work with pagecontrol1 do begin case Myindex of 0: activepage := tabsheet1; 1: activepage := tabsheet2; 2: ...

Delphi - How to get list of USB removable hard drives and memory sticks?

In my application (Delphi), I need to list all the USB storage devices. These can be either flash memory sticks or external storage drives. There is a Jvcl component JvDriveCombo, and it has the DriveType property - the problem is if I select 'DriveType := Fixed' then in addition to the external drive, it also lists the internal drives...

Delphi: Debug critical section hang by reporting call stack of running threads on lock "failure"

I'm looking for a way to debug a rare Delphi 7 critical section (TCriticalSection) hang/deadlock. In this case, if a thread is waiting on a critical section for more than say 10 seconds, I'd like to produce a report with the stack trace of both the thread currently locking the critical section and also the thread that failed to be able ...

What is the universal newline for all operating systems? (LF and CR)

When I write a file using Delphi it's on a Windows machine and the text files it puts out work fine on windows. When I use it on a Mac though it's expecting the formatting to be a bit different. On Mac the newline is different and it can't always read the Windows files. How can I make my files readable by mac programs? ...

Delphi and PowerPoint

Hello everyone I noticed that when I install Delphi(6,7,2000,2010), I have the option to install powerpoint control(com) related the Delphi. I hope to know, if the version of PowerPoint has any limitation. For example, PowerPoint 97 can not open the file PowerPoint XP? or is there a way for Delphi can open and play any version of Power...

How can I sort a TList in Delphi on an arbitrary property of the objects it contains?

I have a TList. It contains a collection of objects of the same type. These objects are descended from a TPersistent, and have about 50 different published properties. In my application, the user can issue a search of these objects, and the results of the search are displayed in a TDrawGrid, with the specific columns displayed being...

How to call the OnChange event of "Select" ? (Delphi - WebBrowser)

Hello , I'm using Delphi and WebBrowser componenet to navigate a html page . the page have a Combobox . is there any way to call the OnChange event ? The ComboBox is like this : <select name="comboname" onchange="Some Javascript codes"> Also , i have used this code : function TFrmMain.SetComboboxValue(WB: TEmbeddedWB; SelectName,...

How to remove duplicate resources (RES, DFM) while using Delphi with non specific Library paths?

I followed the advice received in a previous discussion ( http://stackoverflow.com/questions/3666292/should-library-path-point-to-the-source-files-of-packages/3686542#3686542 ) and now my Library Path points to folders containing the compiled code (DCU) and NOT to the source code of my controls. The problem is that I have to duplicate th...

How do I code a property with sub-properties?

For instance, like Font. Can anyone give a very simple example? Maybe just a property with two sub-properties Edit: I mean that when I look at Font in the object inspector it has a little plus sign which I can click to set font name "times new roman", font size "10", etc. Sorrry if I use the wrong terms, that is what I menat by "s...

How to avoid including standard interfaces in type library

In my ATL project I have an interface that looks like this interface IGenericDecorator : IUnknown { HRESULT CreateInternalObject([in] IClassFactory* pClsFactory); }; After I build the project I see definition of IClassFactory included in the type library. How can I avoid this? I don't need IClassFactory to be defined in my type ...

Programming JNI with Delphi

Can I use Delphi to program to the Java Native Interface? From reading Essential JNI it seems possible if you make sure you are using the C calling convention. Anyone done this before? I would appreciate tips on tools that will help e.g. a tool to convert the C header file of Javah to Delphi. ...

How can I programmatically save event handler and then set it in C++ Builder?

I need to temporary remove TFrame's OnExit and OnEnter events, so I'm trying to do following: declare FEnterHandler and FExit Handler: private: // ... TControl *FParentControl; (__fastcall *(__closure)(TObject*))(TObject*) FEnterHandler; (__fastcall *(__closure)(TObject*))(TObject*) FExitHandler; // ... and I inte...

Are procedural variable and anonymous function equivalent when there's no outer context?

I understand that there are special actions to maintaining the lifetime of a outer variable when it was mentioned inside an anonymous procedure. But when the anonymous procedure doesn't use outer variables, will it generate the same assembly call as the good old general procedure. In other words, will the internals of the anonymous funct...

Bitwise flags in Delphi

I need to check if a certain flag is set for an integer. I already know how to set a flag: flags := FLAG_A or FLAG_B or FLAG_C But how can I check if a certain flag is set? In C++ I used the & operator, but how does that work in Delphi? I'm a bit confused at the moment ...

Is there a way to do normal logging with EureakLog?

I am using (and old version of) EurekaLog. It is great for logging exceptions, but is there a way to make it just log things normally? Or is it just not meant for that? ...

Substring algorithm suggestion

I have a large set (100k) of short strings (not more than 100 chars) and I need to quickly find all those who have a certain substring. This will be used as a search box where the user starts typing and the system immediately gives "suggestions" (the strings that have as a substring the text that the user typed). Something similar to th...

Performing an action when the application is idle

I have a very simple application with a form, a richedit and a menu. I'm trying to automatically save the text on the richedit and perform other tasks but only when the application is idle - when the user is not writing or the app loses focus or whatever. I tried creating an OnIdle event handler from a gazillion sample codes found on th...

Delphi + webcam

hi! I am looking for a way to use my webcam in delphi, primary for grabbing a picture, by some reason I cannot use TWAIN drivers. ...

Move() to Insert/Delete item(s) from a dynamic array of string

Using System.Move() to insert/delete item(s) from an array of string is not as easy as insert/delete it from other array of simple data types. The problem is ... string is reference counted in Delphi. Using Move() on reference-counted data types needs deeper knowledge on internal compiler behaviour. Can someone here explain the needed s...