Unmanaged refers to Windows code that is independent of the Common Language Runtime(CLR). COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.
Questions tagged [unmanaged]
1488 questions
21
votes
3 answers
CallbackOnCollectedDelegate was detected
I am subclassing an application. My subclassed Window procedure is within a DLL. My subclassing code inside the DLL looks somewhat like this (stripped down, removed other non-related parts).
class FooBar
{
private delegate int…

Water Cooler v2
- 32,724
- 54
- 166
- 336
20
votes
2 answers
How can I convert an unmanaged IntPtr type to a c# string?
I'm new to C# (from a native C++ background) and I'm trying to write a little UI to print windows broadcast messages among other things. I've overridden the default WndProc message loop in my C# program like…

Benj
- 31,668
- 17
- 78
- 127
20
votes
1 answer
Why do I need a redistributable package on unmanaged code? (msvcp100.dll)
What is the purpose of the 'msvcrXXX.dll' and 'msvcpXXX.dll'? And what are the differences between msvcr and msvcp?
Why do I need to link them to my binary if it's just a very simple and unmanaged .dll? Is it because it's part of the linker? Why…

lqbweb
- 1,684
- 3
- 19
- 33
20
votes
1 answer
What's the equivalent of WORD in C#?
I'm trying to access an unmanaged library and am lucky to have access to a comprehensive guide to the API.
Unfortunately, I've no idea what the C# equivalent of C++'s WORD type is. Similarly, I've no idea what DWORD would be.

Tom Wright
- 11,278
- 15
- 74
- 148
16
votes
2 answers
What's the difference between a non-unmanaged type and a managed type?
When I wrote the following snippet for experimenting purposes, it raised the hover-error (see screenshot):
Cannot declare pointer to non-unmanaged type 'dynamic'
The snippet:
dynamic* pointerToDynamic = &fields;
While the code is clearly not…

Abel
- 56,041
- 24
- 146
- 247
16
votes
2 answers
Set Windows Service Description in C++
I am using CreateService to installs a Windows Service executable however I can't seem to find out how to set the description for the service.
Does anyone know how to do this?
Thanks.

Nick
- 25,026
- 7
- 51
- 83
16
votes
3 answers
How to get the name of a Win32 Thread?
I know of the non-intuitive process to set the name of a thread under Windows (see "How to set name to a Win32 Thread?"). Is there a way to get the name of the thread? I don't see any Windows API that lets me do this…

Michael Kelley
- 3,579
- 4
- 37
- 41
16
votes
9 answers
What advantages are there to developing a Win32 app in C++ over a .NET app in C#?
I learned windows programming using Visual C++, and the Win32 API. Nowadays, it seems most apps are being developed in .NET using C#. I understand that most of the time there isn't much performance difference between native code and managed code. So…

Joshua Carmody
- 13,410
- 16
- 64
- 83
16
votes
2 answers
Managed C++ to form a bridge between c# and C++
I'm a bit rusty, actually really rusty with my C++. Haven't touched it since Freshman year of college so it's been a while.
Anyway, I'm doing the reverse of what most people do. Calling C# code from C++. I've done some research online and it…

ist_lion
- 3,149
- 9
- 43
- 73
15
votes
1 answer
Managed vs. unmanaged types
I was reading an article about how to use the sizeof operator in C#.
They say: "Used to obtain the size in bytes for an unmanaged type."
I know the difference between managed and unmanaged code. But my understanding is that all code I write in C#…

TGY
- 303
- 3
- 10
15
votes
5 answers
How to generate type library from unmanaged COM dll
I have to use third party, unmanaged COM dll into my .NET application. I need to modify this assembly to produce a custom RCW. In order to Edit Interop Assembly I need the type library of the particular assembly. Can any one explain me that how to…

RoboAlex
- 4,895
- 6
- 31
- 37
15
votes
3 answers
Create unmanaged c++ object in c#
I have an unmanaged dll with a class "MyClass" in it.
Now is there a way to create an instance of this class in C# code? To call its constructor? I tried but the visual studio reports an error with a message that this memory area is corrupted or…

Evgeny007
- 642
- 2
- 6
- 8
14
votes
5 answers
Minimum C# code to extract from .CAB archives or InfoPath XSN files, in memory
Lately I've been trying to implement some functionality which extracts files from an InfoPath XSN file (a .CAB archive). After extensive searching around the internet, it seems that there is no native .NET API for this. All current solutions are…

Matthew Millman
- 512
- 5
- 13
14
votes
3 answers
C#: Converting String to Sbyte*
My C# code uses a Managed C++ Wrapper. To make a new object of this Wrapper's type, I need to convert String's to Sbyte*'s. A few StackOverflow.com posts discussed how to convert String to byte[], as well as byte[] to sbyte[], but not String to…

Kevin Meredith
- 41,036
- 63
- 209
- 384
14
votes
1 answer
How is it that a struct containing ValueTuple can satisfy unmanaged constraints, but ValueTuple itself cannot?
Consider the following types:
(int, int) → managed.
struct MyStruct { public (int,int) Value; } → unmanaged!
Problem: A non-generic structure MyStruct, which has a managed member (int,int) has been evaluated as managed type.
Expected Behavior: A…

Reza Aghaei
- 120,393
- 18
- 203
- 398