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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing TPaintBox in a DLL? Problems...

Status
Not open for further replies.

PocketLnt

Programmer
Dec 2, 2003
1
US
Hi, I'm new to the boards so please bear with me...

Let me preface the problem at hand by fully explaining the situation at hand. I have a certain program that has a TPaintBox component inserted into the main form at design time. This program has a dll (graphics.dll) which is used to perform all the necessary drawing routines on the TCanvas property of said TPaintBox.

(Note: It is designed this way such that if more efficient drawing algorythms are developed int he future only the dll needs to be distributed and not the main executable.)

With that said, the drawing routines work just fine. Since only lines and arcs are being drawn the show up flawlessly. However, a problem has arisen where I cannot change the color of the TCanvas' TPen. If I try to so so I receive an EAccessViolation claiming an attempted "Read of address 00000000". In the main program I can change the value to me heart's content, but in attempting this in the dll only causes problems. I have tried the following methods to alleviate the problem with the same results:

1. Passing the function to change the TPen color the entire TPaintBox.
2. Passing said function a pointer to the TPaintBox.
3. Passing said function the entire TCanvas of the TPaintBox.
3. PAssing said function a pointer to the TCanvas of the TPaintBox.
4. Creating a class "newPaintBox" inherited from TPaintBox with a function to change newPainBox's TCanvas' TPen's Color and calling this function from the function mentioned in #1. (This causes the same error, but only when the program attempts to close)

I'm at my wits end, and if source code is needed I will be more than happy to provide anyone with that. So have I stumped you all or am I just missing something glaringly obvious?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top