Results 1 to 19 of 19

Thread: Change VBA code to fit 64-bit environment

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hello, i have the code lines below that help me protect multiple sheets at the same time but this only worked for office 32 bit

    Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
    Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
    Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    Private Declare Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
    Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
    Any ideas how to change this to work for 64 bit ?
    Thanks.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Private Declare PtrSafe Function CallNextHookEx Lib "user32" ( _
    	 hHook As LongPtr,  _
    	 ncode As LongPtr,  _
    	 wParam As LongPtr, lParam As Any) As LongPtr
    	Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" ( _
    	 lpModuleName As String) As LongPtr
    Private Declare PtrSafe Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" ( _
    	 idHook As LongPtr,  _
    	 lpfn As LongPtr,  _
    	 hmod As LongPtr,  _
    	 dwThreadId As LongPtr) As LongPtr
    Private Declare PtrSafe Function UnhookWindowsHookEx Lib "user32" ( _
    	 hHook As LongPtr) As LongPtr
    Private Declare PtrSafe Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" ( _
    	 hDlg As LongPtr,  _
    	 nIDDlgItem As LongPtr,  _
    	 wMsg As LongPtr,  _
    	 wParam As LongPtr,  _
    	 lParam As LongPtr) As LongPtr
    Private Declare PtrSafe Function GetClassName Lib "user32" Alias "GetClassNameA" ( _
    	 hWnd As LongPtr,  _
    	 lpClassName As String,  _
    	 nMaxCount As LongPtr) As LongPtr
    Private Declare PtrSafe Function GetCurrentThreadId Lib "kernel32" () As LongPtr
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •