0

この一見単純な質問に対する答えはどこにも見つからないようです D:

フォーム/ウィンドウがフォーカスされているかどうかを検出して、ウィンドウのみをフラッシュできるようにしたい フォーカスされていない場合は、コードの一部を次に示します。

If Me.Focused = False Then ' Doesn't work D: please fix
    Dim flash As New FLASHWINFO
    flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash) '/// size of structure in bytes
    flash.hwnd = MyBase.Handle '/// Handle to the window to be flashed
    flash.dwFlags = FLASHW_ALL '/// to flash both the caption bar + the tray
    flash.uCount = 5 '/// the number of flashes
    flash.dwTimeout = 1000 '/// speed of flashes in MilliSeconds ( can be left out )
    '/// flash the window you have specified the handle for...
    FlashWindowEx(flash)
End If

これを機能させる簡単な方法はありますか?

4

1 に答える 1

0
  Private Sub Form1_LostFocus(sender As Object, e As System.EventArgs) Handles Me.LostFocus
    Dim flash As New FLASHWINFO
    flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash) '/// size of structure in bytes
    flash.hwnd = MyBase.Handle '/// Handle to the window to be flashed
    flash.dwFlags = FLASHW_ALL '/// to flash both the caption bar + the tray
    flash.uCount = 5 '/// the number of flashes
    flash.dwTimeout = 1000 '/// speed of flashes in MilliSeconds ( can be left out )
    '/// flash the window you have specified the handle for...
    FlashWindowEx(flash)

  End Sub
于 2012-09-18T06:44:44.490 に答える