maidinhdan > 27-03-21, 01:08 AM
' --------------------------------------------------------------------------------------------------------
' Ten Modules/Class:    modThongbao
' Ten ham/thu tuc    :  GoiThongbao
' Tao tren may PC    :  HENDAN
' Author/ Tac gia    :  maidinhdan@gmail.com ,  Ngay, gio tao: 26/03/2021 4:01:39 PM
' Parameters/Tham so :
' Cu phap/ Purpose  :
' Pham vi ap dung    : Goi thong bao bang Form
' --------------------------------------------------------------------------------------------------------
'Gia tri tra ve cua ham Goithongbao la:
'True => Tuong ung ban da nhan nut    Ok/Yes
'False => Tuong ung ban da nhan nut    No/Cancel
Public Function GoiThongbao(SoCanGoi As Long) As Boolean
On Error GoTo Loi
    Dim cls As clsThongbao
    Set cls = New clsThongbao
    With cls
        .SoTT = SoCanGoi
        .MoFormThongbao
        Do While KiemTraFormDangMo(acForm, "frmThongbao")
            DoEvents
            Sleep 100
        Loop
    End With
    
    Set cls = Nothing
    GoiThongbao = TraLoi
Exit_Loi:
        Exit Function
Loi:        ' Khi cac Thu tuc loi se nhay den dong duoi day
        GoiThongbao 6
        GoiThongbao = False
        Resume Exit_Loi      ' Chay nguoc len dong Exit_Loi: va thoat
End Function
'Kiem tra doi tuong dang dong hay mo
Function KiemTraFormDangMo(KieuDoiTuong As Integer, TenFormCanKiemTra As String) As Boolean
Dim i As Integer
    i = SysCmd(acSysCmdGetObjectState, KieuDoiTuong, TenFormCanKiemTra)
    KiemTraFormDangMo = i And acObjStateOpen
End Function 
mrtoanbin > 29-03-21, 08:23 PM