X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Lock Workstation In 64-bit Access, Access 2016 (64-Bit)    
post Dec 23 2017, 02:13 PM

Posts: 165
Joined: 11-December 02
From: Charleston, SC

Hello All,
Just got upgraded to 64-Bit Access 2016 and have been converting all my functions to PtrSafe. Great help found at http://www.UtterAccess.com/forum/index.php...afe+Access+2016 Dated 10/16/2017 from bowlesj (THANKS!). I have one function left that refuses to compile under 64-Bit. It is a lock work station function I have used for years with a form button On Click event.

Private Declare Function LockWorkStation Lib "C:\Windows\System32_user32.dll" ()As Long

Private Sub cmdLock_Click()


End Sub

This all works as intended in 32-Bit: Click the button and your workstation is locked --just like hitting Ctrl+L .
Not so much in 64-Bit. .

Private Declare PtrSafe Function LockWorkStation Lib "C:\Windows\System32_user32.dll" () As Long

Just inserting the PtrSafe keyword does not make it work -- so there must be an equivalent 64-Bit function somewhere...but by what name and in what dll file?

I also found this one that doesn't like 64-Bit environments.
SendMessage hwndActiveControl, WM_VSCROLL, IIf(Count < 0, SB_LINEUP, SB_LINEDOWN), 0&

Any ideas would be appreciated. Advanced thanks for considerations!

This post has been edited by USMCdBA: Dec 23 2017, 02:40 PM
Go to the top of the page
post Dec 23 2017, 03:18 PM

UtterAccess VIP
Posts: 7,429
Joined: 30-June 11

This works fine for me
#If VBA7 Then
    'x64 Declarations
    Private Declare PtrSafe Function LockWorkStation Lib "user32.dll" () As Long
    'x32 Declaration
    Private Declare Function LockWorkStation Lib "user32.dll" ()As Long
#End If

Public Sub LockStation()
End Sub

I notice you use and underscore in System32_user32.dll, shouldn't that be a \ ? FWIW, I never hard code the path.
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    3rd August 2020 - 04:07 PM