DDE

 

mIRC supports DDE communication, which allows external applications to control mIRC or to request information from it. Note that it is also possible to communicate with mIRC directly by using SendMessage(). The default DDE service name is mIRC, though this can be changed in the options dialog.

 

DDE Topics

mIRC supports the following DDE Topics.

 

For each of the following DDE topics an example is given using the /dde command and $dde() identifier (both are explained after this section) which should help you understand how they work.

 

Topic: COMMAND

Transaction Type: XTYP_POKE

Item: None

Data (Arguments): One line of text containing the command to be performed.

Returns:Nothing

Example: /dde mirc command "" /server irc.dal.net

Description: This tells mIRC to execute whatever command you give it.

 

Topic: EVALUATE

Transaction Type: XTYP_REQUEST

Item: The line of text containing variables or identifiers that you want evaluated

Data (Arguments): None

Returns:Evaluated line

 

Topic: CONNECT

Transaction Type: XTYP_POKE

Item: None

Data (Arguments): one line of text in the form: address,port,channel,number

Returns:Nothing

Example: /dde mirc connect "" irc.undernet.org,6667,#mIRC,1

Description: This will tell mIRC to connect to the server irc.undernet.org, port 6667 and after it has connected it will automatically join channel #mIRC. If the number at the end is a 1 then the mIRC window will be activated, if it is a 0 it will not.

 

Topic: CONNECTED

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns:"connected" if you are connected to a server, "connecting" if you are in the process of connecting to a server, and "not connected" if you are not currently connected to a server.

Example: //echo mIRC is currently $dde(mirc, connected) to a server

 

Topic: EXENAME

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: The full path and name of the mIRC EXE file. eg. "c:\mirc\mirc.exe"

Example: //echo The mIRC exe path and name is $dde(mirc, exename)

Description: This might be useful for applications that need to know the path and name of the exe file.

 

Topic: VERSION

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: mIRC version info.

Example: //echo The version number is $dde(mirc, version)

 

Topic: INIFILE

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: The full path and name of the main INI file that is being used. eg. "c:\mirc\mirc.ini"

Example: //echo The main ini file is $dde(mirc, inifile)

Description: This might be useful for applications that need to take a look at the INI file for various bits of information.

 

Topic: NICKNAME

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: The nickname currently being used.

Example: //echo My mIRCbot is using the nickname $dde(mirc, nickname)

 

Topic: SERVER

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: The server to which you were last or are currently connected. eg. "irc.undernet.org"

Example: //echo The current server is $dde(mirc, server)

 

Topic: PORT

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: The port currently being used to connect to the irc server

Example: //echo My mIRCbot is using port $dde(mirc, port)

 

Topic: CHANNELS

Transaction Type: XTYP_REQUEST

Item: None

Data (Arguments): None

Returns: A single line of text listing the channels which you are currently on separated by spaces. eg. "#mirc #mircremote #irchelp"

Example: This should only be called by an application, not from within an mIRC alias.

Description: The line of text that this returns could be quite long, so an application should be prepared to handle this.

 

Topic: USERS

Transaction Type: XTYP_REQUEST

Item: Channel name, in the form #channel

Data (Arguments): None

Returns: A single line of text listing the users on the specified channel separated by spaces.

Example: This should definitely only be called by an application, not from within an mIRC alias.

Description: You can only request the names of users on a channel which mIRC has joined. The line of text that this returns could be quite long, so an application should be prepared to handle this.

 

DDE Commands and Identifiers

The following commands and identifiers allow you to communicate with other DDE-enabled applications.

 

All DDE transactions are synchronous, mIRC waits at most one second for a reply or acknowledgement to any DDE request that it makes.

 

/ddeserver [[on [service name]] | off]

The default DDE service name is mIRC. The mIRC DDE Server defaults to on at startup unless it finds another mIRC or another application using its current DDE Service name.

 

You can use the /ddeserver command to manually turn the dde server on or off. If you have more than one mIRC acting as a DDE server then you should specify a different service name for each mIRC.

 

/dde [-re] <service> <topic> <item> [data]

This sends an XTYP_POKE by defaults unless you specify the -r switch in which case an XTYP_REQUEST is sent, or if you specify the -e switch, an XTYP_EXECUTE is sent.

 

If you are sending an XTYP_POKE then all four arguments are mandatory.

 

If you are sending an XTYP_REQUEST then the first three arguments are mandatory. This is why you can see a "" in the examples above, it acts as a filler and is not actually used for anything.

 

If you are sending an XTYP_EXECUTE then only the first three arguments are required.

 

$dde(name, topic, item, delay)

Returns the value returned by the specified service name, topic, and item, by sending an XTYP_REQUEST.

 

//echo My other mIRC is $dde(mirc, connected) to $dde(mirc, server)

 

The item and delay parameters are optional.

 

The delay value indicates that you want $dde() to wait N seconds for a reply before giving up. The default is one second, which is usually enough.

 

Note: If the value returned by $dde is too long for mIRC to handle, $dde returns a value of $error.

 

$isdde(name)

Returns $true if the specified dde name is in use, $false otherwise.

 

$ddename

Returns the current dde service name in use by the mIRC DDE Server.