LockWindowUpdate VB 2005

P

Paul Remblance

I have just converted a project from VB 2003 to VB 2005 and the
LockWindowUpdate no longer works!

Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
hWndLock As Long) As Boolean
LockWindowUpdate(Me.Handle.ToInt32)
LockWindowUpdate(0)

Any other ideas how to lock the window in VB 2005?

I have a tab control where I need to 'flick' between tabs in the background.
Seeing each page flash as it goes through is annoying.
Tried: SuspendLayout() with the form and tab control which didn't work.
 
H

Herfried K. Wagner [MVP]

Paul Remblance said:
I have just converted a project from VB 2003 to VB 2005 and the
LockWindowUpdate no longer works!

Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
hWndLock As Long) As Boolean
LockWindowUpdate(Me.Handle.ToInt32)
LockWindowUpdate(0)

Any other ideas how to lock the window in VB 2005?

\\\
Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
ByVal hWndLock As IntPtr _
) As Boolean
....
LockWindowUpdate(Me.Handle)
///

Note that 'Long' is a 64-bit type in VB.NET opposed to VB6 where it was a
32-bit type.
 
P

Paul Remblance

Herfried K. Wagner said:
\\\
Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
ByVal hWndLock As IntPtr _
) As Boolean
...
LockWindowUpdate(Me.Handle)
///

Note that 'Long' is a 64-bit type in VB.NET opposed to VB6 where it was a
32-bit type.

Many thanks, reached the same conclusion (but a bit slower!)

Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
hWndLock As IntPtr) As Boolean
LockWindowUpdate(Me.Handle.ToInt64)
LockWindowUpdate(0)

hWndLock As Long to hWndLock As IntPtr
Me.Handle.ToInt32 to Me.Handle.ToInt64

Also tried your LockWindowUpdate(Me.Handle) which also worked.
 
H

Herfried K. Wagner [MVP]

Paul Remblance said:
Many thanks, reached the same conclusion (but a bit slower!)

Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
Friend Declare Function LockWindowUpdate Lib "user32.dll" (ByVal
hWndLock As IntPtr) As Boolean
LockWindowUpdate(Me.Handle.ToInt64)
LockWindowUpdate(0)

hWndLock As Long to hWndLock As IntPtr
Me.Handle.ToInt32 to Me.Handle.ToInt64

You do not need 'Me.Handle.ToInt62'. Handles are 32-bit on 32-bit systems
and 64-bit on 64-bit systems, which is what 'IntPtr' is designed for. So I
strongly recommend to use the solution I posted!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top