-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hello,
First let me say that this is a very useful library to bring better dialogbox to users. Thank you for your hard work!
I would like to report a quite hard to grasp issue.
This is a Microsoft Access 2024 64 bits, in French, on Windows 11 Pro.
The TaskDialog library is latest (v1.6 R2).
Lately, I have been having regular Ms Access crash with an Access Violation Exception (0xc0000005) when doing various interaction (clicking on buttons, selecting a new line...).
The following event is logged in the Application log (somes parts in French):
Nom de l'application défaillante : MSACCESS.EXE, version : 16.0.17932.20602, horodatage : 0x690d8376
Nom du module défaillant : VBE7.DLL, version : 0.0.0.0, horodatage : 0x66c8d2d7
Exception code: 0xc0000005
Fault offset: 0x0000000000381e5a
Identifiant du processus défaillant : 0x51EC
Heure de début de l'application défaillante : 0x1DC6CE2C7798BE6
Chemin de l'application défaillante : C:\Program Files\Microsoft Office\Root\Office16\MSACCESS.EXE
Chemin du module défaillant : C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.DLL
ID du rapport : 98df9afd-4af7-4584-9cb9-31323f331660
Nom complet du package défaillant :
Package défaillant – ID d'application relatif :
I was never able to find the issue as it is seemingly in random. If I try the exact same action after restarting the app, it works flawlessly.
The issue can also happen on different machine.
This is quite maddening.
However, this week I observed 3 random crashes happening on a specific button. It is a custom button added in the Ms Access Ribbon, and the first thing it does is displaying a confirmation dialog using this TaskDialog library.
When the crashes occurred, the dialog was never displayed. That's why I believe the issue may come from this library.
Here is the Sub in question :
Public Sub Ribbon_OnClick(Control As IRibbonControl)
If MsgBoxConfirm("...") Then
' Do something
End If
End SubAnd here are the support functions used:
Public Function MsgBoxConfirm(Content As Variant, Optional ContentTitle As Variant = "", Optional icon As TDICONS = IDI_QUESTION, Optional DefaultButton As TDRESULT = TD_YES) As Boolean
Dim TaskDialog As New cTaskDialog
With TaskDialog
.Init
.Flags = TDF_ENABLE_HYPERLINKS Or TDF_EXEC_HYPERLINKS Or TDF_SIZE_TO_CONTENT
.title = "Title"
.ParenthWnd = GetParenthWnd
.MainInstruction = ContentTitle
.Content = Content
.CommonButtons = TDCBF_YES_BUTTON Or TDCBF_CANCEL_BUTTON
.DefaultButton = DefaultButton
.title = "Confirmation"
.IconMain = icon
.ShowDialog
MsgBoxConfirm = .ResultMain = TD_YES
End With
Set TaskDialog = Nothing
End Function
Function GetParenthWnd() As LongPtr
GetParenthWnd = Application.hWndAccessApp
If Application.CurrentObjectType = acForm Then
If IsFormDialog(Screen.ActiveForm) Then
GetParenthWnd = Screen.ActiveForm.hwnd
End If
End If
End Function
Public Function IsFormDialog(frm As Form) As Boolean
Dim hwnd As LongPtr
Dim lngStyle As LongPtr
hwnd = frm.hwnd
lngStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
IsFormDialog = CBool((lngStyle And WS_EX_DLGMODALFRAME) = WS_EX_DLGMODALFRAME)
End FunctionI don't remember having this kind of crashes when we used Access 2019 32 bits. Not on this button anyway.
I noticed this comment in the mTDHelper.bas file:
Public Sub MagicalTDInitFunction()
'The trick is a GENIUS!
'He identified the bug in VBA64 that had been causing the crashing.
'As if by magic, calling this from Class_Initialize resolves the problem.
End Sub
I couldn't find any information on theses crashes (or how any real explanation of this "genius trick") but I though it may be related?
Thank you for your time and any help you can provide on this matter! 😸