stop application blink in taskbar RRS feed

  • General discussion

  •   Hi,
    I am developing application in VS2003
    On button click I display a new popup window. I also start one thread. This thread checks is this popup window is on the forground, if not then popup window is closed.

    Now what happens is following,
    1. User starts application.
    2. click on button, and popup window is displayed.
    3. User selects different application.
    4. The thread comes to know popup window is not foreground window.
    5. Popup window is closed.
    6. and control returns to "main application window" and as now "main application window" is active again, in taskbar application starts blinking.

    I do not want application to blink in taskbar in this case.

    How can I stop application blink in taskbar?

    Tuesday, September 16, 2008 7:33 AM

All replies

  • Try to set the main form Visible property to false in this scenario. Or using showwindow to modify its state in this scenario.

    Imports System.Runtime.InteropServices 
    Public Class Form1 
        Public Enum WindowShowStyle As UInteger 
            Hide = 0 
            ShowNormal = 1 
            ShowMinimized = 2 
            ShowMaximized = 3 
            Maximize = 3 
            ShowNormalNoActivate = 4 
            Show = 5 
            Minimize = 6 
            ShowMinNoActivate = 7 
            ShowNoActivate = 8 
            Restore = 9 
            ShowDefault = 10 
            ForceMinimized = 11 
        End Enum 
        <DllImport("USER32.DLL", CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _ 
        Private Shared Function FindWindow(ByVal lpClassName As StringByVal lpWindowName As StringAs IntPtr 
        End Function 
        <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ 
        Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As UInteger) As Boolean 
        End Function 
        Dim notepadHandle As IntPtr 
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click 
            notepadHandle = FindWindow("Notepad"Nothing
            Button2.Enabled = True 
            ShowWindow(notepadHandle, WindowShowStyle.Hide) 
        End Sub 
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load 
            Button2.Enabled = False 
        End Sub 
        Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button2.Click 
            ShowWindow(notepadHandle, WindowShowStyle.Restore) 
        End Sub 
    End Class 

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Saturday, September 20, 2008 11:07 AM