A
Andre Nogueira
Hi guys
I am developing a program which draws stuff on the screen (outside of the
form).
For this I use the GetDC function of user32.dll to get a handle to the
desktop, and then use GDI+ to draw. So far so good.
The problem is that before drawing, I have to erase what I had previously
drawn. I tried using the InvalidateRect API function, without luck.
I get this error when I run the program:
A call to PInvoke function 'WindowsApplication1.Form1::InvalidateRect' 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.
This is what I have in my code:
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd As
System.IntPtr, ByVal lpRect As RECT, ByVal bErase As Boolean) As Boolean
Private Structure RECT
Dim Left As Long
Dim Top As Long
Dim Right As Long
Dim Bottom As Long
End Structure
And then in my function:
Dim ii As New RECT
ii.Bottom = 1280
ii.Top = 0
ii.Left = 100
ii.Right = 700
Dim DesktopHandle As System.IntPtr = GetDC(System.IntPtr.Zero)
InvalidateRect(DesktopHandle, ii, True)
Any ideas? I've tried to google it, but to no avail. I'm new in the Windows
API world, so... It's kinda hard for me to get anywhere.
Thank you for any help you might give me!
Andre Nogueira
I am developing a program which draws stuff on the screen (outside of the
form).
For this I use the GetDC function of user32.dll to get a handle to the
desktop, and then use GDI+ to draw. So far so good.
The problem is that before drawing, I have to erase what I had previously
drawn. I tried using the InvalidateRect API function, without luck.
I get this error when I run the program:
A call to PInvoke function 'WindowsApplication1.Form1::InvalidateRect' 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.
This is what I have in my code:
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd As
System.IntPtr, ByVal lpRect As RECT, ByVal bErase As Boolean) As Boolean
Private Structure RECT
Dim Left As Long
Dim Top As Long
Dim Right As Long
Dim Bottom As Long
End Structure
And then in my function:
Dim ii As New RECT
ii.Bottom = 1280
ii.Top = 0
ii.Left = 100
ii.Right = 700
Dim DesktopHandle As System.IntPtr = GetDC(System.IntPtr.Zero)
InvalidateRect(DesktopHandle, ii, True)
Any ideas? I've tried to google it, but to no avail. I'm new in the Windows
API world, so... It's kinda hard for me to get anywhere.
Thank you for any help you might give me!
Andre Nogueira