tengo el siguiente código para minimizar un formulario:
Option Explicit ' Declaración de variantes para los botones de maximizar y minimizar
'para OS 34 bits
'Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'Private Const WS_MINIMIZEBOX As Long = &H20000
'Private Const WS_MAXIMIZEBOX As Long = &H10000
'Private Const GWL_STYLE As Long = (-16)
'Private Const WS_SYSMENU As Long = &H80000 'variable para ocultar el botón x
' para OS 64 bits
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000
lo que hago es que comento el código para la versión de windows que se tenga y así el formulario funcione, pero esta forma me parece muy manual; `por lo tanto solicito su ayuda para ver si se puede organizar el código para que con un condicional o un select case, excel sepa de cuantos bits es el OS y aplique el código sin tener que modificarlo manualmente.
Espero haberme echo entender. mil gracias
Featured Replies
Archivado
Este tema está ahora archivado y está cerrado a más respuestas.
cordial saludo
tengo el siguiente código para minimizar un formulario:
Option Explicit ' Declaración de variantes para los botones de maximizar y minimizar
'para OS 34 bits
'Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'Private Const WS_MINIMIZEBOX As Long = &H20000
'Private Const WS_MAXIMIZEBOX As Long = &H10000
'Private Const GWL_STYLE As Long = (-16)
'Private Const WS_SYSMENU As Long = &H80000 'variable para ocultar el botón x
' para OS 64 bits
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000
lo que hago es que comento el código para la versión de windows que se tenga y así el formulario funcione, pero esta forma me parece muy manual; `por lo tanto solicito su ayuda para ver si se puede organizar el código para que con un condicional o un select case, excel sepa de cuantos bits es el OS y aplique el código sin tener que modificarlo manualmente.
Espero haberme echo entender. mil gracias