Declare Function RegisterWindowMessage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dkubly
    New Member
    • Sep 2018
    • 1

    Declare Function RegisterWindowMessage

    Getting an error in the following code...

    Code:
    Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
    Error message = "The code in this project must be updated for use on 64-bit system... PtrSafe attribute
    Last edited by zmbd; Sep 5 '18, 03:21 PM. Reason: [z{please use the [CODE/] formatting tool when posting script/code/tables}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    - You need to specify what environment you are working it.
    - The error is fairly specific, you have not declared the code as safe to run in the 64Bit environment " PtrSafe "

    Microsoft Article: "Compile error: The code in this project must be updated for use on 64-bit systems"

    The crux of the solution given is to use the conditional compiler such as:
    Code:
    #If VBA7 Then
        Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
    #Else
        Private Declare Sub Sleep Lib "kernel32" (ByVal ms as Long)
    #End If
    and in each Declare statement you have to change the name of any parameter that is passed from "ms" to "millisecs. "
    Last edited by zmbd; Sep 5 '18, 03:27 PM.

    Comment

    Working...