none
How to Add a TCPIP port programatically using winspool.drv? RRS feed

  • Question

  • I want to add a printer port using my c dll, just like the way the below mentioned vbs does. how to do it?

    'Adding Port
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objNewPort = objWMIService.Get _
        ("Win32_TCPIPPrinterPort").SpawnInstance_

    Wscript.Echo " "
    Wscript.Echo PortName
    Wscript.Echo HostName
    Wscript.Echo PortNumber
    Wscript.Echo SNMPCommunity
    Wscript.Echo " "

    objNewPort.Name = PortName
    objNewPort.HostAddress = HostName
    objNewPort.Protocol = 1
    objNewPort.PortNumber = PortNumber
    objNewPort.SNMPEnabled = True
    objNewPort.SNMPCommunity = SNMPCommunity
    objNewPort.SNMPDevIndex = 1
    objNewPort.Put_

    Tuesday, August 5, 2014 1:06 PM

Answers

  • Duplicated post. Please refer to your first post on August 05, 2014 12:37 PM:

    http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/85587e89-da16-422a-a836-5f91adebdee7/how-to-add-a-tcpip-port-programatically-using-winspooldrv?forum=wdk

    Wednesday, August 6, 2014 5:56 PM