mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,150
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
Originally Posted By: /help sendmessage
Extended Error Information
If cMethod is or'd with the value 16, this will make SendMessage() return more useful error values instead of just 0 for failure and 1 for success. The return values are: 0 = success, 1 = failure or'd with 2 = bad mapfile name, 4 = bad mapfile size, 8 = bad eventid, 16 = bad server, 32 = bad script, 64 = disabled (if disabled in the Other dialog).


If I try to evaluate "$script(0", creating an error, sendmessage returns 1 and not 33

Code:
LPCWSTR l = "mIRC";
HANDLE file = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, l);
LPSTR str = (LPSTR)MapViewOfFile(file, FILE_MAP_ALL_ACCESS, 0, 0, 0);
strcpy(str, "$script(0");
int ss = SendMessage(hwnd, WM_MEVALUATE, 0, 0);


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,421
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,421
The "bad script" error in this context means that the script does not exist. This can be returned if you use $eventid to SendMessage() in the context of a remote event but the script from which it was called no longer exists.

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Hmm, shouldn't a script-level failure have its own code then? Or is that implied by '1' combined with the absence of any other bits? In that case, is it guaranteed that there are no other cases that generate a result of just '1'? I think the help file could be a little bit more clear about this, especially since these codes aim to clarify the source of the problem..


Saturn, QuakeNet staff
Joined: Dec 2002
Posts: 5,421
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,421
Quote:
Or is that implied by '1' combined with the absence of any other bits?

Yes.

Quote:
is it guaranteed that there are no other cases that generate a result of just '1'?

Yes.

Quote:
I think the help file could be a little bit more clear about this

Looking at the help file, the errors seem fairly self-explanatory except for "bad script" and "bad server". In retrospect, I probably should not have added these as errors because they can only be returned if an event id is specified that does not have the original server/script present, so they should have been subsumed under "bad id". As they are already there, they will require a more complicated explanation in the help file.

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Thanks, good to know! With respect to the help file, what I meant was documentation of specifically the case of just '1' for script-level failures, which has to be deduced by trial-and-error right now. Simply something like "or just 1 for script errors" at the end of the current sentence would help a lot here I think.


Saturn, QuakeNet staff

Link Copied to Clipboard