managed

Best way to call 32-bit unmanaged code from 64-bit Managed Code using a managed code wrapper

女生的网名这么多〃 提交于 2019-12-03 09:02:28
问题 The frequency with which I am coming across the situation where I have to call native 32-bit code from a managed 64-bit process is increasing as 64-bit machines and applications become prevalent. I don't want to mark my applciation as 32-bit and I cannot obtain 64-bit versions of of the code that is being calling. The solution that I currently use is to create C++ COM shims that are loaded out of process to make the 32-bit calls from the 64-bit process. This COM shim solution works well and

How to use SQLite on new Windows 8.1 Store app (Visual Studio 2013)

我们两清 提交于 2019-12-03 06:57:45
So, I installed Visual Studio 2013 on my Windows 8.1 box. I want to experiment with it and created a new Windows Store Grid App . I want to persist data on a SQLite database, apparently the database of choice for WinRT apps. Quickly found links to the vsix needed in order to be able to use the SDK: SQLite download page , and downloaded sqlite-winrt81-3080002.vsix. Installed it, then in my project, added the reference to the newly installed SDK (right click references, add reference, navigate to Windows, select extensions and tick SQLite for Windows Runtime (Windows 8.1) checkbox. Also quickly

JSF Managed Bean auto-create?

☆樱花仙子☆ 提交于 2019-12-03 04:25:08
问题 Is it possible to have a JSF managed bean be automatically created? For example I have several session scoped beans. Sometimes it becomes necessary to access these instances in code (rather than just in JSF) this is done by: PageBean pageBean = (PageBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("pages"); However if no page has already been visited which calls to '#{pages}' this resolves to null ... is there anyway to get JSF to create a bean when the scope

What exactly happens during a “managed-to-native transition”?

為{幸葍}努か 提交于 2019-12-03 04:17:42
问题 I understand that the CLR needs to do marshaling in some cases, but let's say I have: using System.Runtime.InteropServices; using System.Security; [SuppressUnmanagedCodeSecurity] static class Program { [DllImport("kernel32.dll", SetLastError = false)] static extern int GetVersion(); static void Main() { for (; ; ) GetVersion(); } } When I break into this program with a debugger, I always see: Given that there is no marshaling that needs to be done (right?), could someone please explain what's

Performance of Managed C++ Vs UnManaged/native C++

不羁岁月 提交于 2019-12-03 03:45:21
I am writing a very high performance application that handles and processes hundreds of events every millisecond. Is Unmanaged C++ faster than managed c++? and why? Managed C++ deals with CLR instead of OS and CLR takes care of memory management, which simplifies the code and is probably also more efficient than code written by "a programmer" in unmanaged C++? or there is some other reason? When using managed, how can one then avoid dynamic memory allocation, which causes a performance hit, if it is all transparent to the programmer and handled by CLR? So coming back to my question, Is managed

Best way to call 32-bit unmanaged code from 64-bit Managed Code using a managed code wrapper

做~自己de王妃 提交于 2019-12-02 23:07:08
The frequency with which I am coming across the situation where I have to call native 32-bit code from a managed 64-bit process is increasing as 64-bit machines and applications become prevalent. I don't want to mark my applciation as 32-bit and I cannot obtain 64-bit versions of of the code that is being calling. The solution that I currently use is to create C++ COM shims that are loaded out of process to make the 32-bit calls from the 64-bit process. This COM shim solution works well and the cross process calls are handled behind the scenes by COM, which minimises the overhead of this

.NET managed dll custom actions in Installshield 2018

*爱你&永不变心* 提交于 2019-12-02 06:21:09
问题 I am using Installshield 2018 Express edition to make my setup and I wanted to include some custom actions coded in .NET, but I can't find the way to reference a custom action in .NET. I guess Installshield would have an option to refer to the assembly, class and public method to be invoked for the custom action but I can't find any option to do that. ¿Is there any way to achieve this? I'd prefer to use a dll instead of an exe and having to deal with the command line args, etc. 回答1: Express

How to pass a string argument from C++ to a managed C# DLL

给你一囗甜甜゛ 提交于 2019-12-02 02:25:58
问题 I'm writing a C++ program that needs to call a DLL written in C#. I followed these instructions for creating my C# DLL and linking in to it from my C++. https://support.microsoft.com/en-us/kb/828736 I have a C# function that takes a string as an argument. How do I pass a string out of C++ into my C#? 回答1: I couldn't find a concise answer to this question, so I'm putting my solution here in the hope that it helps someone in the future. TL;DR: You need to use a BSTR to pass strings back and

How to pass a string argument from C++ to a managed C# DLL

此生再无相见时 提交于 2019-12-02 02:13:48
I'm writing a C++ program that needs to call a DLL written in C#. I followed these instructions for creating my C# DLL and linking in to it from my C++. https://support.microsoft.com/en-us/kb/828736 I have a C# function that takes a string as an argument. How do I pass a string out of C++ into my C#? I couldn't find a concise answer to this question, so I'm putting my solution here in the hope that it helps someone in the future. TL;DR: You need to use a BSTR to pass strings back and forth between C# and C++. Here is how I did it. C# Code Here is a sample of my C# code. A few things to note:

How do I create a non managed Windows GUI in Visual C++?

百般思念 提交于 2019-12-02 00:24:21
问题 When I create a 'Windows Forms Application', the resultant program is a managed one. Creating a 'Win32 Application' results in a native one, but when I try to add a form I'm informed that the project will be converted to CLI if I continue. How do I design a native Windows GUI with Visual C++ 2008 Express Edition? I'm probably being very silly here, but I just can't figure it out. 回答1: As Reed Copsey, MFC would be the "default" way of creating a native unmanaged GUI on the Windows platform.