473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems with function arguments - need help!

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
1 2466
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Justice | last post by:
Currently I'm doing some experimenting with the XMLHTTP object in Javascript. Now, the XMLHttp object is asynchronous (at least in this case), and the following code causes a significant memory...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
11
by: JS | last post by:
I have made a function createFirstMenu where I call "resetMenu" in a JavaScript. But nothing happens when I call resetMenu. function createFirstMenu(sel){ sel = document.getElementById('sel1');...
2
by: RC | last post by:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_sort2 You can see above link or read below i copy/paste from above link <script type="text/javascript"> function sortNumber(a, b)...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
2
by: funkiejunkie | last post by:
Hello all, I posted a thread a while ago and was told to include the code so here it is. I still dont really get CSS, everything I have done has been blagged because I cant be bothered to read...
2
by: renagade629 | last post by:
Can anybody help me understand what i'm doing wrong or what I'm missing? Is there anyother good and commendable C++ program I can use (free) from the internet like Dev C++? I'm having trouble doing...
10
by: jodleren | last post by:
Hi I know, that there are a lot of people having problems with orkut.com, errors like "object expected" and named objects missing. When loading the site can generate some 10 errors, and still...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.