Using Win32 DLL Exports in .NET Code

Aside from using COM objects in .NET code, there is a common requirement to use regular Win32 DLL routines. These could be aspects of the Win32 API that are not already made available though the .NET Framework Class Library or could be routines from arbitrary DLLs written by yourself or a third party. Examples of the former might include the high performance timing APIs, QueryPerformanceCounter and QueryPerformanceFrequency. Another example is the simple API that makes a beep: Beep.

Note

Technically the .NET Framework does actually surface a routine that makes a beep, but this is part of the Visual Basic .NET runtime assembly Microsoft.VisualBasic.dll. Generally, only Visual Basic .NET applications have a ...

Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.