c++-cli

How to update glut window continuously?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 23:58:17
问题 I have a real robot that is ordering my virtual robot in open gl. I want show every movement of my master robot(real robot) in slave (virtual one in open gl) online, so i need to update my glut window continuously, actually as long as real robot moves my virtual one moves too, and all these movement should be online. I get data from master always with get data function, but I dont know how I should update the window. Here is my code: * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * **

c++/cli DLL fails under Win 8.1

痞子三分冷 提交于 2019-11-27 23:12:22
问题 i have written a Win32/net DLL, it works fine under Win XP, Win7 and 8 but under Win 8.1 it fails. Dependency Walker says: API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL not found (user32.dll will call them) Google means, MS changed some System-DLLs in 8.1 (and ignored compatibility), so that many programs have the same problem. Full list with "file not found": API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL MSVCR120.DLL API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL

C++ controls for a game running in windows console

与世无争的帅哥 提交于 2019-11-27 23:07:31
问题 I'm trying to make a small 2 players game that runs in the command prompt. All things were good until I've started working on players controls. So, for capturing the keyboard keys I thought the best solution would be the use of getch() function. That's because getch() takes keys on the fly, without displaying it on screen, waiting for enter or other keys to be pressed. The code to accomplish that, as far as I could think, is fairly simple: c=getch(); switch(c) { case 'a': make player 1 go

Is there an equivalent to the C# “var” keyword in C++/CLI?

≡放荡痞女 提交于 2019-11-27 22:59:05
问题 In C#, I like the var keyword for situations like this: var myList = new List<MyType>(); Is there any equivalent in C++/CLI, or do I have to repeat the type name everytime just like this: List<MyType ^>^ myList = gcnew List<MyType ^>(); Could not find an explicit statement in the docs or by Google so far. I am using Visual Studio 2008. 回答1: In Visual Studio 2008 there is no such equivalent. However with Visual Studio 2010 you can use the auto keyword to implement var like semantics in C++. I

Implementing an interface declared in C# from C++/CLI

好久不见. 提交于 2019-11-27 22:41:31
Say I have a C# interface called IMyInterface defined as follows: // C# code public interface IMyInterface { void Foo(string value); string MyProperty { get; } } Assume I also have a C++/CLI class, MyConcreteClass , that implements this interface and whose header is declared as follows: // C++/CLI header file ref class MyConcreteClass : IMyInterface { public: }; How does one implement the method Foo and the property MyProperty in the C++/CLI header? My attempt results in the following compile error: error C3766: 'MyConcreteClass' must provide an implementation for the interface method 'void

C++/CLI-Question: Is there an equivalent to the C# “is” keyword or do I have to use reflection?

荒凉一梦 提交于 2019-11-27 21:26:24
I've read somewhere on MSDN that the equivalent to C#'s "is" keyword would be dynamic_cast, but that's not really equivalent: It doesn't work with value types or with generic parameters. For example in C# I can write: void MyGenericFunction<T>() { object x = ... if (x is T) ...; } If I try the "equivalent" C++/CLI: generic<class T> void MyGenericFunction() { object x = ... if (dynamic_cast<T>(x)) ...; } I get a compiler error "error C2682: cannot use 'dynamic_cast' to convert from 'System::Object ^' to 'T'". The only thing I can think of is to use reflection: if (T::typeid->IsAssignableFrom

Wrapping C++ for use in C#

我怕爱的太早我们不能终老 提交于 2019-11-27 21:22:53
问题 Ok, basically there is a large C++ project (Recast) that I want to wrap so that I can use it in my C# project. I've been trying to do this for a while now, and this is what I have so far. I'm using C++/CLI to wrap the classes that I need so that I can use them in C#. However, there are a ton of structs and enums that I will also need in my C# project. So how do I wrap these? The basic method I'm using right now is adding dllexport calls to native c++ code, compiling to a dll/lib, adding this

Convert from C++/CLI pointer to native C++ pointer

橙三吉。 提交于 2019-11-27 20:12:12
I have run in to this problem of converting a C++/CLI pointer to a native C++ pointer. Heres the background: I'm writing a windows forms application using C++/CLI. The application makes call into a number of COM Interfaces. When creating an instance (inside of a C++/CLR class) of a object through the COM interface, i pass in (void**)(&provider) as the last argument to CoCreateInstance , as in: HRESULT CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, (void**)(&provider)); However, i get the compiler error: cannot convert from cli::interior_ptr<Type> to void ** . I've done som research

convert standard C++ string to String^

家住魔仙堡 提交于 2019-11-27 19:38:30
问题 I want to convert to std::string to System::String^ in Visual C++ environment. I know that we can convert System::String to std::string by the MarshalString Function as below: void MarshalString ( String ^ s, string& os ) { using namespace Runtime::InteropServices; const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer(); os = chars; Marshal::FreeHGlobal(IntPtr((void*)chars)); } I can't find the way to convert std::string to System::String but I found that System::String

C++/CLI: why should I use it?

a 夏天 提交于 2019-11-27 19:35:54
I'm pretty familiar with C++, so I considered learning .NET and all its derivatives (especially C#). Along the way I bumped into C++/CLI, and I want to know if there is any specific use for that language? Is it just suppose to be a intermediate language for transforming from native C++ to C#? Another question that popped to my head is why are there still so many programming languages in .NET framework? (VB, C++/CLI, C#...) Yes, C++/CLI has a very specific target usage, the language (and its compiler, most of all) makes it very easy to write code that needs to interop with unmanaged code. It