$cid and /dll bug - 19/03/05 07:07 AM
Im not sure if this is a bug in the mapped file or in the way mIRC handles the active connection when calling a dll however the returned values are not always correct.
I have a function GetCurrentCID as follows.
its fairly straight forward simply asks mIRC to evaluate $cid wich is of course the current connection id.
The following test dll function is used to test the GetCurrentCID function
As you may be able to tell calling the 'test' function from the dll will pop up a MessageBox showing the current cid. typically this is the cid thats active when you /dll ...
however the following code doesnt work properly. assume you have 2 connections with id's 1 and 2. if you call the following line in connection 1 you would think you get 2 in the MsgBox however you get 1
//scid 2 dll blah.dll test .
ive tried every possibly combination of /scid and /scon you can imagine including /scid 2 | /dll ... and so on. it works the same no matter if its in a script or on a cmd line (in a window).
the following code however works
//scid 2 echo -a $!cid
the only difference is when the 'command' portion is /dll ($dll and $dllcall do the same thing) it fails.
I have a function GetCurrentCID as follows.
Code:
int MIRCAPI GetCurrentCID(void) { if (!IsLibInit()) return -1; wsprintf(mData,"$cid"); SendMessage(m_mWnd,WM_EVALUATE,0,0); return atoi(mData); }
its fairly straight forward simply asks mIRC to evaluate $cid wich is of course the current connection id.
The following test dll function is used to test the GetCurrentCID function
Code:
alias(test) { #pragma ExportThis Text(GetCurrentCID()).MsgBox(); return 3; }
As you may be able to tell calling the 'test' function from the dll will pop up a MessageBox showing the current cid. typically this is the cid thats active when you /dll ...
however the following code doesnt work properly. assume you have 2 connections with id's 1 and 2. if you call the following line in connection 1 you would think you get 2 in the MsgBox however you get 1
//scid 2 dll blah.dll test .
ive tried every possibly combination of /scid and /scon you can imagine including /scid 2 | /dll ... and so on. it works the same no matter if its in a script or on a cmd line (in a window).
the following code however works
//scid 2 echo -a $!cid
the only difference is when the 'command' portion is /dll ($dll and $dllcall do the same thing) it fails.