DirectX:DirectPlay:Tutorials:VB:DX7:Termination

From GPWiki
Jump to: navigation, search

As with all things to do with DirectX, it's always good practice to set your objects to Nothing before you end your program. Also, you should try to destroy them in order, from the most recently created to the last. This should remove any chance of errors arising during your termination steps.

Set objEnumSessions = Nothing
Set objEnumConnections = Nothing
Set dp = Nothing

These are the three objects that must persist at the module level (rather than the procedure level). The first created was the DirectPlay4 object, so we'll blow it up last. I'm sure you get the picture.

You are now a Master of DirectPlay, just as He-Man was Master of the Universe.. Ok, not quite yet, but if you mess with the source code I'm you'll get the hang of it pretty quickly! "By the power of DirectX, I... HAVE... THE POWER!"

(Click here to download this tutorial's source code.)