Making a mIRC DLL in Borland C++
by Lathiat<Lathiat@subdimension.com>

Introduction:
This tutorial will show you how to effictively create a DLL for mIRC in C++, I am using Borland C++ 3, I dont know if it will compile in any other compiler, but it works in Borland C++ 3, so buy it(hehe)

Quick Note:
I know very little about C/C++, but by reading a tutorial on Creating DLL's in Delphi, Reading the Borland C++ Help FIle as well as the mIRC Help File(under /dll) I found the info I needed to play and finally create a DLL in C++(This took me more than half an hour, be gratefull)

Dirty Work:

Ok, I am assuming you have Borland C++ 3 here, if not, try to follow along

1. Open C++ goto File->New and from the selections double click DLL
2. On opening, Borland C++ spits out a heap of junk, just delete the lot, I will go thorough adding everything you need
3. At the start of our DLL we need to include vcl.h with the following statement
#include <vcl.h>
NB: I don't know why we have to include this, I didnt use the Visual Component Library(I dont think I did), but it wouldnt compile without it, if some wiseguy figures out if I can miss it, mail me, same goes for the DLLEntry Point Statement ahead.

4. Next we need to add the command which "exports" the function we are using for use by the calling program(mIRC).
extern "C" __declspec(dllexport) int __stdcall helloworld(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
NB: after the __stdcall, the world helloworld is actually the name of the function you want to make externel, this will be defined in the next step, for our example program, leave it as helloworld
5. Next i've got another funny state I don't why I have to have, but I do so here it is
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { return 1; }
NB: Again, If I can miss this, email me(email above)

6. Now we need to add the actual function that mIRC will call
int __stdcall helloworld(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{

}

NB: Hehe, tired of NBs, this function doesnt do anything, its the skeleton declaration, the variabled shown in the ()'s are what mIRC passes to the dll.
7. Finally we need to make our function do something, in our example we will make it return "Hello World!" for use with //echo -a $dll(...)
StrCopy(data,"Hello World!");
return 3;

NB: Add these between the { and }'s of the helloworld(or whatever) funtion
8. Finally we need to save it, File->Save As and save it in your mIRC dir preferably(if you dont remember the path and also the name you give the project, ill assume you saved it in your mirc-dir as mircdll
9. Go Project -> Build all Files
10. If you got errors, go back to Step 1, else in mIRC type
//echo -a $dll(mircdll.dll,helloworld,NOT_USED)|
11. Thats it your current mIRC window should display Hello World!

This tutorial was referenced from the Borland C++ Help File, Yes it is a clone of the Delphi tutorial byh Mystic<xirc@ihug.co.nz> I ported it, I also read the mIRC Help File
If you have any problems I probably wont be able to help you, but if its on the basic structure of the DLL(functions, externs(exports)) etc, you can email me(remember I dont know C++ much, dont ask me how to make it mak mIRC stop version replys or something, other people do that.)

By Lathiat written 6/2/2001 at 11pm
Please don't rip this, It took me a couple of hours to figure out all this DLL stuff so, give me credit :P