- Katılım
- 18 Kasım 2012
- Mesajlar
- 423
- Excel Vers. ve Dili
- Microsoft Office 365
- Altın Üyelik Bitiş Tarihi
- 04-07-2024
Herkese Merhaba,
Bir makro çalışmam da kullanmış olduğum Userform U simge durumunda küçültmek/büyültmek için aşağıdaki kodları kullanıyorum.
Ancak doğru çalışmıyor. İlgili kodlarda nerede hata yapıyor yada eksik kullanıyor olabilirim.
Bu konuda yardımcı olabilecek birileri var ise çok memnun olurum.
Herkese şimdiden çok teşekkür ederim.
Syg,
Option Explicit
Public Const MinBox = &H10000
Public Const MaxBox = &H20000
Public Const Style = (-16)
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Public Sub MaxMinButton(ByVal FormCaption As String)
Dim hWnd As Long
Dim lngStyle As Long
hWnd = FindWindow(vbNullString, FormCaption)
lngStyle = GetWindowLong(hWnd, Style)
lngStyle = lngStyle Or MaxBox
SetWindowLong hWnd, Style, lngStyle
DrawMenuBar hWnd
End Sub
Private Sub UserForm2_Activate()
Module2.MaxMinButton (Me.Caption)
End Sub
Bir makro çalışmam da kullanmış olduğum Userform U simge durumunda küçültmek/büyültmek için aşağıdaki kodları kullanıyorum.
Ancak doğru çalışmıyor. İlgili kodlarda nerede hata yapıyor yada eksik kullanıyor olabilirim.
Bu konuda yardımcı olabilecek birileri var ise çok memnun olurum.
Herkese şimdiden çok teşekkür ederim.
Syg,
Option Explicit
Public Const MinBox = &H10000
Public Const MaxBox = &H20000
Public Const Style = (-16)
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Public Sub MaxMinButton(ByVal FormCaption As String)
Dim hWnd As Long
Dim lngStyle As Long
hWnd = FindWindow(vbNullString, FormCaption)
lngStyle = GetWindowLong(hWnd, Style)
lngStyle = lngStyle Or MaxBox
SetWindowLong hWnd, Style, lngStyle
DrawMenuBar hWnd
End Sub
Private Sub UserForm2_Activate()
Module2.MaxMinButton (Me.Caption)
End Sub