How make Form Flash Ms Access With VBA
To make a form flash in Microsoft Access using VBA, you can use the FlashWindow
function from the User32
Windows API. This function allows you to make a window flash to alert
the user that the window has received attention. Here is an example of
how you can use the FlashWindow
function to make a form flash in Access:
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Sub cmdFlashForm_Click()
' Get the handle of the form window
Dim hwnd As Long
hwnd = Me.hWnd
' Make the form window flash
FlashWindow hwnd, True
End Sub
In this example, we are using the FlashWindow
function to make the form window flash when the user clicks a command button. The FlashWindow
function takes two arguments: the handle of the window to flash, and a Boolean value that specifies whether to flash the window or stop flashing it. In this case, we are passing the handle of the form window (which we obtain using the hWnd
property of the Me
object) and True
to flash the window.
You can also use the FlashWindowEx
function from the User32
Windows API to control the flashing behavior of the window. This function allows you to specify the number of times to flash the window, the rate at which the window should flash, and whether the flashing should stop when the user restores the window or when the window receives focus. Here is an example of how you can use the FlashWindowEx
function to control the flashing behavior of a form window:
Private Declare Function FlashWindowEx Lib "user32" (ByRef pfwi As FLASHWINFO) As Long
Private Type FLASHWINFO
cbSize As Long
hwnd As Long
dwFlags As Long
uCount As Long
dwTimeout As Long
End Type
Private Const FLASHW_ALL = &H3
Private Const FLASHW_TIMERNOFG = &HC
Private Sub cmdFlashForm_Click()
' Create a FLASHWINFO structure
Dim fwi As FLASHWINFO
fwi.cbSize = Len(fwi)
fwi.hwnd = Me.hWnd
fwi.dwFlags = FLASHW_ALL Or FLASHW_TIMERNOFG
fwi.uCount = 3
fwi.dwTimeout = 0
' Make the form window flash
FlashWindowEx fwi
End Sub
0 Response to "How make Form Flash Ms Access With VBA"
Post a Comment