mIRC Homepage
Posted By: wshs Calling identifiers with SendMessage - 25/01/05 09:25 PM
$identifier(stuff,more stuff,yet more)
$1 gets set to stuff, $2 to more stuff, etc
How do I go about calling an identifier with SendMessage when one of the args to the alias could potentially contain a comma? With mirc scripting, I just set a %var to the text, and call $identifier(%blah,%blah2,etc).
Posted By: tidy_trax Re: Calling identifiers with SendMessage - 25/01/05 09:53 PM
You could do the same with a dll technically:

Code:
strcpy(data,"set %param text,with,commas");
SendMessage([color:red]hwnd[/color],WM_USER + 200,0,0);
strcpy(data,"$identifier(param1,param2,param3,%param)");
char* result = SendMessage([color:red]hwnd[/color],WM_USER + 201,0,0);
strcpy(data,"unset %param");
SendMessage([color:red]hwnd[/color],WM_USER + 200,0,0);


This is assuming you've already set up your filemap.
Posted By: wshs Re: Calling identifiers with SendMessage - 25/01/05 11:03 PM
The problem with doing that is the potential for a variable collision. If a script written/used by the user makes use of a variable of the same name, the results could be nasty. ...and mIRC offers no way to safely generate variable names.
Posted By: tidy_trax Re: Calling identifiers with SendMessage - 25/01/05 11:28 PM
Quote:
...and mIRC offers no way to safely generate variable names.


Since the variable is unloaded as soon as you call the identifier, just give the variable a messy name, eg:

Code:
strcpy(data,"set %__dllname__functionname_1032842 x,y,z");


It's unlikely a name like that will be in use, you could also make a mIRC identifier to return a free variable name:

Code:
alias freevar {
  var %r = $rand(9999,9999999999)
  while ($var($eval(%r,2),1)) { %r = $rand(9999,9999999999) }
  return %r
}
Posted By: wshs Re: Calling identifiers with SendMessage - 25/01/05 11:29 PM
That could actually work. Got me a nice random string function, which should make for a pseudo unique var name. Thanks.
Posted By: tidy_trax Re: Calling identifiers with SendMessage - 25/01/05 11:31 PM
Yw smile
instead of setting a variable etc.. just pass in $chr(44) in the original SendMessage?

it wont be evaluated in the C code but mirc should evaluate it after its passed
© mIRC Discussion Forums