Ver Mensaje Individual
  #11 (permalink)  
Antiguo 19/11/2008, 15:18
Avatar de Kruzado
Kruzado
 
Fecha de Ingreso: marzo-2007
Mensajes: 307
Antigüedad: 17 años, 2 meses
Puntos: 17
Respuesta: Api EnableMenuItem

esta es el procedimiento

Sub Cargar_Menu_En_Tareas(lHwnd As Long, usux As String)
' si el hwnd es 0 sale
If lHwnd = 0 Then Exit Sub

Dim hmenu As Long
Dim i As Long
' redimensiona la lista que almacena los menues
ReDim MenuList(0)

' carga todos los menu en el array
Call List_Menu(lHwnd, hmenu, False)

Dim caption_menu As String
Dim nodo As Node
Dim nn As Integer
' recorre todo el array
Set con = base.OpenRecordset("select * from permisos where usuario='" & usux & "'", dbOpenDynaset)
For i = 1 To UBound(MenuList)
' nivel del menú actual 1 - 2 - 3 - 4 etc...
Nivel = (MenuList(i).level - 1)
' texto del menú
caption_menu = MenuList(i).text

If Nivel < 0 Then Nivel = 0

'If caption_menu = "" Then caption_menu = "<--------->"
If Nivel = 0 Then
Else
con.FindFirst "tarea='" & caption_menu & "'"
If con.NoMatch Then '&H0I
xs = EnableMenuItem(lHwnd, i, MF_BYPOSITION + MF_DISABLED)
Else
xs = EnableMenuItem(lHwnd, i, MF_BYPOSITION + MF_ENABLED)
End If
End If
nn = Nivel
Next i
principal.Show
End Sub