c++-cli

Windows Phone 8 I Can't add c++ Template to project

故事扮演 提交于 2019-12-08 09:46:06
问题 Let's describe my problem: I've created a Windows 8 App already, its written in c++/cli and xaml. Now I want to get this App to Windows Phone 8. So my first step is creating a new project: Then I want to add a new element based on a c++ template but VS just shows me c# templates: You remember? I created a project based on C++! How can I add new elements based on c++ template like I do in normal Windows 8 SDK?: Do I have to download those templates somewhere? Is there any other way to get my

Cannot add a reference to PCL from C++/Cli project

情到浓时终转凉″ 提交于 2019-12-08 09:09:50
问题 I have a Portable Class Library project, Net 4.5 platform activated. I can use it in other C# projects without problems. Now, I have a C++/Cli project and I need to use some classes of the above PCL project. When I add the reference to the PCL project, Visual Studio 2012 gives me an error because of different target platforms. Is there a problem to add references to PCL projects from C++/Cli projects? Thank you 回答1: This questionas was replied but for some unknown reason, the response has

C# How to P/Invoke NtRaiseHardError

六眼飞鱼酱① 提交于 2019-12-08 09:08:56
问题 The following C++ code causes a bluescreen. #include "stdafx.h" #include <iostream> #include <string> #include <Windows.h> #pragma comment(lib, "ntdll.lib") using namespace std; EXTERN_C NTSTATUS NTAPI RtlAdjustPrivilege(ULONG, BOOLEAN, BOOLEAN, PBOOLEAN); EXTERN_C NTSTATUS NTAPI NtRaiseHardError(NTSTATUS, ULONG, ULONG, PULONG_PTR, ULONG, PULONG); int main(int argc, char **argv) { BOOLEAN bl; RtlAdjustPrivilege(19, TRUE, FALSE, &bl); unsigned long response; NtRaiseHardError(STATUS_ASSERTION

Taking a screenshot C++ cli

喜夏-厌秋 提交于 2019-12-08 08:39:13
问题 I've seen the following code that takes a screenshot and saves it as jpg, I've managed to compile and run it as win32 CONSOLE application, But when I tried to use the following code in A windowsForm/CLI (there is just a button that should take a screenshot) project, I got the following errors: 1>screenshoter.obj : warning LNK4248: unresolved typeref token (0100002C) for 'Gdiplus.GpCachedBitmap'; image may not run 1>screenshoter.obj : error LNK2028: unresolved token (0A000017) "extern "C" int

How to get an BITMAP struct from a RenderTargetBitmap in C++/CLI?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 08:34:49
问题 I've got a WPF RenderTargetBitmap in C++/CLI and I want to be able to create a BITMAP structure from it to use with BitBlt. I've not worked with BITMAP or RenderTargetBitmap much before, so any thoughts would be great! 回答1: Turns out that it was a little more complicated than simply using CopyPixels. In the C++/CLI managed code, I do the following: virtual BOOL fillBitmap(CDC* dc, CBitmap* bmp) { WPFContainer^ page = getWPFContainer(); // Get a bitmap from the DVE page RenderTargetBitmap ^rtb

wrapper to c++/cli

坚强是说给别人听的谎言 提交于 2019-12-08 06:32:06
问题 What is the basic structure of a wrapper to c++/cli so it can be called from c# ? 回答1: A wrapper for a C++ class Blah: EDIT: ref class BlahWrapper { BlahWrapper () { blah = new Blah(); } !BlahWrapper() { //Destructor called by GC if (blah != null) { delete blah; blah = null; } } ~BlahWrapper() { //Dispose() called in "using" blocks, or manually dispose if (blah != null) { delete blah; blah = null; } } private: Blah* blah; } 来源: https://stackoverflow.com/questions/4985907/wrapper-to-c-cli

Add a customized header to WebBrowser control for all requests in C++/CLI?

▼魔方 西西 提交于 2019-12-08 05:40:22
问题 I'm trying to reproduce this C# workaround in C++/CLI, but it doesn't work, here's my code: private: System::Void WebBrowser1_Navigating(System::Object^ sender, System::Windows::Forms::WebBrowserNavigatingEventArgs^ e) { System::Diagnostics::Debug::WriteLine("Running..."); auto activeXInstance = (SHDocVw::IWebBrowser2^) this->webBrowser1->GetType()->InvokeMember("ActiveXInstance", System::Reflection::BindingFlags::GetProperty | System::Reflection::BindingFlags::Instance | System::Reflection:

Unable to use Visual Studio project on different computer

一世执手 提交于 2019-12-08 05:38:39
问题 I was working on a project (winforms, C++/Cli) on my desktop. When I copy project files to use it in my laptop, designer do not open. References to the 3rd party library[MetroFramework] is properly linked (project compile & run fine, no build error) but if I open designer I receive the following error C++ CodeDom parser error: Line:99,Column:27 --unknown type".please make sure that the assembly that contains this type is referenced. if this is a part of your development project, make sure

C# exception thrown from a C++ managed dll - EEFileLoadException * __ptr64

旧街凉风 提交于 2019-12-08 05:06:42
问题 I get this error from within a normal C# console program that's consuming a DLL produced as the build output of a C++ CLI project. There I have a simple DumbThing public ref class with a static method. I'd like to simply call that function or at least instantiate one tiny DumbThing object and see that C# can call code that it gets from a C++ CLI born DLL, but it's not working as it throws an error that puzzles me even more: First-chance exception at 0x000007fefd2acacd (KernelBase.dll) in

C++/CLI AES 256-bit Encryption

懵懂的女人 提交于 2019-12-08 04:58:48
问题 Most examples and questions I've found so far is for C# only, however I'm trying to reproduce the following C# code into C++/CLI: using System.Security.Cryptography; using System.IO; public byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes) { byte[] encryptedBytes = null; // Set your salt here, change it to meet your flavor: // The salt bytes must be at least 8 bytes. byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; using (MemoryStream ms = new MemoryStream()) {