c++-cli

Access violation in MFC dll (wrapped in C++/CLI) started from C# program

一世执手 提交于 2019-12-11 07:28:37
问题 I have written an managed C++/CLI wrapper for mfc dll (C++) and have some access violations after second call of dll! Wrapper // in .h typedef CKeyManagerServerApp* (*KeyManagerInstance)(CCommonUtils *); ManagedKeyInterface::ManagedKeyInterface() { HINSTANCE m_keyManagerLib = LoadLibrary("pathToDll"); KeyManagerInstance _createInstance = (KeyManagerInstance)GetProcAddress(m_keyManagerLib, "GetInstance"); // get native reader interface from managed reader interface CCommonUtils

Can't include TinyXML in C++/CLI project

醉酒当歌 提交于 2019-12-11 07:27:39
问题 I have a C++/CLI project, and I want to include TinyXML. I downloaded the library, added it as a a new project to my solution and added a reference from my project to the library. In my code I have #include "StdAfx.h" #include "tinyxml.h" When i compile i get 70 linking errors. I tried to comment #define TIXML_SAFE in tinyxml.h ( saw that on google ) , but doesnt work. Thanks, Dave 回答1: Got it, i included tinyxml in a subfolder of my current project, instead of adding it in its own project. I

Passing an array from managed code to unmanaged C++ ActiveX component

别等时光非礼了梦想. 提交于 2019-12-11 07:21:18
问题 In an earlier post Passing pointer from managed C++/CLI to ActiveX C++ component I've asked about the correct means to pass an array (whether managed or unmanaged array) to an activeX component created in native C++. The activeX method has the following signature: short Component::CopyToBuffer(short FAR* ptr) {} when the activeX is imported to be used in C++/CLI the method signature is displayed as short Component::CopyToBuffer(short% ptr) {} when imported in C# it is displayed as short

C++ Header File Errors

寵の児 提交于 2019-12-11 06:57:07
问题 I have been tasked to create a C# interface with some of the methods that are being using in the Open Source CrytoLib C++ project. I am trying to create a managed wrapper for the LIB file... however I am getting some errors already and cannot figure out what I am doing wrong as this seems pretty straightforward to this point. My header file: // CryptoLibWrapper.h #pragma once using namespace System; namespace CryptoLibWrapper { public ref class DefaultDecryptorWithMAC { public: BOOL Decrypt

Managed C++ Memory leak

江枫思渺然 提交于 2019-12-11 04:48:14
问题 I am getting a memory leak whenver a new RPC thread in a DCOM server (c++ DCOM server) invokes the following managed C++ method void CToolDataClient::SetLotManagerActive(bool bLotManagerActive) { if( m_toolDataManager != nullptr) { m_toolDataManager->LotActive = bLotManagerActive; } } I get the managed C++ object pointer using the floowing code typedef bool (*FPTR_CREATEINTERFACE)(CToolDataInterface ** ppInterface); FPTR_CREATEINTERFACE fnptr = (FPTR_CREATEINTERFACE)GetProcAddress(hModule,

Windows Forms - picture box. How to delete an Image

狂风中的少年 提交于 2019-12-11 04:34:33
问题 I am working in an application where there is a conbobox and a picturebox. The user selects a path and the conbobox loads paths to 2000 images, and displays the first one. When the user changes the index of the conbobox the image displayed changes, but I don't know how to delete the image in the picturebox. If I just overwrite the image it doesnt do the job, as when I do it repeatedly the program crashes because of memory. How do I delete a image Inside the picturebox? EDIT: I made few

Error C3918: Error wile checking event for being nullptr

你。 提交于 2019-12-11 04:23:46
问题 I have delegate and event in my .h file delegate void ResponseReceivedHandler(System::Object^ sender, WhoisEventArgs^ e); event ResponseReceivedHandler^ ResponseReceived; somewhere in my code I want to check if event is nullptr or no, but when I write EDITED: if (this->ResponseReceived != nullptr) { this->ResponseReceived(this, e); } Error occurred Error 1 error C3918: usage requires 'VT::WhoisClient::WhoisRequest::ResponseReceived' to be a data member c:\Users\ViToBrothers\Desktop\ViTo

Visual Studio C++/CLI 2010's Intellisense doesn't work; are there alternatives? [duplicate]

不问归期 提交于 2019-12-11 04:17:55
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What are people replacing the missing C++/CLI Intellisense in VS 2010 with? I downloaded and installed Visual C++ 2010 Express, today. To my shock and horror, a variable's dot was not followed with anything, an error at the bottom status bar reading: "Intellisense: Unavailable for C++/CLI" So... that being the case, is there an alternative to Intellisense that I can find and use? Other stackoverflow questions

cli/C++ how to define cli::array with unmanaged type element?

断了今生、忘了曾经 提交于 2019-12-11 03:28:43
问题 I have a native C/C++ struct typedef struct { ... } AStruct; and in C++/CLI code i define one delegate and one cli array as following public delegate void UpdateDataDelegate(AStruct% aSt,AStruct% bSt); cli::Array<AStruct>^ args=gcnew cli::Array<AStruct>(2); // complile failed!!!!。 this->Invoke(updateData,args); AStruct has many fields and was used by many modules so if i don't like to write a mananged wrap for AStruct , how to make above code works? many thanks 回答1: The element type of a

Why is there no intellisense in a CLR/CLI project

元气小坏坏 提交于 2019-12-11 03:27:56
问题 I don't know if I have done anything wrong, but when I try to write code there are no intellisense popups indicating options or errors. I am creating a CLR/CLI type of project with Microsoft's Visual C++ 2010. 回答1: You're not doing anything wrong, Intellisense is not supported in Managed C++ (C++/CLI). There is a long blog post explaining the details at the Visual C++ blog. Edit: Correcting name of the blog as per comment. :) 回答2: See the 2nd comment, in this blog post from May 2009: http:/