NULL argument

Toyemann
03-25-2002, 07:08 PM
I'm little rusty with VB, but here I go. I'm trying to pass a NULL to a function that requires a ByRef variable. In C++, you just pass NULL, but how do you do that in VB?

xxxxxq
03-25-2002, 07:13 PM
Can you not use the optional keyword and pass it nothing??

Toyemann
03-25-2002, 07:16 PM
I can't. I'm calling a Win API function.

xxxxxq
03-25-2002, 07:19 PM
Which function is it and whats the data type? Have you tried vbnull?

Toyemann
03-25-2002, 07:24 PM
It's DirectX graphic function:

D3DXSkinnedMesh.UpdateSkinnedMesh(BoneTransformsIn As Any, BoneInvTransforms As D3DMATRIX, retMesh As D3DXMesh)

where BoneInvTransforms is a ByRef parameter. I need to pass a null, but how?

Thinker
03-25-2002, 07:32 PM
It appears that the D3DMATRIX is a C struct so you might try 0&

Toyemann
03-25-2002, 07:35 PM
I've tried that.

It returned:

Compile error: ByRef argument type mismatch.

xxxxxq
03-25-2002, 07:46 PM
Allapi seem to Nothing on this page here (http://www.allapi.net/vbtutor/directx1.shtml), whilst working with DirectX. Different function but worth a go if you haven't already tried.

Thinker
03-25-2002, 08:09 PM
Everywhere I look for this method, it comes up like this...
Sub UpdateSkinnedMesh(BoneTransformsIn As Any, retMesh As D3DXMesh)
(I copied this out of the object browser when I had set a
reference to the DirectX 8 VB library, msdn had the same thing.)
It only shows 2 parameters but you have three?
Anyway, 0& should be a Null pointer passed ByRef. ByVal 0&
would be an actual Null value. I don't know what is going on, but
Squirm probably will.

Squirm
03-26-2002, 02:09 AM
Both MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/hh/dx8_c/graphics_iface_d3dx_8yuw.asp) for C++ and VB and the object browser are telling me its got 2 parameters:

object.UpdateSkinnedMesh( _
BoneTransformsIn As Any, _
RetMesh As D3DXMesh)

object
Object expression that resolves to a D3DXSkinMesh object
BoneTransformsIn
First element of an array of D3DMATRIX types, representing the bone transforms.
The length of this array is the count of all the bones in the skin mesh
RetMesh
A D3DXMesh object, to be filled with the generated skinned mesh.


Its the same for both 8 and 8.1. Wonder where you got your definition from.

:-\

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum