I'm writing an opc client in delphi and I'm having some problems with the ondatachange event. It is giving me an event failed with error code 0x80010105. It would appear that when i'm busy with handling an event i'm getting the next and then i'll get an error.
My question is does anybody know how I can possibly solve this?
Thank you for the answer, but it was actually an error in my client program that handled a datachange event wrong. so that the received arrays went out of bounds or the values that I got back were handled worng.
I have an application that is sending commands that are being added to a queue to a connected device. There are times when I need to send a command right away, so I need a way to add an object to the front of the queue so that the command gets sent right away instead of having it added to the end of the queue. Does anyone know how to do this? I am using a TQueue object.
I have some code which leaks memory (it's pretty much copied straight from Rudy's Delphi Corner). I have found the line that which causes the problem, but I don't understand why it's leaking which makes me concerned. I am reluctant to just fix it without knowing what's actually wrong.
The purpose of the code is to create a separate copy of a TVarRec variable. Here goes:
function TfrmMain.CopyVarRec(const Item: TVarRec): TVarRec;
// Copy entire TVarRec first.
Result := Item;
// Now handle special cases.
case Item.VType of
Result.VExtended^ := Item.VExtended^;
Result.VPChar := StrNew(Item.VPChar);
// A little trickier: casting to string will ensure
// reference counting is done properly.
// Nil out first, so no attempt to decrement
// reference count.
Result.VAnsiString := nil;
string(Result.VAnsiString) := string(Item.VAnsiString);
The following function is then used to free the copied TVarRec:
// TVarRecs created by CopyVarRec must be finalized with this function.
// You should not use it on other TVarRecs.
procedure TfrmMain.FinalizeVarRec(var Item: TVarRec);
case Item.VType of
// vtAnsiString uses reference counting.
Item.VInteger := 0;
The above code leaks memory when the TVarRec contains an AnsiString, that is in the vtAnsiString case of the CopyVarRec function. The weird thing is, the memory leak goes away if I remove the line
Result.VAnsiString := nil;
before assigning the Item's string to teh string of the the Result. If I remove it, the memory leak goes away and (it appears) the program works fine, but I really don't feel comfortable doing so without understanding why that line causes the problem to begin with.
The line which nils the Result's pointer to the string is needed, because otherwise the code which copies the string will cause the strings reference counter to decrease to 0, freeing the string. This is why the application "stopped" leaking memory when the nil-ing row was removed.
Instead, FinalizeVarRec needed to actually set the AnsiString to the empty string too, to make sure the string was freed. I believed taht would be handled by the reference counting, but it doesn't work that way for pointers.
I'm considering going back to school, in order to learn to program. The potential teacher wants to see a quick demonstration of the software that I have written in the past. Unfortunately, those require Interbase 6.
I would highly recommend using FireBird 1.5.x instead of Interbase 6.0.
It is 100% compatible but is better in every aspect.
(not to mention that FireBird is still in development, while Internase 6.0 was canceled long time ago)
Your project is using these external components - TXiProgressBar, TFreeButton, TAdvStringGrid, TdxCheckbox, TZipForge, which are not found in the RAR file you've posted. You definitely need these components to build the project. I could get TFreeButton on the Internet, and could build the component. For TZipForge, I could get the installer on the net. However, I could not get the remaining three components. If possible, you should perhaps contact the original developer, who should certainly have these components with him/her. Alternatively, you could modify the project to use equivalent components available with standard Delphi 7 and use them.
Rather than linking to an unknown (read potentially unsafe) source, you could give details of those components which you are missing.
However, from the reply from Amarnath S, finding those missing components was not difficult.
I have tried to contact to the programmer but he/she is almost unreachable. He shared this source code in a forum but his membership is deleted now.
Thank you for the links you have provided. I downloaded all components it needs, but I think I can't succesfully install the components. I don't have experience and knowledge about Delphi so I can't solve the problem. That's why I need someone to compile and send it to me.
I downloaded all components it needs, but I think I can't succesfully install the components.
Did you download the correct version of the components for your version of Delphi? If the installation of these components failed, what were the error messages telling you? If you are trying to supporting an existing program, have you tried to contact the original developers of that program for source code and documentation? Has you present customer given you any hints as to the next stage if you are unable to support this existing program?
Delphi, it is in an unfortunate position. When Borland lost its way it lost countless customers and countless developers and its credibility fell through the floor. This in turn has the capacity to becomes a nightmare in terms of maintaining existing customers' software.
You have a choice to muddle on the best you can or suggest to the customer that the only solution is to replace these problematic programs with current development techniques and current development products.
As source code for many Delphi and C++Builder components were never released, and original developers of these components are no longer available for one reason or another, leaves you with effectively one conclusion - namely - to start afresh with new. But if starting anew is not an option, you could try utility programs such as Resource Hacker/[^] and the hacker's (read Cracking) "w32dsm89" programs to give you hints of what the program and its supporting DLLs do, but that is potentially a very hard and very time consuming thing to do and thus far too expensive to perform. Please note, using cracking programs such as "w32dsm89" I personally do not recommend, it could get you into trouble!
I am pretty sure that I have the correct version of components. But when I am trying to install some of these components, I can't because I don't have .pas files of this components. (I am a newbie in Delphi, maybe there is an other way )
Only thing I am trying to do is compiling this project. I have deleted references to XiProgressBar and the commands which needs XiProgressBar because it was not that important.