Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

odd findcomponent error

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
On testing an app that uses my replacement dialog box, I got an odd error.
The application will show a dialog at start up (to do with demo mode)
and I have seen no problems on my development machine.

But on one machine (the first run on this machine)
A message 'cannot find component B1' was shown.

I am assuming for now, that it is something to do with this part of the dialog code which runs when the form activates.
Code:
  Button := findcomponent('B1') as TButton;

AFAIK findcomponent should not generate an error if it fails (the 'B1' button might not exist)

The error was not fatal and the app ran normally afterwards and this happened only once, I haven't been able to duplicate it on the same machine. Does anyone know why this happened and is if so it possible to trap it.





Steve: Delphi a feersum engin indeed.
 
Cannot find your error message in D6. Neither in the help nor in the sources.

One thing is for sure: in D6 FindComponent will never produce such an error message, as the function is totally self contained and the only error management it does is returning a nil pointer.

If you are not using another version of Delphi qith a very different implementation of FindComponent the error is somewhere else.

buho (A).
 
I'm using Delphi 7.
Hmm This machine has a Visul studio installation ( I never use it ) I wonder if it was some sort of debugger message from that? But there is nothing at all in the windows event logs.
I will try a more recent build of the application on this machine.




Steve: Delphi a feersum engin indeed.
 
sggaunt, is this application of yours multithreaded??

I can only think of a situation where the second thread is launched Before the main thread has had a chance to read its resources from the EXE-file.

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top