Visual Basic.NET - Ayuda urgente VB.Net

 
Vista:

Ayuda urgente VB.Net

Publicado por Nestor Gonzalez (5 intervenciones) el 30/07/2008 21:56:07
Buenas Tardes!!

Espero que me puedan colaborar con esta aplicacion que esta desarrollada en Visual Basic 6.0, necesito pasarla a Visual Basic.net ya que la necesito en este lenguaje para un proyecto que debo presentar a la Universidad. Muchas gracias por la atencion y la ayuda prestada.

Es de caracter urgente!!!

Para correr este programa debes agregar un componente StatusBar al form.

********* Este codigo va en el Form:**********

Option Explicit

Private Sub Form_Load()
'Iniciamos el Hook
StatusBar1.Panels(1).Width = 5000
Call Iniciar_Hook(Me.hwnd)
End Sub

Private Sub Form_Unload(Cancel As Integer)
'Termina el hook
Call Terminar_Hook(Me.hwnd)
End Sub

********Este codigo va en un modulo:************

'Funciones Api
Option Explicit

Private Declare Function CallWindowProc _
Lib "user32" _
Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal MSG As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Private Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function GetMenuString _
Lib "user32" _
Alias "GetMenuStringA" ( _
ByVal hMenu As Long, _
ByVal wIDItem As Long, _
ByVal lpString As String, _
ByVal nMaxCount As Long, _
ByVal wFlag As Long) As Long

'Constantes

Const MF_BYCOMMAND = &H0&
Const WM_MENUSELECT = &H11F
Const GWL_WNDPROC = (-4&)

Dim get_Menu_caption As Long


Private Function SubWindowMenu( _
ByVal hwnd As Long, _
ByVal MSG As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Dim ret As Long, l, H
Dim Buffer As String

If MSG = WM_MENUSELECT Then
H = Int(wParam / 65536)
l = wParam - H * 65536

If l <> 0 Then
Buffer = Space$(128)
ret = GetMenuString(lParam, l, Buffer, Len(Buffer), _
MF_BYCOMMAND)

'Cambiar acá el control donde mostrar el caption
'( Se debe especificar el Formulario y el control, si no explota el IDE )
Form1.StatusBar1.Panels(1).Text = Left$(Buffer, ret)
End If
End If

SubWindowMenu = CallWindowProc(get_Menu_caption, hwnd, MSG, wParam, lParam)
End Function

'Inicia el Hook
Public Sub Iniciar_Hook(hwnd&)
get_Menu_caption = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubWindowMenu)
End Sub

'Finaliza el Hook
Public Sub Terminar_Hook(hwnd&)
Call SetWindowLong(hwnd, GWL_WNDPROC, get_Menu_caption)
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder