-1

I'm beginner for API Conversion from vb to vb.net.In vb6 they using user32 DLL.In Vb.Net i need to call LockWindowUpdate Function() without that "User32.dll" function.

Is there any way to Lock window state without using any API Calls in vb.net..?

If equivalent is any one know let me show that codes.that codes should be work with in .net framework.

VB

Private Declare Function LockWindowUpdate Lib "user32"
  (ByVal hWnd As Long) As Long

LockWindowUpdate Form1.hWnd
Rajesh_Bangalore
  • 613
  • 5
  • 21
  • 1
    Looks like you have two accounts here now. Please spend some time learning how Windows operates before asking more of these questions. As you were told at the previous question, user32 is needed. Your app already uses it. MS .net is built on top of win32. If you need a function in user32 just use it. – David Heffernan Nov 03 '11 at 07:39
  • 1
    I suspect your problem is that you are trying to make a literal conversion where every vb6 line maps to an equivalent line in the .net. That approach won't get anywhere. The frameworks are different. You will need to be more flexible and creative in your translation. – David Heffernan Nov 03 '11 at 07:44
  • 1
    LockWindowUpdate is very often misused, probablt that was the case in the vb6 code. Do you know what purpose it serves? If not then you need to find out. – David Heffernan Nov 03 '11 at 07:49

1 Answers1

6

You cannot call that function without a pinvoke declaration. You can however use the correct one. The VB6 declarations are highly incompatible with the VB.NET declarations, avoid them and always consult pinvoke.net for the proper declaration.

 Declare Function LockWindowUpdate Lib "user32" (ByVal hWnd As IntPtr) As Boolean

Actually using this function is almost always incorrect, but that's another problem.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536