c++-cli

How do I ask a Windows::Forms::GroupBox to resize?

I have a Windos::Forms::GroupBox which contains a Windows::Forms::ListView. When I add items, I add items to the ListView I tell it to resize but how do I do the same for it's parent GroupBox? [edit] This is my custom resizing list control: ResizingListView::ResizingListView(void) { } void ResizingListView::ResizeVerticallyToItems(vo...

How can I cast a gcroot<Object^> to IMyInterface in C++.net?

I'm having to do some weird things with gcroot, but I get the following error on the dynamic cast line: "cannot use 'dynamic_cast' to convert from 'gcroot' to 'IMyInterface^'. In C#, you could easily cast a generic object to any interface. You may get a runtime error if the object doesn't implement the interface but it would compile. ...

Readable C++\CLI Exception Message in C#?

the following code throws an exception in C++ and catch in C# C++ throw std::exception ("a C++ exception"); When i catch in C#, it gives me the following: [SEHException (0x80004005): External component has thrown an exception.] here is how i call the C++ code using Foo.Bar.Sample; //C++ library .... Class1 class1 = new Class1()...

Visual C++/CLI mutual access between two class objects?

Here is the problem: namespace Program1 { public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) {....} private: RunnableThread^ peerThread; private: System::Void loginButton_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { String^ ip = this->ipTextFi...

Visual C++/CLI (CLR) Null pointer

I wan't to implement the following code - the check if the pointer is null or not null. If the pointer points to object, then do sth with that object, if not - skip that code block. My code: ref class EchoClient { private: GameMatrix^ gameMatrix; public: EchoClient(void); EchoClient(GameMatrix^); void do(); }; EchoClie...

Why native C++ Win32 DLL does not working properly in C++/CLI managed code?

Hello, I have native C++ DLL code to call from C++/CLI functions. It's not working properly. I am copying those areas of code here which causing problems. Note: I made native C++ stub and called that native dll's functions and it worked fine as per context. Native C++ DLL: void ExecutorFactory::GetTESService(string a_strFileToProce...

Get parent directory of file as string c++

I'm using Managed C++. I need to extract the parent directory after OpenFileDialog returns the String^ file path. System::String^ filestring = openFileDialog1->FileName; The method that microsoft uses is Directory::GetParent but this must be saved as System::IO::DirectoryInfo^ WhyIsThisNotAString = Directory::GetParent(files...

Syntax for C# Array[] in C++/CLI

I have an interface defined in C# which has a method Array[] Foo(); I need to implement this interface in a class written in C++/CLI. i tried the following syntax array<array<Object^>^>^ Foo(); But i get an error stating my return type does not match the one in the interface. Does anyone know how to translate a C# Array[] to C++/CL...

Where do I look to see which .NET framework version I'm targeting in VS 2005 in a C++/CLI project?

EDIT: Sorry, forgot to mention this was a C++/CLI project. Does it show it somewhere or does it just target one by default? Also, can you change this in VS2005 or was this new to the later VS versions? ...

Why, when creating a C++/CLR project in VS2010, a SecurityAction.RequestMinimum is added by default in the AssemblyInfo?

If I understand correctly, SecurityAction.RequestMinimum has been made obsolete for .NET Framework 4.0 here. Now, when I create a C++/CLR project that targets .NET Framework 4.0, this line gets added automatically in the auto-generated AssemblyInfo.cpp: [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];...

cli c++ listView issue

I want to create a listView that have 8 groups (Group0,Group1,...) and six columns,the format like this way Group0 XXX_0Y11_r value XXX_0Y11_w value ZZZ_(11) tt XXX_0Y12_r value XXX_0Y12_w value ZZZ_(12) tt XXX_0Y21_r value XXX_0Y21_w value ZZZ_(21) tt XXX_0Y22_r value XXX_0Y22_w value ZZZ_(22) tt QQQ_01 ...

cli C++ funny static value in wrapper

//CCodeWrapperIF.h public ref class CCodeWrapperIF { public: CCodeWrapperIF// Default constructor public: static UINT8 funny; void foo(void); } //CCodeWrapperIF.cpp extern "C" { #include "CCodeWrapperIF.h" } [DllImport("CCode.DLL", CallingConvention = CallingConvention::Cdecl)] extern "C" void CCode_Foo(void); CCodeWrapper...

why doesn't this compile when using std::max and c++/CLI?

Can anyone please explain why the following will compile int a = aAssignments[i]->Count; int b = fInstanceData->NumRequiredEmpsPerJob[i]; fInstanceData->NumSlotsPerJob[i] = max(a,b); but fInstanceData->NumSlotsPerJob[i] = max((int)(aAssignments[i]->Count), (int)(fInstanceData->NumRequiredEmpsPerJob[i])); //why on earth does this not ...

Might a std::vector created in managed C++/cli on the (managed) stack change memory locations?

If in C++/cli I write ref class test { void method() {< std::vector<float> my_stack_vector; native_function_call( & my_stack_vector ); } }; Can the location of my_stack_vector change after its creation? I know that if it lived in the the underlying native stack then it wouldn't change, but with the extra lay...

Does the immediate window provide a nice way to display a primitive array?

I dynamically assigned an array as follows: unsigned char **nonces=new unsigned char*[n_cases] Is there a way to nicely print it out in the immediate window? Alternatively, it would be nice to make the locals window display it properly. ...

why ide remove my PNG picture resource in the resx file silently?

i created a A Form in the a.h and there generate one resx file correspondenly then i added some png pictures in a.resx file, but after sometime ,ide will remove my png files in the a.resx file ,that's so weird , it wasted me too much time ...

How do I stop a Windows::Forms::Dialog resizing in one direction?

I have a dialog box which I programatically alter the height of. The problem now is that I'd like to allow the user to expand it horizontally if they want to see more information. How can I stop the dialog from resizeing vertically if I allow the user to resize it? ...

Why should I new native objects in mixed mode ?

I have a C++/CLI (VS 2008) mixed mode library that creates native objects and calls methods in then. Native dll is written in pure c++. Now in my C++/CLI wrapper methods if I declare object of native classes in c++ way as ClassA obj; Obj.Method(); and use it, it works but, I get System.AccessViolationException: Attempt to read or wri...

NCover with a C++/CLI assembly

Does anybody know how to do coverage of an C++/CLI class using NCover? NCover only measures coverage of an assembly if it finds a matching .pdb file. However, my C++/CLI project does not output a .pdb file. If I go to "Visual Studio -> Configuration Properties -> C/C++ -> Output Files -> Program Database File Name" and set it to "MyD...

Issue in compiling with marshal.h : error C2872: 'IServiceProvider' : ambiguous symbol

I am trying to use the marshalling library in my C++/CLI project. When compiled with #include <msclr/marshal.h> I get the error error C2872: 'IServiceProvider' : ambiguous symbol. Most of the resolutions seems to be suggesting moving #include <windows.h> like the one here -> Ambiguous references, but I dont have those includes. All I hav...