I am facing a very weird issue and found no clue why?
that's why i comes here for a reason for the issue..
let me explain; i am trying following code to run a process (Open Printer Preferences Window) and get the Window Handle For Further Processing, the code runs very fine as it should on windows xp environment, but when i try on windows 7 it stuck on the do while loop as MaindWindowHandle Only Returns 0.
here is the code:
any idea?Code:Dim objProcess As System.Diagnostics.Process Dim intHwnd As IntPtr objProcess = New System.Diagnostics.Process With objProcess.StartInfo .FileName = "rundll32" .Arguments = String.Format("printui.dll,PrintUIEntry /e /n {0}{1}{0}", Convert.ToChar(34), "EPSON L130 Series") .UseShellExecute = False End With objProcess.Start() Do While objProcess.MainWindowHandle = IntPtr.Zero //Windows 7 Execution Trapped In This Loop System.Threading.Thread.Sleep(500) objProcess.Refresh() My.Application.DoEvents() Loop intHwnd = objProcess.MainWindowHandle objProcess.Dispose() objProcess = Nothing MessageBox.Show(intHwnd.ToString)
thanks in advance
best regards




Reply With Quote
