Skip to content

Commit

Permalink
Merge pull request #398 from bclothier/ExportOnSaveHook
Browse files Browse the repository at this point in the history
Fix for Export on Save on 32-bit builds and Unicode/ANSI handling
  • Loading branch information
joyfullservice authored May 15, 2023
2 parents 8dbfc56 + b520275 commit bf1d641
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
Binary file modified Hook/Build/MSAccessVCSHook_win32.dll
Binary file not shown.
Binary file modified Hook/Build/MSAccessVCSHook_win64.dll
Binary file not shown.
18 changes: 16 additions & 2 deletions Version Control.accda.src/modules/modExportOnSaveHook.bas
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Private Type HookConfiguration
App As Access.Application
CallbackProject As VBIDE.VBProject
AfterSaveRequestDelayMilliseconds As Long
AfterSaveCallbackProcedureName As String
AfterSaveCallbackProcedureName As LongPtr
LogFilePath As LongPtr
End Type

' Must match the ObjectData definition used in hook's ObjectTracker module
Expand Down Expand Up @@ -158,8 +159,9 @@ Public Function ActivateHook(Optional ExportRequestDelayMilliseconds As Long = 5
Set Config.CallbackProject = .DbcVbProject
End With
End If
Config.AfterSaveCallbackProcedureName = "HandleExportCallback"
Config.AfterSaveCallbackProcedureName = StrPtr("HandleExportCallback")
Config.AfterSaveRequestDelayMilliseconds = ExportRequestDelayMilliseconds
Config.LogFilePath = StrPtr(CodeProject.Path & "\MSAccessVCSHook.log")
If StartHook(Config) = False Then
FreeLibrary (ptrLibraryHandle)
ptrLibraryHandle = 0
Expand Down Expand Up @@ -200,6 +202,8 @@ End Function
'---------------------------------------------------------------------------------------
'
Public Sub HandleExportCallback(UpperBound As Long, ObjectDataArray() As ObjectData)
On Error GoTo ErrHandler

Dim dAccessObjects As Scripting.Dictionary
Dim oAccessObject As Access.AccessObject
Dim tObjectData As ObjectData
Expand Down Expand Up @@ -241,4 +245,14 @@ Public Sub HandleExportCallback(UpperBound As Long, ObjectDataArray() As ObjectD
Next

modImportExport.ExportMultipleObjects dAccessObjects, False

ExitProc:
Exit Sub

ErrHandler:
If DebugMode(True) Then
Stop ' Use the unreachable Resume to return to the original line that caused error.
End If
Resume ExitProc
Resume ' Use for debugging only
End Sub
1 change: 1 addition & 0 deletions Version Control.accda.src/modules/modImportExport.bas
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ CleanUp:
.Add vbCrLf & Perf.GetReports, False
.SaveFile
.Active = False
.Flush
End With

' Save index file (don't change export date for multiple items export)
Expand Down
12 changes: 10 additions & 2 deletions Version Control.accda.src/modules/modObjects.bas
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ Private this As udtObjects
'---------------------------------------------------------------------------------------
'
Public Sub ReleaseObjects()
Set this.Perf = Nothing
Set this.Log = Nothing
Set this.Options = Nothing
Set this.VCSIndex = Nothing
Set this.Worker = Nothing
Set this.Git = Nothing
Set this.FSO = Nothing

Dim udtEmpty As udtObjects
' Reassign "this" to blank, clearing object references.
this = udtEmpty
' Reassign "this" to blank, clearing any saved data.
LSet this = udtEmpty
End Sub


Expand Down

0 comments on commit bf1d641

Please sign in to comment.