Today I started playing with VB-made ActiveX DLL's and interfacing them with mIRC using /com and $com. What I wanted was a way to read through a file type other than a sequential file/plain text file (namely Random Access and Binary files) and return as many matches as are found. It took me an hour or two of revisions, but I was able to come up with a simple solution. Keep in mind this is the first solution I came up with and it's not optimized by any means. If others have better ideas please chime in.
Step 1: Write a function that first checks for the last position in the data file that was read (store this in the registry before exiting or a data file), then start from that point and read the next record, pass data back thru the function. Write the pointer and exit the function. (example available upon request) Later I will probably incorporate some API's into the mix for file searching.
Step 2: Write a simple alias that opens the com for the DLL, accesses the function and passes the string to search for. Do a while loop that continues to loop as long as the resulting data isn't equal to a predestined "end" string. Within the loop get the data from the function, then check the result to see if it matches your criteria, if so do such and such.
;usage /mycomfunction searchstringalias mycomfunction {
;Use Class1 in VBMIRC.DLL and open com
/comopen mycomfunction VbmIRC.Class1 ;while not function result = "Done" loop
while $com(mycomfunction).result != Done {
;acquire data from "readdata" function var %temp = $com(mycomfunction,readdata,1,bstr,$1-)
;store the data in %result
var %result = $com(mycomfunction).result
;Is there a match?
if $1- isin %result { echo %result } ;loop }
;close com
/comclose mycomfunction
}