|
Another guessing:
also delete the ref for the arrays, (as the arrays vars are references themselves)
m_MasDsp.GetMasSysDataS(parArray, ref startTime, ref osInfo, ref sysName, prtNode);
|
|
|
|
|
Hallo!
If I do that the following message occurs:
"Argument '1': cannot convert from 'int[]' to 'ref int'"
I think I have already tried almost all combinations of parameter and the one I used seems to be the only one that works.
I wrote a litte VB6-TestingApplication for the dll. There I passed the arrays in the same way as I did in C#.
It is really strange.
|
|
|
|
|
Could this be a boxing fault???
Gets "ref parArray[0]" boxed before it is passed to the COM-interface and so the other elements get no values.
|
|
|
|
|
Honestly i don´t know what the hell is going on...Definitively the old C has changed....
Sadly i can´t help you with that one...I´m still "cold" with some features.
Maybe it is a bug but maybe we should study a little more...LOL
If you find the solution could you post it here please?
|
|
|
|
|
Of course I will post if I have the solution.
I really think that it is a boxing failure:
I have an array with four elements. To call the method of the ocx I have pass a reference to the first element of the array. But this element is a TypeValue and no reference value. So it is boxed --> put into the heap. But only the first(!!) element!!! So the ocx gets a reference to that element and writes the data into it and also writes data into the next 3 elements. But the other 3 elements aren't in the heap. At the end of the call my first element gets unboxed back into the stack and it has the correct value but the other 3 haven't.
Currently I try to pass through a SAFEARRAY. But there is a lot of studiing because I never used to work with MFC and ClassWizard and so on (only C/C++). But I think I am on the right way!
|
|
|
|
|
|
Is there a way to set the rows of a datagrid to disable row resize??
|
|
|
|
|
They show up on the object browser, but not in code view (popup autofill thing) like the core ones. Something I'm doing wrong?
|
|
|
|
|
You have one project which has been compiled and now you are using it in another project. If you want to see the descriptions for methods and properties, you should just configure your first project before compiling it, so that it also generates the XML documentation file for you. It is, easy just right click on your solution and look for the configuration for xml documentation file. Supply a name for xml file and re-build your project. that is all!
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
m a y s a m wrote:
that is all!
Not quite. The XML doc has to be in the same directory as the assembly you want to reference (by path, not name).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That is all!
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
|
i'm new in programing opengl so.....
I'm heaving troubles implementing the fog function, is it possible for anyone to send me implementation for this function?
M Shedid
|
|
|
|
|
|
thank you , but i want to use fog in a still image, not in animation, is it possible, as if i'm making a scene, so how may i do it?
|
|
|
|
|
IS there a way to know if the client is disconnected.
My server basically receives data from the client. It uses syncronous connection with a winodw timer (Thus avoiding completly teh multitreading issue.)
|
|
|
|
|
This is a very ambiguous question. What client/server technology are you using? A simple TCP socket? .NET Remoting? Web Services? WebRequest s? More information would be helpful.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am using simple TCP sockets.
|
|
|
|
|
Then it depends greatly on your implementation. Some protocols - like DICT - will require that a client - if possible - send a QUIT message (or equivalent) for proper implementation. This tells the server that your client is disconnecting. Otherwise, when your server sends data you should catch any exceptions - which you should be doing anyway - and handle them appropriately. If you get a SocketException , for instance, check the SocketException.ErrorCode for WSAECONNRESET (10054) or WSAENOTCONN (10057). See the Windows Sockets V2 Error Codes[^] on MSDN for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Open a cmd prompt at your server and type:
netstat -a
Netstat then displays all connections and listening ports.
Check the Microsoft Windows 2000 Server Documentation on Command-line Utilities or type netstat /? for help.
Regards,
-Ron
Sincerely,
-Ron
|
|
|
|
|
I have a component that supports transactions. One of the method needs to know if it is within a transaction or not. Is there a way to know?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
How about ContextUtil.IsInTransaction ? There's other related methods for getting the transaction and its ID. Just see the .NET Framework SDK documentation for the System.EnterpriseServices namespace.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Tx for the answer, exactly what I was looking for.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hello,
I have a third party DLL that contains a create function, it creates an object in memory and returns a handle to it. When I am finished with it I can call a Destroy function with the handle to get rid of the object. While I am using the object each function the DLL has takes the handle to the object.
My question is: How do I write the DllImport stuff to get this handle properly?
I've tried:
[DllImport("tp.dll")]
internal static extern unsafe void* OpenFilter();
[DllImport("tp.dll")]
internal static extern unsafe void CloseFilter(void* handle);
[DllImport("tp.dll")]
internal static extern unsafe int IsOpen(void* handle);
and the same again with the void* replaced by IntPtr.
What am I doing wrong? If I write a test application in C I can use the DLL fine, but if I try the same in C# it doesn't work. Is there a problem with the way the third party DLL allocated its memory?
The third party DLL exposes C style functions and the same API as a C++ class (compatible with Visual C++ 6.0)
Any help would be much appreciated.
Cheers,
Andy.
|
|
|
|
|
Andy MacAngus wrote:
[DllImport("tp.dll")]internal static extern unsafe void* OpenFilter();[DllImport("tp.dll")]internal static extern unsafe void CloseFilter(void* handle);[DllImport("tp.dll")]internal static extern unsafe int IsOpen(void* handle);
Just a guess, but try:
[DllImport("tp.dll")]
public static extern IntPtr OpenFilter();
[DllImport("tp.dll")]
public static extern void CloseFilter(IntPtr handle);
[DllImport("tp.dll")]
public static extern int IsOpen(IntPtr handle);
- Nick Parker My Blog
|
|
|
|