unmanaged

Autowiring Unmanaged Beans Annotated With @Component

I want to use @AutoWired to inject a non-managed bean configured with @Component into a managed bean. I'm pretty sure I have the configuration right, but for some reason I keep getting the exception: No unique bean of type [foo.Baz] is defined: Unsatisfied dependency of type [class foo.Baz]: expected at least 1 matching bean Based on...

Marshal Unmanaged struct to managed code using c#

Hi experts, I need to process the bytes[] when i get from external application. The external application is also done in c# and they send the bytes thru UDP. They are sending the bytes converted from struct which is stated below : public struct DISPATCH_MESSAGE { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public c...

How to find a child of a parent unmanaged win32 app

Basically I am looking for a win32 method to invoke in C# to set the focus to a children of an unmanaged application. But first I need to find the child control's handle which is the problem. Any useful win32 functions to solve this? ...

calling managed c# component from unmanaged c++ code, how do i define config.

I want to call a C# component from an unmanaged c++ service. I need to set config items expected by the C# component. What name should be config be and where should it be located. eg. parentfolder\cplusplusservice.exe anotherfolder\csharp.dll i need csharp.dll.config or its equivalent. Thanks, ...

Can I dispose of these unmanged resources without requiring a reference to each?

I have a class bMainframe that manages the connections to 4 different mainframes. It allows for the same underlying unmanaged library to be opened in specific ways and more than one mainframe to be connected to at a time. Each library has its own disposal code for the unmanaged mainframe connection resource. The wrapper also has code t...

How do I call managed .NET code from my un-managed C++ code in Windows and vice versa?

I have a pure C++ application developed using VC 6.0. I would like this application to make use of a library developed in C#. How do I call the methods in the C# library from my native executable? I do not want to convert my un-managed C++ native application to managed code. Similarly, how do I do the reverse? Is PInvoke the only option?...

Microsoft.ManagementConsole load legacy snapin?

If I have a snapin that extends Microsoft.ManagementConsole.Advanced.NamespaceExtension, is there anyway I can make this snapin contain some legacy C++ snapins? ...

How do I check if my solution has unmanaged code ?

Hi, We have a number of people working on a project. Is there any tool that will scan and check my entire solution if it has any unmanaged code or non-typesafe code ? The objective is to host the entire solution with completely managed code, find the loopholes and fix them to be type-safe and managed code. What are the common loophole...

Howto: Multiple versions of msvcrt9 as private SxS assemblies?

I have a project that comprises pre-build Dll modules, built some time in the past, using Visual Studio 9. The EXE of the project is built now, using SP1 of Visual Studio 9. When we deploy the EXE we don't want to require administrative access, so the C-Runtime has been bundled into the root of the application. The Dlls: MSVCRT90.DLL a...

Canon EDSDK MemoryStream Image

I've been fighting with the Canon EDSDK for a while now. I can successfully get the library to save a file directly to disk, however, I cannot get a hold of the image byte[] in memory. Whenever I attempt to Marshal.Copy() the EDSDK Stream to byte[], I always get the following error: AccessViolationException: Attempted to read or write...

NUL characters from Marshal.Copy in C#.

I have the following method defined: internal string GetInformation(string recordInformation) { int bufferSize = GetBufferSize(recordInformation); string outputRecord; IntPtr output = Marshal.AllocHGlobal(bufferSize); try { _returnCode = UnmanagedMethod(recordInformation, output, recordInformation.Length); ...

Replace [StructLayout] with something that doesn't use System.Runtime.InteropServices?

I have no experience with low level programing and I need this piece of code to not use [StructLayout(LayoutKind.Explicit)]. My site runs on a shared host and in medium trust. So it won't run if this code is in there. Update: I'm using this inside a Octree to Quantize a png file. Does anyone know a work around? Update New question her...

How C++ can import a DLL made in C#?

I have a DLL made in C#, this DLL contains some clases like Creator. I need to load this DLL and use Creator class in C++ unmanaged, so Is there some way to create that instance or must I load just the functions exposed? I need something like this: CreatorInstance->Init(); Is this posible? ...

Dispose pattern: How do I know what's managed and what's unmanaged?

Reading about the Dispose pattern, I see the documentation repeatedly refer to "cleaning up managed and unmanaged code". And in the canonical implementation of the Dispose method, I see specific flows (depending on whether disposing is true or false) dedicated to the cleanup of managed objects versus unmanaged objects. But am I, the lo...

Memory Leak Detecting and overriding new?

I am attempting to get Memory leak detection working with the help of these two articles: http://msdn.microsoft.com/en-us/library/e5ewb1h3%28VS.80%29.aspx http://support.microsoft.com/kb/q140858/ So in my stdafx.h I now have: #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #define new new(_NORMAL_BLOCK,__FILE__,__LIN...

C# component events?

I am attempting to write a C# component which will expose events. The component is to be imported by an unmanaged C++ application. According to a few tutorials I have come up with this code (for the C# side): namespace COMTest { [ComVisible(true), Guid("02271CDF-BDB9-4cfe-B65B-2FA58FF1F64B"), InterfaceType(ComInterfaceType.InterfaceIsID...

.NET, Call C++ functions from C#

hello, i have a solution, which has a C++ project and a C# project. the C++ project defines a class, which i want to instantiate in C# and call it's member functions. so far what i managed to do is to instantiate the class: CFoo Bar = new CFoo(); but when i try to call a function on it, the compiler says, it is not available. also, w...

Why is unmanaged exception call stack is missing relevant information when caught in managed code?

I have an application that consists of managed and unmanaged DLLs. My managed DLL is a C++/CLR DLL that is used to access a native C++ DLL. When code crosses from managed to native the logic is wrapped in a try/catch statement. The purpose is to log any exceptions before we rethrow them. C++/CLR code calling into native code. try ...

Is it possible to make both a managed and unmanaged versions of the same C++ assembly?

We use a software from another company for one of our products. A developer from that company is kinda 'old' and works in C (no offence). We work in .Net 3.5 (C#). He asked me if it is possible, with the same source code (presumably in C, maybe C++), to create an assembly that he could compile both a managed and unmanaged version. Ar...

Ways to speed up build time? (C#/Unmanaged C++)

A legacy app I am working on currenty takes ~2hours to build. The project has about 170 projects with 150 or so being unmanaged C++ and the other 30 C#.Net 2.0. What are some suggestions on ways to improve build times for something like this? ...