Link to home
Start Free TrialLog in
Avatar of pyromyst
pyromyst

asked on

VB and DirectPlay (DirectX)

I have created a program in VB 6 that uses DirectPlay, a component of DirectX, to communicate over a network. This is done by creating an instance of the DirectX7 object.
Since I am using Windows NT I have downloaded the DirectPlay 6.1A exe file and run it.

The problem arises when I try to run my VB program it says that it can't find the DirectX7 object.
HOW DO I MAKE VB AWARE OF THE DIRECTPLAY FILES?
Avatar of pjknibbs
pjknibbs

Two points:

1) I'm not at all sure that DirectX 7 can be installed on NT.

2) Even if it can, are you sure running DirectPlay 6.1 actually installs DirectX 7? It might just install the DirectPlay components.
Windows NT only supports DirectX 3 and only if you have Service Pack 3 or higher.

You can download a directX typelibrary for DirectX 3 which does have a version of DirectPlay from http://www.chez.com/scribe/

Gordon
Avatar of pyromyst

ASKER

I am aware of the fact that Windows NT doesn't support DirectX directly.

However, the files I downloaded (DirectPlay 6.1a) from http://msdn.microsoft.com/directx/ were specifically for developers using Windows NT.
All I need to know is how to get VB 6 to give me a reference to the DirectX object, and thus use DirectPlay.
I have to use the DirectPlay 6.1 component because all previous versions of DirectX could only be used from C++.
Is the DirectPlay library listed in the dialog you get when you select Project|Components from the menu?
DirectX 7 was the first DirectX with native support for VB.

If you go to the address I gave above they also have a typelib for DirectX 6 which should I assume contain the references for DirectPlay6.1a.

If not you'll have to look at the .h files provided with the Microsoft Download and translate them into Declare statements.

Gordon
Firstly let me apologise for taking so long with answering your comments.

I have checked in the components menu and it doesn't appear there. That is what I am trying to find out about. What do I need to do in order to get the DirectX object to appear in the components menu?

Gordonp, what do you mean by "translate them into Declare statements"? And how do I do that?

Thanks for your help.
> Gordonp, what do you mean by "translate them into Declare statements"? And how do I do that?

Look at the .h files

if a function is declared in there as

void DirectPlayCreate(HWND hWnd, char* param)

then you could translate that to

Declare Sub DirectPlayCreate Lib "<DllNameHere>" (Byval hWnd as Long,ByRef Param as String)

for example.

I'd still recomend downloading the typelibs from http://members.xoom.com/vba51/downloads/directx.zip

the directX 6 typelib is the one to try.

GordonP
GordonP,

I tried as you suggested. I downloaded the directX 6 typelib, but much as I expected it didn't work. VB only supports DirectX from version 7. What I need to try then is the directx7 typelib, but I can't find it.
You can use any version of DirectX from VB.

DirectX 7 was the first to actually provide a native VB interface, for all previous versions you have to use either a typelib like the one I asked to you to download or manually
Declare every directX Dll call you require.

I'm using the DirectX 3 typelib perfectly well on my NT machine.

What went wrong when you tried to use the DirectX 6 typelib. Its possible that this typelib isnt compatabile with the DirectPlay 6.1A you downloaded as this was a special bit on the side for NT thing.

Your other option is to pick out the function calls you require and translate them into Declare statements

If you choose to go this way I can give you some basic help on the translation from C declaration to VB Declare.

Gordon
ASKER CERTIFIED SOLUTION
Avatar of Gordonp
Gordonp
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi there, did you ever get DirectPlay to work on your NT machine with VB.

Hi Gordonp,

I did as you said with the typelib files and I was able to get VB to detect them.
I still have to learn how to use the typelib files though.

I really appreciate all the effort you put into helping me. I am sorry that I forgot about this for a while with completing my final year project.

PyroMyst
Adjusted points from 100 to 200
Gordonp was extremely patient with me and I thank him for it.
If you need any further help with this just post a comment here. I'll keep monitoring for a while just in case.

Gordon