Results 1 to 18 of 18

Converting the 32-bit version of a code to 64-bit Versions

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-13-2017
    Location
    Buchares
    MS-Off Ver
    2016
    Posts
    117

    Question Converting the 32-bit version of a code to 64-bit Versions

    Hello,

    I'm having some problems regarding the editing and making the code to compile successfully on 64-bit Versions

    I've followed the differences of the code using the site here were each declaration can be saw on both version, but somehow the module will display an error about the different versions.
    https://www.jkp-ads.com/articles/apideclarations.asp

    Piece of code (also the entire document has been attached)

    #If VBA7 Then
    
    'Public Declare PtrSafe
    
    Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
                                (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    
    Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    
    Private Declare PtrSafe Function GetForegroundWindow Lib "user32" () As Long
    
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
                           (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
    
    Private Declare PtrSafe 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 PtrSafe Function CallNextHookEx Lib "user32" (ByVal hHook As Long, _
                                                  ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Private Declare PtrSafe Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    
    
    #Else
    'This will compile in 32 bit Excel only
    
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
                                (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    
    Private Declare Function GetForegroundWindow Lib "user32" () As Long
    
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
                           (ByVal Destination As Long, ByVal Source As Long, ByVal Length 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 CallNextHookEx Lib "user32" (ByVal hHook As Long, _
                                                  ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    
    
    #End If
    Is the Long vs LongPtr so important between versions? That's the problem?
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formulas not working in higher version, 2010 Version to 2013 version
    By thilag in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-19-2015, 09:09 PM
  2. Get code that works on excel version 2007 to work on version 2010
    By Agent1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2014, 01:23 AM
  3. Replies: 2
    Last Post: 05-19-2014, 12:10 PM
  4. Replies: 1
    Last Post: 02-28-2014, 10:57 AM
  5. Replies: 7
    Last Post: 08-09-2008, 04:32 AM
  6. [SOLVED] VBA code for different versions of Excel
    By AndersW in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2006, 07:25 AM
  7. VBA Code Only Works in Some Excel Versions
    By mta37 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2005, 03:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1