how can use FlahWindow() on .NET?

  • Thread starter Thread starter gif
  • Start date Start date
G

gif

i want flash the window in a particular moment, i can use FlashWindow() fo
that but it doesn't work on .NET.
 
* "gif said:
i want flash the window in a particular moment, i can use FlashWindow() fo
that but it doesn't work on .NET.

Post the declare you use...
 
* "gif said:
sorry what do u mean?
what must i post?

Sorry... Try this code:

\\\
Private Declare Auto Function FlashWindow Lib "user32.dll" ( _
ByVal Handle As IntPtr, _
ByVal bInvert As Boolean _
) As Int32
..
..
..
Public Sub Flash()
FlashWindow(Me.Handle, True)
End Sub
///
 
Can you translate that code in C++?


Herfried K. Wagner said:
Sorry... Try this code:

\\\
Private Declare Auto Function FlashWindow Lib "user32.dll" ( _
ByVal Handle As IntPtr, _
ByVal bInvert As Boolean _
) As Int32
.
.
.
Public Sub Flash()
FlashWindow(Me.Handle, True)
End Sub
///
 
Gif,

There are three steps to getting this to work:

1. Make sure that the following Imports statement is at the top of the
class file where you want to use an API:
Imports System.Runtime.InteropServices

2. Declare the DLL import:
<DllImport("user32.dll")> _
Private Shared Function FlashWindow(ByVal hwnd as IntPtr, ByVal
invert as Boolean) As Integer
End Function

3. Call the API using the target form's handle and TRUE. Assuming a Windows
Form class called "TargetForm":
Dim myTargetForm as New TargetForm
myTargetForm.Show ' shown modelessly

... other things happen...

FlashWindow(myTargetForm.Handle, True)


HTH,
Derrick
 
Back
Top