Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long Private Function IsFormModal(frm As Form) As Boolean ... If IsFormModal(GetParent(Me)) Then ... <== Type mismatch
Private Function IsFormModal(frm As Form) As Booleana bien comme paramètre le nom de la Form
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long Private Function GetForm() as Form Dim Buffer as String * 256 ' le buffer Dim Hwnd as Long = GetParent(Me) ' handle parent Dim Ret as Long = GetClassName(Hwnd, Buffer, 256) ' retourne la classe du parent dans Buffer If Ret > 0 Then For Each Frm In Forms ' on recherche dans la collection Forms la Form parente If Frm.Name = lpClassName Then GetForm = Frm Exit For End If Next Else GetFrm = Nothing End If End Function Private Function IsFormModal(GetFrm As Form) As Boolean If GetForm <> Nothing then ' code de ta fonction End If End Function
Dim i as integer = 1 ' c'est faux
Dim i as integer ' là c'est bon i= 1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long ' retourne la Form parente de la Form courante Private Function GetForm() as Form Dim Buffer as String * 256 ' le buffer Dim Hwnd as Long, Ret as Long Hwnd = FindWindow(Me.Name, "") ' handle de la fenêtre courante Hwnd = GetParent(Hwnd) ' handle de la fenêtre parente Ret = GetClassName(Hwnd, Buffer, 256) ' retourne la classe du parent dans Buffer For Each Frm In Forms ' on recherche dans la collection Forms la Form parente If Frm.Name = lpClassName Then GetForm = Frm Exit For End If Next End Function Private Function IsFormModal(GetFrm As Form) As Boolean ' code de ta fonction End Function