Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error using FlashWindow API

Status
Not open for further replies.

txmed

Programmer
Mar 23, 2006
65
US
Greetings! I am trying to write a simple app that will flash the form's title bar using the FlashWindow API. However I am getting the this error message:

A call to PInvoke function 'FlashWindowTest1!FlashWindowTest1.Form1::FlashWindow' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Can someone please look at my code and tell me what I am doing wrong?

Thanks!

(txmed)

Code:
Public Class Form1

    Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal bInvert As Long) As Long

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        FlashWindow(Me.Handle, 1)

    End Sub

End Class
 
I figured out my problem. I changed the FlashWindow function signature to:

Code:
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Integer, ByVal bInvert As Integer) As Integer

After than, using the FlashWindow(Me.Handle, 1) statement worked.

(txmed)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top