my program uses speech recognition, and when i start it, it also starts Windows Speech Recognition (sapisvr.exe). What i want to do is to start WSR minimized. I tryed it this way:
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As SHOW_WINDOW) As Boolean <Flags()> _ Private Enum SHOW_WINDOW As Integer ' SW_HIDE = 0 SW_SHOWNORMAL = 1 SW_NORMAL = 1 SW_SHOWMINIMIZED = 2 SW_SHOWMAXIMIZED = 3 SW_MAXIMIZE = 3 SW_SHOWNOACTIVATE = 4 SW_SHOW = 5 SW_MINIMIZE = 6 SW_SHOWMINNOACTIVE = 7 SW_SHOWNA = 8 SW_RESTORE = 9 SW_SHOWDEFAULT = 10 SW_FORCEMINIMIZE = 11 SW_MAX = 11 End Enum Private Sub MaximizeSWR() For Each p As Process In Process.GetProcessesByName("sapisvr") 'ShowWindow(p.MainWindowHandle, SHOW_window.SW_HIDE) 'ShowWindow(p.MainWindowHandle, SHOW_window.SW_SHOWMINIMIZED) 'ShowWindow(p.MainWindowHandle, SHOW_window.SW_FORCEMINIMIZE) ShowWindow(p.MainWindowHandle, SHOW_window.SW_MINIMIZE) Next p End Sub
I tryed all the flags related to minimizing, but all i was able to achieve was WSR to dissapear, but leaving instead the shadow under it, as shown in the picture. I mention that if i hover over the shadow, it still displays that label "Windows Speech Recognition listening mode", as if the progroam is still there. Also, i can drag it around the screen. How can i make it not to show any window?