dAddPort

Adds the specified port to the specified port monitor.

 

BOOL            dAddPort(LPSTR lpPortName, LPSTR lpMonitorName)

 

Input value lpPortName

the name of the port to be added. The maximum number of characters is 246. The PORT_NAME cannot contain any of following characters: *?|

Input value lpMonitorName

the name of the port monitor to add the port to

Return value

Returns 0 if the port monitor was successfully added, otherwise the function returns the occurred error code by calling the GetLastError() internally. The GetLastError() returns the last error code that has occurred in the system.

 

NOTE:  This function is outdated, no longer recommended.

 

One of the most common error is Error code: 2:

Meaning: The dAddPort cannot create printer port.

 

Example:

                The dAddPort cannot access to registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\)