From WikiChip
Difference between revisions of "mirc/dynamic-link library"
(→Creating a Dll) |
(→Creating a Dll) |
||
Line 26: | Line 26: | ||
= Creating a Dll = | = Creating a Dll = | ||
− | + | '''Note''': We won't deal with how to create a dll in details, the scripter here must be familiar with dll creation already. | |
+ | |||
+ | The exported functions must have the following function prototype: | ||
<source lang="c">#include <windows.h> | <source lang="c">#include <windows.h> |
Revision as of 11:59, 21 July 2014
mIRC allows you to make calls to DLLs designed to work with mIRC. The main reason you would want to do this is that processing information in a DLL can be far faster than doing so in a mIRC script, so for intensive data processing a DLL would be more efficient.
Note: mIRC also supports calling COM objects, for calling non-standard DLLs.
Using a Dll
Synopsis
/dll <filename> <procname> [data]
/dll -u <filename>
$dll(<filename>, <procname>, [data])
$dllcall(<filename>, <alias>, <procname>, [data])
Switches
- -u - Unloads the dll
Parameters
- <filename> - The filename for the dll you wish to use.
- <procname> - The name of the function/procedure you wish to call.
- [data] - The optional parameters for the function/procedure.
- <alias> - If you use $dllcall, it calls the function asynchronously, meaning that the code won't halt, $dllcall won't return a value. Instead, mIRC calls the specified <alias> when the function finishes.
Creating a Dll
Note: We won't deal with how to create a dll in details, the scripter here must be familiar with dll creation already.
The exported functions must have the following function prototype:
#include <windows.h>
int funcName(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
- mWnd - The handle of the main mIRC window.
- aWnd - The handle of the window in which the command is being issued, this might not be the currently active window if the command is being called by a remote script.
- data - This is a buffer you can write to if you want mIRC to perform a command or to return a value from a $dll call (remember that $dllcall do not return a value by design even if you fill this buffer)
- params - This is a buffer which can be filled if you are filling the 'data' buffer with a command to execute a command, this is the additional parameter of the command to execute.
- show - This Bool value is FALSE if a dot '.' has been used to make the command (/.dll) quiet.
Note: These functions must use the stdcall calling convention. (This is also the standard calling convention for all other Microsoft Win32 API functions.)