|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Something tricky!I have an application that uses a TWAIN activex control. On one
particular scanner driver, I have the option to do a pre-scan. After doing the pre-scan, my application receives focus again and looks like it is hanging because the pre-scan window is still open waiting for me to accept the scan. I can then simply click the prescan window in the taskbar to open that window and accept the prescan. I'm wondering if there is a way to look for a particular window that may have been opened by an activex control and give it focus, or look for a the name of an application in the taskbar and give it focus... I guess I just need some sort of hack. Anyone have any ideas? Thanks, Dustin You can do this by querying the process list
hth Michel Posseth [MCP] Show quoteHide quote "Dustin Davis" <dus***@davisvillage.com> schreef in bericht news:OR%23He4ulGHA.3588@TK2MSFTNGP02.phx.gbl... >I have an application that uses a TWAIN activex control. On one particular >scanner driver, I have the option to do a pre-scan. After doing the >pre-scan, my application receives focus again and looks like it is hanging >because the pre-scan window is still open waiting for me to accept the >scan. I can then simply click the prescan window in the taskbar to open >that window and accept the prescan. > > I'm wondering if there is a way to look for a particular window that may > have been opened by an activex control and give it focus, or look for a > the name of an application in the taskbar and give it focus... I guess I > just need some sort of hack. Anyone have any ideas? > > Thanks, > Dustin here some example code
( reusable class module i once wrote ) this one is showing msinfo and raises an event when it is closed documented in dutch but it is pretty simple to understand and it shows what i mean Imports System.Diagnostics Imports Microsoft.Win32 Imports System.Threading Namespace MPSoft Public Class clsMsInfo Private Function exeFile() As String exeFile = String.Empty Try ' haal het pad naar MSINFO32.EXE uit het register Dim key As RegistryKey key = Registry.LocalMachine.OpenSubKey( _ "SOFTWARE\Microsoft\Shared Tools\MSInfo") If key Is Nothing Then Throw New Exception("Registry key not found") End If exeFile = key.GetValue("Path", "").ToString() key.Close() Finally If String.IsNullOrEmpty(exeFile) OrElse Not My.Computer.FileSystem.FileExists(exeFile) Then 'blijkbaar hebben we geen registry access , of de waardes aldaar zijn corrupt 'we hopen dus maar dat de environment variabelen dit probleem voor ons oplossen exeFile = "msinfo32.exe" End If End Try End Function Public Event MsInfoClosed() ''' <summary> ''' Starts the ms system info dialog and raises an event when closed ''' the prefered start method for this sub is asynchronous ( asynch delegate ) ''' </summary> Public Sub StartMsInfo() 'start het process Dim proc As Process = Process.Start(exeFile) Thread.Sleep(2000) ' pauseer de thread zodat we zeker weten dat de proces lijst is geupdated Dim closed As Boolean 'wanneer true dan is de system information dialog afgesloten Do Until closed Thread.Sleep(5) Dim ref As Boolean For Each proc In Process.GetProcesses 'loop door de proces lijst If proc.ProcessName.Trim = "HelpCtr" Then ref = True 'gevonden dus weg hier en check opnieuw Exit For End If ref = False Next closed = Not ref Loop 'laat weten dat de info dialog is afgesloten RaiseEvent MsInfoClosed() End Sub Public Event MsinfoRapportCreated(ByVal ReportLocation As String) ''' <summary> ''' Maakt een MS info rapport van het gehele systeem ''' </summary> ''' <param name="outfile">file path voor rapport </param> Public Sub MsInforapport(Optional ByVal outfile As String = "c:\Temp\Report.txt") Try Dim proc As Process = Process.Start(exeFile, "/report " & outfile) ' wacht to het proces klaar is (dit kan even duren ) proc.WaitForExit() RaiseEvent MsinfoRapportCreated(outfile) Catch ex As Exception 'doe niets End Try End Sub End Class End Namespace Show quoteHide quote "Michel Posseth [MCP]" wrote: > > You can do this by querying the process list > > > hth > > Michel Posseth [MCP] > > > "Dustin Davis" <dus***@davisvillage.com> schreef in bericht > news:OR%23He4ulGHA.3588@TK2MSFTNGP02.phx.gbl... > >I have an application that uses a TWAIN activex control. On one particular > >scanner driver, I have the option to do a pre-scan. After doing the > >pre-scan, my application receives focus again and looks like it is hanging > >because the pre-scan window is still open waiting for me to accept the > >scan. I can then simply click the prescan window in the taskbar to open > >that window and accept the prescan. > > > > I'm wondering if there is a way to look for a particular window that may > > have been opened by an activex control and give it focus, or look for a > > the name of an application in the taskbar and give it focus... I guess I > > just need some sort of hack. Anyone have any ideas? > > > > Thanks, > > Dustin > > >
Question about Datasets and ASP.NET
Type xxx not defined #2 Global variables dataadapter and stored procs in design time get first 50 characters numbers investigation Multilanguage support Mulitp app.config files in multiple project solution Problems with structure in structure and DLL function call in VB.NET Problems with structure in structure and DLL function call in VB.NET |
|||||||||||||||||||||||