Overflow error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I got an overflow error on Access 2000's GetWindowRect:

Declare Function GetWindowRect Lib "User" (ByVal hwnd
As Integer, r As RECT) As Integer
...
Sub NoteOnClose(frm As Form)
Dim r As RECT
....
z = GetWindowRect(frm.hwnd, r)
....
End Sub

Why is that ?

Thanks a lot.
..
 
IIRC, use Long rather than Integer like:

Declare Function GetWindowRect Lib "User" (ByVal hwnd
As Long, r As RECT)

The returned values are in r so don't assign a type to the function.
 
The cause of the problem is offcourse that the declaration has been copied
from the 16 bit version of windows
and there's no reason why not include the return value
Declare Function GetWindowRect Lib "User" (ByVal hwnd
As Long, r As RECT) as long

if you won't be needing the return value it is "cleaner" (in my opinion) to
declare it as a sub ...

Declare Sub GetWindowRect Lib "User" (ByVal hwnd
As Long, r As RECT)

Not that it means the world ....

Pieter
 
Back
Top