@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The AddMonitor function installs a local port monitor and links the configuration, data, and monitor files. !!!!C# Signature: [DllImport("winspool.drv", SetLastError = true, CharSet = CharSet.Auto)] private static extern Int32 AddMonitor(String pName, UInt32 Level, ref MONITOR_INFO_2 pMonitors); !!!!VB Signature: !!!!User-Defined Types: [MONITOR_INFO_2] !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: String sErrorTitle="Installing monitor"; String szMonitor="MyMonitor"; MONITOR_INFO_2 mi2 = new MONITOR_INFO_2(); mi2.pName = szMonitor; mi2.pEnvironment = null; mi2.pDLLName = "mymon.dll"; try { if (AddMonitor(null, 2, ref mi2) == 0) { string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message; MessageBox.Show(String.Format("Adding the monitor failed.\n\nError: {0}", errorMessage), sErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception e) { MessageBox.Show(String.Format("Adding the monitor failed:\n\nException: {0}", e.ToString()), sErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } Documentation: AddMonitor@msdn on MSDN
Edit winspool.AddMonitor
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.