This example allows you to send commands to MIRC. Make sure your DDE server is on in MIRC (it is by default). Do /DDEServer to find out if it is on. The DDE server should be named MIRC for this to work. If you connect to more than one server at a time there's a chance MIRC will lock up when you try to send a command. I cannot take credit for part of this code since I found it on the net. It works great.

Add this sub into a VB project. Make sure it has a text box named "text1"...


Private Sub mIRCCommand(Cmd As String)

On Error GoTo problem

'Create a DDE connection
If Text1.LinkMode = vbNone Then
Text1.LinkTopic = "MIRC|COMMAND"
' Set link topic.
Text1.LinkMode = vbLinkManual
' Set link mode.
End If

'SendCommand
Text1.LinkExecute "/dde mirc command " & Chr$(34) & Chr$(34) & " " & Cmd

Exit Sub

problem:

' Uh-oh, there was an error
MsgBox Err.Description

End Sub