Blitz2D Advanced: Creating a DLL in Microsoft VC++ 6 for use with BB (v1.71+)
by Speccyman

Introduction:

With the recent addition of DLL support once again the power of to BB (Versions 1.71+) has stepped up a gear. This tutorial does NOT teach you about the Win32 API, nor does it delve into C/C++. It simply shows you how to create a new DLL project that will compile and execute, and more importantly, seamlessly interface with BB.

Creating the project

The example screen shots have been taken from Microsoft Visual C++ version 6. However, I have tested it under Visual Studio.NET Beta 2 and all works fine.

Step 1 - Create the Project

Step 2 - Make sure it's completely empty

Step 3 - Yes, yes, we know!

Step 4 - Create a new Header file (Call it demo)

Step 5 - Add the header code (For each function create a declaration)

In this example, we have called it "helloworld".

Step 6 - Create the main source file (.cpp)

For this example I have called it demo.cpp (So now I have demo.h and demo.cpp)

The DLL Code

Step 7 - The function

OK, I am going to try and show how DLL's add to BB3D.  In this example 2 API functions are called.  Messagebox and FindWindow.  My BB3D app had an AppTitle of "DLL Demo", so my functions finds the window "DLL Demo", and creates a message box using the BB3D Window as the parent.  The function then returns with "1".

Compiling

Step 8 - The Build

Step 9 - This should be the result

The Blitz Basic Code

Step 10 - This is the BB Code (Save it in the same dir as the DLL)

Step 11 - This should be the result

Conclusion

I hope this helps. I would like to see how this is used in the future. If so, let me know.

  • To download the demo and source for this article: Click Here

-Speccyman


For a printable copy of this article, please click HERE.


This site is CopyrightŠ 2000-2004, BlitzCoder. All rights reserved.