AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Wednesday, November 20, 2024

Windows 11 taskbar on right side

Since Windows 11 there is no way to set Taskbar on the right edge of desktop, what is very useful, especially on laptop screen. Fortunately ExplorerPatcher brings back this option, really a screen space saver. Enjoy!

Labels: ,

Tuesday, September 12, 2023

TeamViewer session is active - another method

 When TeamViewer running as service - connections established by System account, so we can't detect which user has TeamViewer session active. In that case we can use a following function, which looks through TeamViewer log file (logging must be enabled in TeamViewer options). Idea is based on that KB article Log file reading - Incoming connection


Public Function TeamViewerActive() As Boolean

    Dim tvLog As String

    tvLog = "C:\Program Files (x86)\TeamViewer\TeamViewer15_Logfile.log"

    If Len(Dir(tvLog)) = 0 Then Exit Function

    'Get user's process TeamViewer PID

    Dim objServices As Object, objProcessSet As Object, Process As Object

    Set objServices = GetObject("winmgmts:\\.\root\CIMV2")

    Set objProcessSet = objServices.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'TeamViewer.exe'", , 48)  '

    

    Dim tvPID As Long

    For Each Process In objProcessSet

        Dim ProcessUserName As Variant

        Call Process.GetOwner(ProcessUserName)

        If ProcessUserName = GetWindowsUserName Then

            tvPID = Process.ProcessID

            Exit For

        End If

    Next


    Set objProcessSet = Nothing

    

'no PID - no TeamViewer running

    If tvPID = 0 Then Exit Function

    

    Dim FSO As Object

    Dim strLog As String, a, i As Long

    Set FSO = CreateObject("scripting.FileSystemObject")

    Dim TS As Object 'TextStream

    Set TS = FSO.OpenTextFile(tvLog, 1) 'ForReading

    strLog = TS.ReadAll

    a = Split(strLog, vbNewLine)

    TS.Close


'Get the lastest session

    Dim lngLastStart As Long, strSessionID As String

    For i = 0 To UBound(a)

        If a(i) Like "*  " & tvPID & " *" Then

            If a(i) Like "* CParticipantManagerBase participant *" Then

                lngLastStart = i

            End If

        End If

    Next i

    

    If lngLastStart > 0 Then

'Session was started

        TeamViewerActive = True

'Get session ID

        strSessionID = Mid(a(lngLastStart), InStr(1, a(lngLastStart), " (ID [") + 5)

        strSessionID = Left(strSessionID, InStr(1, strSessionID, "]"))

'Check if that session already ended, if no - then user in TeamViewer session

        For i = lngLastStart To UBound(a)

            If a(i) Like "* CPersistentParticipantManager::RemoveParticipant:*" & Replace(strSessionID, "[", "[[]") & "*" Then

                TeamViewerActive = False

            End If

        Next i

    End If

End Function

Labels: , ,

Saturday, September 02, 2023

How to check if TeamViewer session is active

This function can be used to determine if current user session has active TeamViewer connection. The only way I found so far is to check specific port for established connection using netstat

netstat -nb | find ":5938" | find "ESTABLISHED"

If anything found - Teamviewer is running on PC


netstat -nb | find ":6039" | find "ESTABLISHED"

If anything found - Teamviewer session is active

Using this code GetTcpTable: Local Machine TCP Connection Table you can make TeamviewerSessionIsActive() function, just replace With TcpRow block with following:

Public Function TeamviewerSessionIsActive() As Boolean

With TcpRow

    If ntohs(.dwRemotePort) = 6039 And & _ 

        .dwState = MIB_TCP_STATE_ESTAB Then

        TeamviewerSessionIsActive = True

        Exit Function

    End If

End With

End Function


Labels: , ,

Thursday, November 19, 2020

Another service to block VBA

Got i from friend of mine, be aware of this CylancePROTECT Script Control...

Hi Everyone

I spent a frustrating five hours yesterday tracking down a problem on some (but not all) of one of my clients’ workstations, and I hope I might save some of you from a similar waste of time.

Attempts to open their Access application (an ACCDR) with the /runtime switch gave:

               Execution of this application has stopped due to a run-time error.

               The application can’t continue and will shut down.

Further investigation, running it as an ACCDB, showed that any attempt to touch the ErrEx class (Wayne Philips’ vbWatchdog) gave:

               Run-time error '453':

               Can't find DLL entry point VirtualAlloc in kernel32

This was from a call to VirtualAlloc from the Class_Initialize event procedure of ErrEx.

My initial thought was that a Microsoft update over the weekend had installed something that was interfering with vbWatchdog, so I was composing as email to Wayne when I thought to try some other calls to Kernel32 functions.  They all failed with Error 453, as did calls to User32 procedures.

I then spent considerable time uninstalling updates and reverting to restore points, without any success.  While googling for ideas, I found this:

https://stackoverflow.com/questions/56201309/need-to-fix-this-error-cant-find-dll-entry-point-getsysteminfo-in-kernel32

Note the final comment by the OP.

Sure enough, I checked and there was a service named “CylancePROTECT” running on the workstation I was looking at.

I called their IT “support” company and finally found somebody who knew that they were trialling new “security software” on some of their customers’ workstations.  I googled it, and it includes a “script control” feature which blocks certain functions in “scripts”, which apparently include VBA code:

https://www.blackberry.com/content/dam/cylance/documents/pdf/pdf-feature-focus-protect-script-control.pdf

In this document, it recommends “that administrators initially enable CylancePROTECT Script Control in Alert Mode to monitor and observe all scripts running in their environment.”  Then later, “Once administrators have a good understanding of all scripts running in their environment, they can change their settings to block mode and only allow scripts to run out of specified folders.”  Of course, these idiots had not followed these recommendations.

Anyway, I hope this is useful knowledge to put in the toolbox if ever you are diagnosing Error 453.

Cheers,

Graham


Labels: ,

Thursday, March 21, 2019

AccessImagine

AccessImagine is ActiveX control, which helps to insert images into DB – from file, webcam, clipboard or drag-n-drop, crop and display images, store outside database.

Labels:

Monday, March 04, 2019

Access System Tables

64 different system tables were documented  and summarised the properties

Purpose of System Tables
How Access Stores Queries
Using multivalued fields..and why you really shouldn't
How Access manages Relationships
Using Column History in Memo/Long Text fields
Remove deleted objects from MSysObjects

Labels:

Monday, January 07, 2019

VBA Code Examples

Several useful VBA routines, like file/string hashing, file/folder utilities, sorting, etc:

https://en.wikibooks.org/wiki/Wikibooks:Collections/VBA_Code_Examples

Labels: