Home All Groups Group Topic Archive Search About
Author
6 Jun 2006 5:40 PM
cj
Can anyone tell me why this always returns False?  I've got one instance
of notepad running.  It's minimized and showing in the task bar.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
    Dim procArray() As System.Diagnostics.Process

    procArray = System.Diagnostics.Process.GetProcessesByName("notepad")
    If procArray.Length > 0 Then
       MessageBox.Show(IsIconic(procArray(0).Handle))
    End If
End Sub

Author
6 Jun 2006 5:55 PM
Herfried K. Wagner [MVP]
"cj" <cj@nospam.nospam> schrieb:
> Can anyone tell me why this always returns False?  I've got one instance
> of notepad running.  It's minimized and showing in the task bar.
>
> Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button3.Click
>    Dim procArray() As System.Diagnostics.Process
>
>    procArray = System.Diagnostics.Process.GetProcessesByName("notepad")
>    If procArray.Length > 0 Then
>       MessageBox.Show(IsIconic(procArray(0).Handle))

'Handle' will return the process handle.  You may want to use
'MainWindowHandle' instead.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
6 Jun 2006 5:59 PM
cj
Beautiful.  Thanks!

Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "cj" <cj@nospam.nospam> schrieb:
>> Can anyone tell me why this always returns False?  I've got one
>> instance of notepad running.  It's minimized and showing in the task bar.
>>
>> Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Button3.Click
>>    Dim procArray() As System.Diagnostics.Process
>>
>>    procArray = System.Diagnostics.Process.GetProcessesByName("notepad")
>>    If procArray.Length > 0 Then
>>       MessageBox.Show(IsIconic(procArray(0).Handle))
>
> 'Handle' will return the process handle.  You may want to use
> 'MainWindowHandle' instead.
>