Suggestions for mIRC dll interface - 05/12/03 09:51 AM
Can mIRC provide some methods that can be called by the routines in a dll? mIRC already has a LOADINFO structure, we can simply extend it and add several function pointers, like:
typedef struct {
DWORD mVersion;
HWND mHwnd;
BOOL mKeep;
// GetVar("%myvar")
// returns the value of global variable %myvar
char* (*GetVar)(char *varname);
// SetVar("%myvar","123")
// is equivalent to script line: set %myvar 123
void (*SetVar)(char *varname, char *varvalue);
// GetBinVar("&mybvar")
// returns a byte array contains the value of
// the binary variable &mybvar
char* (*GetBinVar)(char *bvarname);
// SetBinVar("&mybvar", "\x41\x42\x43")
// is equivalent to script line: bset &mybvar 1 41 42 43
void (*SetBinVar)(char *bvarname, char *bvarvalue);
// Eval("wow $+ $calc(12 + 2 * 4)");
// returns "wow20"
char* (*Eval)(char *expression);
// Execute("echo $colour(info) -s This is a test.");
// will display the text "This is a test." in status window.
void (*Execute)(char *command);
// RawSend("3", "PRIVMSG #mIRC UHM...")
// will send the raw text "PRIVMSG #mIRC UHM..." to socket
// of that the connection id ($cid) is equal to "3"
// By using this method, we can send multiply spaces (ASCII 32)
// to chat server.
void (*RawSend)(char *cid, char *rawmessage);
} LOADINFO;
Also, can mIRC add more return code to indicate the error info during dll routines process?
0 means that mIRC should /halt processing
1 means that mIRC should continue processing
2 means that it has filled the data variable with a command which it wants mIRC to perform, and has filled parms with the parameters to use, if any, when performing the command.
3 means that the DLL has filled the data variable with the result that $dll() as an identifier should return.
Maybe...
4 means that an user defined error occurs during the DLL execution, error info has been filled into the data variable.
After a /dll or $dll call, you can examine $dllerr to get the error info text, or no error occurs, $dllerr returns $null.