用c#实现添加网络打印机,调用系统API,来操作注册表,实现打印机名称,驱动,端口(IP),三者的添加。附一段小小的代码:
public bool Add(string PrinterName, string ip, string DriverName)
{
if (!ExistPort(ip))
{
Microsoft.Win32.RegistryKey _Regisity = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports", true);
Microsoft.Win32.RegistryKey RK = CreateRegistryKey(_Regisity, ip);
1