By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,657 Members | 1,578 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,657 IT Pros & Developers. It's quick & easy.

Problems with function arguments - need help!

P: n/a
Okay i stuck with something.

This is more to c# rather than Directx! Just want to
clarify it first.

Right now, i am using a game engine which provide a
function to get buffer for my input.

Code:
=====

Input.GetKeyBuffer(ret_KeyData() As ENGINE_KEYDATA,
ret_DataNumber As Long) // the API

But this code works fine in VB6 and VB.NET

so i do this

ENGINE_KEYDATA[] buffer = new ENGINE_KEYDATA[255]; // An
array of 255
ENGINEInputEngine Input = new ENGINEINPUTEngine(); //
Input API for the Engine

int numberOfEvents;

Input.GetKeyBuffer(ref buffer, ref numberOfEvents);

Must ref, or else got bugs.

So i get compile errors:
================
C:\FallenDemo\Edit Box\Form1.cs(200): The best overloaded
method match for 'ENGINE._ENGINEInputEngine.GetKeyBuffer
(ref System.Array, ref int)' has some invalid arguments

C:\FallenDemo\Edit Box\Form1.cs(200): Argument '1': cannot
convert from 'ref ENGINE.ENGINE_KEYDATA' to 'ref
System.Array'

The funny part is that why is vb6 and vb.ent can compile
and see the output and not in C#?

Any help to fix this problem?

It is supposed to expect a keydata rather than
System.Array!

I know the another alternative is code my own getbuffer
using Directx... but kind of troublesome...

ENGINE is my engine name, and when i used it, i add
references to COM for that engine...

Please help!

Regards,
Chua Wen Ching :p
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ENGINE_KEYDATA [] buffer is semantically a specific 'sub-class' of
System.Array. You can make this work like this:

ENGINE_KEYDATA[] buffer = new ENGINE_KEYDATA[255]; // An array of 255
ENGINEInputEngine Input = new ENGINEINPUTEngine(); // Input API for the
Engine

int numberOfEvents;
System.Array arrayBuffer = buffer;

Input.GetKeyBuffer(ref arrayBuffer, ref numberOfEvents);

buffer = (ENGINE_KEYDATA[])arrayBuffer;
--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Chua Wen Ching" <ch**********@chuawenching.com> wrote in message
news:06****************************@phx.gbl...
Okay i stuck with something.

This is more to c# rather than Directx! Just want to
clarify it first.

Right now, i am using a game engine which provide a
function to get buffer for my input.

Code:
=====

Input.GetKeyBuffer(ret_KeyData() As ENGINE_KEYDATA,
ret_DataNumber As Long) // the API

But this code works fine in VB6 and VB.NET

so i do this

ENGINE_KEYDATA[] buffer = new ENGINE_KEYDATA[255]; // An
array of 255
ENGINEInputEngine Input = new ENGINEINPUTEngine(); //
Input API for the Engine

int numberOfEvents;

Input.GetKeyBuffer(ref buffer, ref numberOfEvents);

Must ref, or else got bugs.

So i get compile errors:
================
C:\FallenDemo\Edit Box\Form1.cs(200): The best overloaded
method match for 'ENGINE._ENGINEInputEngine.GetKeyBuffer
(ref System.Array, ref int)' has some invalid arguments

C:\FallenDemo\Edit Box\Form1.cs(200): Argument '1': cannot
convert from 'ref ENGINE.ENGINE_KEYDATA' to 'ref
System.Array'

The funny part is that why is vb6 and vb.ent can compile
and see the output and not in C#?

Any help to fix this problem?

It is supposed to expect a keydata rather than
System.Array!

I know the another alternative is code my own getbuffer
using Directx... but kind of troublesome...

ENGINE is my engine name, and when i used it, i add
references to COM for that engine...

Please help!

Regards,
Chua Wen Ching :p

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.