我似乎無法找到答案,這個看似簡單的問題在任何地方d:VB.NET檢查,如果形式集中
我想,如果集中在一個表格/窗口,這樣我只能閃光的檢測窗口如果不專注,這裏是代碼的位:
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
有沒有簡單的方法來使這項工作?
[確定程序是否是.NET中的活動窗口]的可能重複(http://stackoverflow.com/questions/893669/determine-whether-program-is-the-active-window-in- net) –
這是C#,這是VB -.- – King
你讀過答案#2嗎?即使這個答案不是VB.NET,但是C#,這應該不會有真正的區別。 –