using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { foreach (string arg in args) { //PrintHelpPage(arg); Uri uri = new Uri(arg); runBrowserThread(uri); } // Environment.Exit(0); } private static void PrintHelpPage(string path) { // Create a WebBrowser instance. WebBrowser webBrowserForPrinting = new WebBrowser(); // Add an event handler that prints the document after it loads. webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument); // Set the Url property to load the document. webBrowserForPrinting.Url = new Uri(path); } private static void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e) { // Print the document now that it is fully loaded. ((WebBrowser)sender).Print(); // Dispose the WebBrowser now that the task is complete. ((WebBrowser)sender).Dispose(); } private static void runBrowserThread(Uri url) { var th = new Thread(() => { var br = new WebBrowser(); br.DocumentCompleted += PrintDocument; br.Navigate(url); Application.Run(); }); th.SetApartmentState(ApartmentState.STA); th.Start(); } void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { var br = sender as WebBrowser; if (br.Url == e.Url) { Console.WriteLine("Natigated to {0}", e.Url); Application.ExitThread(); // Stops the thread } } } }>foxpro codes below:
>local m.lcfile >m.lcfile=getfile('xml') >if empty(m.lcfile) >return .f. >endi >run/n notepad /p &lcfile >>
>it returns a result value<=32 want to say fails. >>
>#DEFINE OLECMDID_PRINT 6 >#DEFINE OLECMDID_PRINTPREVIEW 7 >#DEFINE OLECMDEXECOPT_DODEFAULT 0 >#DEFINE LECMDEXECOPT_DONTPROMPTUSER 2 >apie=newObject("internetexplorer) >with apie >...... >.Execwb(OLECMDID_PRINT ,LECMDEXECOPT_DONTPROMPTUSER ) >....... >.quit >endwith >>
>type "filename.txt" >lpt1: >