delphi

Synchronizing time, but ignoring time zones.

Hi, I have an application that I want to have a feature where it synchronizes the Windows system clock, but only setting the minutes, unless for example the system time is 13:58 and the time server is 14:02, in which case the hour should be changed too. The thing is, I don't want to use the time server hours/days etc because I want the...

Arithmetic with IPv6 addresses (large integers)

I'm working with IPv6 addresses in the form: FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF Internally, I store them in an array: TIp6Bytes = array [0..15] of Byte; I need to manipulate the IPv6 addresses in a number of ways including adding, dividing, multiplying etc. Can anyone suggest a good way to do this? I guess I should have mentio...

Saving and Stack Overflows

I'm having a problem saving a vary large database type in Delphi. It contains an array[1..3500] of TItem, which in turn has two arrays[1..50] and [1..20]. I get a stack overflow unless I set the variable as a Pointer and use the GetMem, FreeMem commands below, but then I can't save it. Code is below. procedure TDatabase.SaveDB; var ...

Saving a TObject to a File

How can one save an Object, in its current state, to a file? So that it can immediately be read and restored with all its variables. ...

Delphi: Show window without activation

I struggle to show a second form above the main form without losing focus. I have tried ShowWindow(second.handle, SW_SHOWNOACTIVATE), but the mainform loses focus. If I set Visible := false on the second window, the call to ShowWindow does not activate the second form, but the windows is empty when shown... Does anyone have a good reci...

Are there any local DB that support multi-threading?

I tried sqlite, by using multi-thread, only one thread can update db at the same time.. I need multi-thread updating the db at same time. Is there are any DB can do the job? ps: I use delphi6. I found that sqlite can support multi-threading, But in my test of asgsqlite, when one thread inserting, others will fail to insert. I'm ...

Is there a way to instantiate a class by its name in delphi?

I'd like to instantiate a class but I only have its name in a string. Is there a way? ...

LoadPackage calls initialize, but registerClass won't work.

I have a unit wich defines TBla and the following code in the initialize section: initialization RegisterClass(TBla); showMessage('registered'); This unit is inside a package. ok. In a button click on my app I have the following code: LoadPackage('C:\temp\testes_packs\pack1\Package1.bpl'); pc := GetClass('TBla'); if pc = n...

Monitor SQL queries executed by a Delphi application

I'd like to monitor SQL queries executed by my application while it runs. I'm using a dbExpress connection to an Oracle 11g database under Delphi 2007. This used to be possible under the BDE with the sqlmon.exe utility. Is there a similar utility for dbExpress? I've tried the Toad SQL Monitor, which logs two or three queries and then...

Automating Visual Studio from within Delphi and firing up a project item

Visual studio type library I'm trying from Delphi to open up Visual Studio (for editing SSRS reports), and load up a particular projectitem from a solution file I have autogenerated. I have imported the visual studio type library, and can create the object, and drill through the solution until I have the right ProjectItem objDTE := Cr...

Delphi: How to tag photos the way facebook does.

I need a way to tag photos in a Delphi desktop application the way Facebook does it. That includes some way to easily add the tags over the people, and then hovering the mouse over the person in the photo to show the tag. The two suggestions in the answer given to: "Delphi Components for Face Identification and Tagging" don't solve th...

Delphi Froze when registering type library

Hi: I have created a few AUTOObjects using Delphi and its type library. It compiles without error, but when I tried to register it, Delphi froze, and doesn't return to normal. I have tried to register it in both Delphi 7 and 2006, but both get into the same problem. I tried to register a simple library in Delphi's demo, I am ruling out ...

How do you initialise a const array of TGUID from Interface type data, in Delphi?

I want to initialise an array like this - Const MyArray : Array[0..0] Of TGUID = (IInterface); But it results in - [DCC Error] Test.pas(10): E2010 Incompatible types: 'TGUID' and 'string' So to see what would happen I tried this - Const MyArray : Array[0..0] Of String = (IInterface); Which results in this! [DCC Error] Test.pas(...

ThreadPool, QueueUserWorkItem and Deadlock on Shutdown

I just implemented a thread pool like described here Allen Bauer on thread pools Very simple implementation, works fine, but my application no longer shuts down. Seems that two worker threads (and one other thread, I guess the queuing thread) stuck in the function ntdll.ZwRemoveIoCompletion I remember to have read something about IO...

Passing Interface's method as parameter

Hi, is it possible to pass inetrface's method as parameters? I'm trying something like this: interface type TMoveProc = procedure of object; // also tested with TMoveProc = procedure; // procedure of interface is not working ;) ISomeInterface = interface procedure Pred; procedure Next; end; TSomeObject = class(TO...

Data-driven DUnit testing

The way DUnit normally works is you write some published methods, and DUnit runs them as tests. What I want to do is a little different. I want to create tests at run time based on data. I'm trying to test a particular module that processes input files to creates output files. I have a set of test input files with corresponding known goo...

Compare Function and Multithreading

Assume a multi-threaded environment and a (properly synchronized) class that has one particular procedure procedure SortKeyList (KeyList : TList <Integer>; Inverted : Boolean); that takes a list of keys and sorts it. The procedure uses the RTL quicksort implementation TList.Sort: KeyList.Sort (TComparer <Integer>.Construct (CompareKe...

Best auto-update component(s) for Delphi

I am re-writing and/or consolidating a bunch of my "app framework" classes (basic mainform, about box, locking routines & purchase linking, auto-update, datamodule initializer, etc) -- Basically, I have a number of small potential shareware apps that I'm wanting to get out the door, and want to re-use code where I can, as well as build a...

Best Shareware lock for Delphi Win32

Same intro as my last question: I am re-writing and/or consolidating a bunch of my "app framework" classes (basic mainform, about box, locking routines & purchase linking, auto-update, datamodule initializer, etc) -- Basically, I have a number of small potential shareware apps that I'm wanting to get out the door, and want to re-use cod...

Delphi 2007 help integration

I moved to Delphi 2007 in early 2008. It took a long time to migrate all my tools and components, and I'm not in a hurry to do that again. I moved from Delphi 6. (Bought D2006, but didn't use it much, due to the migration headaches). The MSDN / F1 help "integration" though, continues to drive me nuts pretty regularly. I access the D...