I am doing a sample program to test "managed and unmanaged interoperability". I have a c++ function which takes vector and gives me some result back. This vector i want to pass from c# program. Can any one of you please let me know, the C# Equivalent of a C++ std::vector? If possible please provide me some sample code. Thanks in adavance.
There is nothing you can pass from C# that is going to turn into a std::vector. Your best bet, IMO, is to pass a list into a C++/CLI dll, which constructs a vector and pases it to your function.
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
I don't think you can create a vector and pass to the native function. Best method would be to use C++/CLI to wrap the native function. Write a function which takes a managed list in the C++/CLI class. Inside this function, create a std::vector with the values from list and pass to the native method. You can refer the C++/CLI project's DLL and call the methods from C# easily.
I want to pass the vector from c# program using DllImport.
Well, I think you haven't got what I said so far. To reiterate, you can't pass a vector from C# using DllImport. For doing that you have to use C++/CLI to create a proxy class between your C# and C++ application. Follow the below steps.
1 - Create a C++/CLI library project. Add reference to the native DLL here
2 - Write a function that takes List(T)
3 - Iterate over the elements in this list, create a vector and push each item to it.
4 - Now call the native C++ method by passing this vector.
Since List(T) is a managed type and C++/CLI produces mixed mode assembly, you will be able to access it from C# easily. Just refer the C++/CLI dll, create a List(T) from C# project and pass to the method.
*T will the type of the object which you want to pass.
Can anybody please help me to resolve below described issue?
using DirectShow i build application which show live preview and also capture video frames.
there is start/stop button available on user interface which are used for starting and stoping video frames capturing.
But when a user click on start/stop button, my preview window become totally black coloured for some time and i lost video frames during that period.
I'd guess that whatever processing you're doing in the start/stop event is taking too long, and locking out the video capture. However, without a lot more information it's pretty hard to really know what's wrong...
There are three kinds of people in the world - those who can count and those who can't...
I want to add automatic scrolling effect of pictures in timed manner on my MDI page. The effect should be like as web base application(just we use marquee in it) that is on mouse over it should be stopped. Is it possible to add it ?
i am working in a window Application and using a Gridview.In this gridview i am adding a button but can't find Button_Click Event...
Plz Dont tell me about Cell_click Event.Its Not working Properly...
Need A Help..
Use the "CommandName" property of the Button and set it to What ever name you want to give and the "CommandArgument" property to the unique id of that row to get the same.
You can catch the same in the RowCommand Event of the Gridview as
if (e.CommandName == "WhatEverYouNamed")
// Your Set of Commands and you can get the Unique Key value using e.CommandArgument.
Using this you can have multiple buttons doing multiple things in one gridview.