DirectX:DirectPlay:Tutorials:VB:DX7:Termination

From GPWiki

(Redirected from VB:DX7 DirectPlay Terminate)

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.

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.)