You didn't give me code, you gave me links to WMI reference pages. I've
searched through all those pages. I used the WMI Code Creator extensively to
search for anything related to adding a printer port but came up empty. If
you have a specific class for me to look at, i'd appreciate it.
I did, however, get it to work using the AddPortEx API call, though this
call is "obsolete" according to MSDN. Here's the code:
<StructLayout(LayoutKind.Sequential)_
Public Structure PORT_INFO_1
Dim pPortName As String
End Structure
Public Declare Function AddPortEx Lib "winspool.drv" Alias "AddPortExA"
(ByVal pName As String, ByVal pLevel As Integer, ByRef lpBuffer As
PORT_INFO_1, ByVal pMonitorName As String) As Integer
Dim p1 As PORT_INFO_1
p1.pPortName = "C:\PrinterFile.txt"
API.apiAddPortEx(Nothing, 1, p1, "Local Port")
Now I need to figure out how to delete a port. There is a DeletePort API
call, but it throws up a dialog for the user. I want to delete the port
without user intervention. There isn't a DeletePortEx call that I can find
(as a counterpart to the AddPortEx call).
"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:%2***************@TK2MSFTNGP02.phx.gbl...
>I am sure I gave you the WMI code for this arounf 10 days ago Tery. If it
wasn't you then it was another user
--
Newbie Coder
(It's just a name)