12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

NOTE<br />

NOTE<br />

Creat<strong>in</strong>g Applications <strong>in</strong> <strong>C++</strong>Builder<br />

OnClick handler associated with that button is still <strong>in</strong> the code. <strong>C++</strong>Builder knows that the<br />

button associated with that OnClick handler is gone, but it still doesn’t delete the event<br />

handler because it is possible that other components are us<strong>in</strong>g the same event handler. It’s<br />

up to you to delete the event handler if you want it removed from your code.<br />

The actual deletion of the event handler is an easy task:<br />

■ Delete the function def<strong>in</strong>ition from the source unit.<br />

■ Delete the function declaration from the header.<br />

This is the exception to the rule that you should never modify the<br />

published section of your form’s class declaration.<br />

Before you delete the event handler, you need to make sure that no other components are<br />

us<strong>in</strong>g that handler. Unfortunately, there is no simple way of determ<strong>in</strong><strong>in</strong>g whether another<br />

component is us<strong>in</strong>g a particular event handler. You need to be aware of how the components<br />

<strong>in</strong> your application <strong>in</strong>teract.<br />

Some might say that if you are unsure about an event handler be<strong>in</strong>g<br />

used by other components, just leave it <strong>in</strong> the code. That’s a bad<br />

solution, <strong>in</strong> my op<strong>in</strong>ion. You need to take responsibility for know<strong>in</strong>g<br />

what is <strong>in</strong> your code and gett<strong>in</strong>g rid of any unused functions. Although<br />

unused code doesn’t hurt anyth<strong>in</strong>g, it leads to a larger .exe file. In<br />

some cases, unused code can lead to performance degradation. Be<br />

diligent <strong>in</strong> par<strong>in</strong>g your programs of unused or <strong>in</strong>efficient code.<br />

Us<strong>in</strong>g Resource Files<br />

Every W<strong>in</strong>dows program uses resources.<br />

Resources are the elements of a program that support the program but are not<br />

executable code.<br />

A typical W<strong>in</strong>dows program’s resources <strong>in</strong>clude<br />

NEW TERM<br />

■ Accelerators<br />

■ Bitmaps<br />

■ Cursors<br />

341<br />

9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!