Mirc DLL tutorial

Snippets, Projects and Assistance

Moderators: Moderator, Global Moderator

Post Reply
Rift

Mirc DLL tutorial

Post by Rift »

Hi there, thought id put this in for good measure to anyone who was curious about making mirc dll's and didnt feel like learning c++. Here's a brief walk through on the steps to take in Visual Basic 6.

1. Open VB and select the ActiveX DLL.

2. double click Class1 so that you are taken to the code window section of the selected class.

enter the following code into your class1:
[code]Public Function ALPHA(stuff As String)
Dim i As Integer
Dim r As Integer
Dim var As String
var = stuff
Dim var2 As String
For i = 1 To Len(var)
If Mid(var, i, 1) = "," Then
r = r + 1
Else
End If
Next i

For i = 0 To r
Form1.List1.AddItem Split(var, ",")(i)

Next i
For i = 0 To r
var2 = var2 & " " & Form1.List1.List(i)
Next i

ALPHA = var2
End Function[/code]

the above code accepts a string delimted by commas, eg: a,d,e,g,f and will alphabetize it eg: a d e f g.

Youll notice that this doesnt occur by it's self. so how does it actualy alphabetize it? we be lazy and add the string originally passed to the function "stuff", to a listbox with the Sort Property set to TRUE

then we loop through the list box from top to bottom and put it into a buffer string "var2" then once we are done looping through, we set our function Alpha to return our newly alphabetized string, var2.

Well seing as we dont have a form or a listbox for this function
it's best that we add one. click Project > Add Form, and select the regular form, it should be the first one highlighted in the dialog. Next click and select a Listbox Control, and drag it to size on your form, the size doesnt matter though <img src=\'http://www.killanet.net/forum3/public/s ... igwink.gif\' class=\'bbc_emoticon\' alt=\';)\' />. Now set the List1's Sort property to TRUE.

Now click the menu, Project and select Project1 Properties. It should be at the bottom of the menu. Now in the Project Name area change it from Project1 to something suitable like:

AlphaSort

Click OK and the settings will take effect.

Finally to complete the dll, click File > Make AlphaSort.dll


It should succeed. Next we need to register your dll on the system. If you save your dll to C:\AlphaSort.dll the correct register command would be:

regsvr32 C:\AlphaSort.dll

You should receive a message that registering the control succeeded.


Now since this is a vb dll, we have to use it a bit differently in mirc. Here is a sample script to get you started.

alias sort {
comopen sorter AlphaSort.class1
var %resul = $com(sorter,ALPHA,1,*bstr,$1-)
echo -a Result: $com(sorter).result
comclose sorter
}

now you can use the following command:

/sort Rift,Dren,ner0,Adaera

and you should get an echo back in your active mirc window that says

Result: Adaera Dren ner0 Rift


If you get lost whilst trying all this or need some help let me know and ill be glad to lend a hand:) if your ready to critique me then im ready to ignore it:P This is for your own fun and i hope to see more dll's from some people in here:P
FlyingDoggyJake
Sr. Member
Sr. Member
Posts: 254
Joined: Thu Jun 17, 2004 12:37 am

Mirc DLL tutorial

Post by FlyingDoggyJake »

Nice tutorial Rift <img src=\'http://www.killanet.net/forum3/public/s ... /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' /> .... I\'ve always used listboxes to sort alphabetically as well... A real time saver
Last edited by FlyingDoggyJake on Sun Dec 19, 2004 6:12 pm, edited 1 time in total.
ImageImage
Post Reply

Return to “Visual Basic”