Skip to content

Managed C++/CLI

Discussions on Managed Extensions for Visual C++ .NET

This category can be followed from the open social web via the handle managed-c-cli@forum.codeproject.com

4.4k Topics 14.9k Posts
  • arm animation

    graphics game-dev question
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • System::String/StringBuilder as out parameter

    csharp question help tutorial
    5
    0 Votes
    5 Posts
    4 Views
    J
    Hi Paul, Thanks for the bit from the Ronald Laeremans; there's nothing like inside info :) I had been wondering why the compiler treats pointers to __value parameters the same as declaring them as C++ references. Knowing that this stuff is ".Net official" makes me feel better about the future for code I've written. Please feel free to post anything else you get from the inside! Sorry I didn't cover passing __value types in my first post; I was only talking about types that are already "CLR reference object"/pointer types, when I talked about pointers to pointers. I pass __value types the same way you did (as a C++ reference), and skip the pointer syntax. Cheers, Jeff
  • Stupid question about VC6 to VC.Net migration reason

    csharp help question c++ java
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Help me!!! A issue of wrapping unmanaged class with Managed C++

    help c++ csharp
    3
    0 Votes
    3 Posts
    3 Views
    P
    deadlock, this is the problem of not logging in before posting. You could have deleted the thread. Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.
  • static constructors - still cannot get it!

    csharp c++ question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • std::string marshalling

    question graphics help
    2
    0 Votes
    2 Posts
    4 Views
    J
    You only have to marshal your strings to CLR Strings, since all CLR reference types (including String) are based on Object. Then you can Add() your Strings to an ArrayList. If your std::strings are strictly lower ASCII (and I do mean 7-bit ASCII, not MBCS/ANSI), the following method will work: using namespace System; using namespace System::Collections; using namespace System::Text; using namespace std; vector vec; string s = "a std::string"; vec.push_back(s); ASCIIEncoding *enc = new ASCIIEncoding(); String *sCopy = new String(vec[0].c_str(), 0, vec[0].size(), enc); ArrayList *al = new ArrayList(); al->Add(sCopy); For anything beyond English, you will need to use either Marshal::PtrToStringAnsi() or MultiByteToWideChar(). I could explain that if it's what you need instead. Cheers
  • web project with Visual C++

    c++ database com help question
    3
    0 Votes
    3 Posts
    2 Views
    N
    Thanks so much! -- narada
  • 0 Votes
    3 Posts
    2 Views
    B
    For future reference we would appreciate it if you would not post the same question more then once across the different message boards, I believe you asked this exact question in the .NET Framework board also. Thanks:cool: "We will thrive in the new environment, leaping across space and time, everywhere and nowhere, like air or radiation, redundant, self-replicating, and always evolving." -unspecified individual
  • Open File -- Very Hard Problem

    c++ help question career
    2
    0 Votes
    2 Posts
    4 Views
    S
    Yes, you can do so. You can make the pointer as a syetem parameter which will be sent to another application. And the another application will get the system parameter--the pointer when the specified application is going to run. I guess you are sure to know that an application can accept command line that is just system parameter. Good luck! stanley
  • caught between managed and unmanaged C++

    question csharp c++ graphics help
    2
    0 Votes
    2 Posts
    3 Views
    J
    It is unclear exactly how you need to pass the vector data, whether anything needs to be modified in C#, and so forth. One question is whether you could re-implement all this in MC++ (or C#) from scratch to begin with. That is, populate ArrayLists from the get-go. If you have no choice but to pass unmanaged stuff to managed code, you will likely need to copy everything into managed (GC-collected) memory. If everything is largely primitive types (except the vectors, of course), then that shouldn't be too bad. If you need to pass values/changes back to unmanaged code, you will have to copy again. Obviously, it is best to minimise how much data must be marshaled back and forth between unmanaged and managed memory. If the "vectors" need to be dynamic within C#, then ArrayList seems like a reasonable choice, though performance will not be as good (if nothing else but because everything will have to be handled by pointers to the base Object class). If performance is not a major consideration, then go that way. If nothing needs to be modified (i.e., not dynamic) in C#, then __gc[] arrays are more efficient, and more flexible in MC++ than in C#. If you can be more specific about how the vectors need to be used, perhaps I could be more specific with any suggestions. I have been swimming in the regions between C++ and MC++ for quite a while now. Cheers
  • linking error

    c++ csharp visual-studio help question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Managed & Unmanaged type problem;

    c++ help question
    9
    0 Votes
    9 Posts
    3 Views
    L
    That's very nice approach. But I can't change the structure because that function in a DLL. I can interfere to interface of the library. Ahmet Orkun GEDiK
  • help

    help csharp com sysadmin tutorial
    2
    0 Votes
    2 Posts
    3 Views
    A
    As default a service runs as the "System" user. This user dont have permissions to access shares on other computers. You have to change toe user that the service logs on as. Change that to a user that have permissions to access the share, then it works ;) - Anders Money talks, but all mine ever says is "Goodbye!"
  • Using DLL's in Managed C++

    c++ question csharp help
    2
    0 Votes
    2 Posts
    2 Views
    A
    zaza_nata wrote: In other words, is it possible to use #include instead of #using as in MFC? The short answar: No... - Anders Money talks, but all mine ever says is "Goodbye!"
  • DirectX 9.0 Released

    csharp com graphics game-dev question
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Very Hard Problem (help Me)

    help c++ question career
    2
    0 Votes
    2 Posts
    3 Views
    L
    You can use inter-process communication for communicate two or more processes. Take a look Threads, Processes & Inter-Process Communication title. Ahmet Orkun GEDiK
  • u can help me!! i have a Simple Quiestion.

    c++ question html com data-structures
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Windows Forms Open File Dialog

    c++ question csharp winforms
    2
    0 Votes
    2 Posts
    5 Views
    N
    This might be of a little help :- http://www.codeproject.com/managedcpp/mcppoutlookgui.asp Nish Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
  • Convertiong Managed Strings to Unmanaged Chars

    tutorial question
    2
    0 Votes
    2 Posts
    3 Views
    N
    See :- http://www.codeproject.com/string/CPPStringGuide2.asp And see the section titled "CLR and VC 7 classes" Nish Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
  • Object * to (void *,size_t) and back

    question data-structures performance help
    2
    0 Votes
    2 Posts
    4 Views
    A
    I've a similar problem and I don't know how to solve it. I hope some Guru here knows the solution. Jenny. C.H.Y.S.P.R.xxx