473,667 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetKeyBuf fer(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
ENGINEInputEngi ne Input = new ENGINEINPUTEngi ne(); //
Input API for the Engine

int numberOfEvents;

Input.GetKeyBuf fer(ref buffer, ref numberOfEvents) ;

Must ref, or else got bugs.

So i get compile errors:
=============== =
C:\FallenDemo\E dit Box\Form1.cs(20 0): The best overloaded
method match for 'ENGINE._ENGINE InputEngine.Get KeyBuffer
(ref System.Array, ref int)' has some invalid arguments

C:\FallenDemo\E dit Box\Form1.cs(20 0): Argument '1': cannot
convert from 'ref ENGINE.ENGINE_K EYDATA' 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 2472
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
ENGINEInputEngi ne Input = new ENGINEINPUTEngi ne(); // Input API for the
Engine

int numberOfEvents;
System.Array arrayBuffer = buffer;

Input.GetKeyBuf fer(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**********@c huawenching.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.GetKeyBuf fer(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
ENGINEInputEngi ne Input = new ENGINEINPUTEngi ne(); //
Input API for the Engine

int numberOfEvents;

Input.GetKeyBuf fer(ref buffer, ref numberOfEvents) ;

Must ref, or else got bugs.

So i get compile errors:
=============== =
C:\FallenDemo\E dit Box\Form1.cs(20 0): The best overloaded
method match for 'ENGINE._ENGINE InputEngine.Get KeyBuffer
(ref System.Array, ref int)' has some invalid arguments

C:\FallenDemo\E dit Box\Form1.cs(20 0): Argument '1': cannot
convert from 'ref ENGINE.ENGINE_K EYDATA' 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
6072
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 loss even though I seem to be allocaitng everything; help would be *vastly* appreciated. What am I doing wrong here? I thought I was doing everything correctly (setting things to null, for example) but none of the memory seems to get replaced. ...
3
14929
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) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
11
1763
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'); resetMenu(sel); } function resetMenu(sel){ sel.length = 0;
2
2176
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) { return a - b }
16
2524
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 uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
18
4343
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 can use dlopen/whatever to convert the function name into a pointer to that function, but actually calling it, with the right number of parameters, isn't easy. As far as I can see, there are only two solutions: 1) This one is portable. If...
2
1991
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 books to help me understand whats really going on. I would a few more containers within my centered text box in the middle so I dont have to press spacebar to get where I would like it, but have had trouble. I recon im doing a lot wrong so please...
2
11275
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 basic compiling on this new Dev C++, when i try to print something like: #include<iostream.h> using namespace std; int main () { cout << "Hello to the world" << endl; system("PAUSE") return 0;
10
1841
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 just leave a blue page - seems like it heavily rely on JS. Still, me and friends having problems and orkut seems just to ignore it. I am sure, that other poeple have problems, and I really wonder what
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.