3 Replies - 1668 Views - Last Post: 20 December 2012 - 07:17 AM Rate Topic: -----

#1 rusoaica  Icon User is online

  • They're watching you, Neo!
  • member icon

Reputation: 138
  • View blog
  • Posts: 506
  • Joined: 10-March 12

start sapisvr.exe minimized

Posted 12 May 2012 - 06:56 AM

hello!

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?

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: start sapisvr.exe minimized

#2 Nerfpl  Icon User is offline

  • D.I.C Head

Reputation: 43
  • View blog
  • Posts: 165
  • Joined: 15-January 12

Re: start sapisvr.exe minimized

Posted 12 May 2012 - 08:35 AM

Odd. I used
ShowWindow(p.MainWindowHandle, 2) //this minimizes
ShowWindow(p.MainWindowHandle, 0) //this hides task bar afterwards



and it hides the window without issues. Maybe order matters.

This post has been edited by Nerfpl: 12 May 2012 - 08:36 AM

Was This Post Helpful? 1
  • +
  • -

#3 rusoaica  Icon User is online

  • They're watching you, Neo!
  • member icon

Reputation: 138
  • View blog
  • Posts: 506
  • Joined: 10-March 12

Re: start sapisvr.exe minimized

Posted 12 May 2012 - 08:44 AM

thank you very much, that did the trick! but now i am facing another problem... Windows Speech Recognition always starts turned off, so i have to click on that microphone button to make it active and listening for voice commands... how can i make WSR start in "Listening" mode?
Was This Post Helpful? 0
  • +
  • -

#4 Yagami5159  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-December 12

Re: start sapisvr.exe minimized

Posted 20 December 2012 - 07:17 AM

I'm sorry for bothering, I know this post is already few months old but may I ask the process of sapisvr.exe have how many Window Handle? The reason I'm asking this because my coding couldn't make the sapisvr.exe minimized like the post above. I found the ProcessID and the window handle(one)but it just couldn't minimized.

P/S: I'm using C++.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1