Book Image

D Cookbook

By : Adam Ruppe
Book Image

D Cookbook

By: Adam Ruppe

Overview of this book

Table of Contents (21 chapters)
D Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Calling the Windows API functions


The Windows API provides a rich set of functionalities for applications. The entire Windows API is directly accessible from D. Here, we'll demonstrate this by popping up an information message box and a file chooser dialog box using the standard Win32 API functions.

Getting ready

First, make sure you have correctly installed the DMD compiler for Windows. If you want to build 64-bit applications, you must download and install Visual Studio (any version that supports C++ development, including Express) first because dmd on 64-bit Windows uses the Microsoft linker and libraries for better cross-language compatibility.

You'll also want to create or download the Windows API bindings since the Windows bindings that come with dmd are quite incomplete. You can create your own, as required, by copying and pasting the function and struct prototypes from MSDN.

If you are on 32 bit, you might also want to get the newer .lib files from Microsoft and convert them to the OMF...