Consulting

Results 1 to 6 of 6

Thread: Change VBA code to fit 64-bit environment

  1. #1

    Change VBA code to fit 64-bit environment

    Following declarations from my earlier 32-bit environment must be corrected, but I dont know how. Please help...

    Declare Function FindWindowByClass Lib "user32" Alias _ 
    "FindWindowA" (ByVal lpClassName As String, ByVal _ 
    lpWindowName As Long) As Long 
     
     
    Declare Function RegisterWindowMessage Lib "user32" Alias _ 
    "RegisterWindowMessageA" (ByVal lpstring As String) As Long 
     
     
    Declare Function FindWindow Lib "user32" Alias _ 
    "FindWindowA" (ByVal lpClassName As Any, ByVal _ 
    lpWindowName As Any) As Long 
     
     
    Declare Function SendMessage Lib "user32" Alias _ 
    "SendMessageA" (ByVal hwnd As Long, ByVal _ 
    wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 
    
    
    Formatting tags added by mark007
    Last edited by Paul_Hossler; 11-04-2017 at 12:59 PM.

  2. #2
    VBAX Master mancubus's Avatar
    Joined
    Dec 2010
    Location
    where i lay my head is home
    Posts
    2,446
    Declare PtrSafe Function FindWindowByClass Lib "user32" Alias _ 
    "FindWindowA" (ByVal lpClassName As String, ByVal _ 
    lpWindowName As Long) As LongPtr 
     
     
    Declare PtrSafe Function RegisterWindowMessage Lib "user32" Alias _ 
    "RegisterWindowMessageA" (ByVal lpstring As String) As LongPtr 
     
     
    Declare PtrSafe Function FindWindow Lib "user32" Alias _ 
    "FindWindowA" (ByVal lpClassName As Any, ByVal _ 
    lpWindowName As Any) As LongPtr 
     
     
    Declare PtrSafe Function SendMessage Lib "user32" Alias _ 
    "SendMessageA" (ByVal hwnd As Long, ByVal _ 
    wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPtr 
    
    
    Formatting tags added by mark007
    http://www.jkp-ads.com/articles/apideclarations.asp
    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data with fake / representative data.

    3) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3

  4. #4
    VBAX Master mancubus's Avatar
    Joined
    Dec 2010
    Location
    where i lay my head is home
    Posts
    2,446
    you are welcome. if you are sorted, pls mark the thread as solved for future references.
    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data with fake / representative data.

    3) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    The SendMessage one should be:

    Public Declare PtrSafe Function SendMessageA Lib "user32" (ByVal hWnd As LongPtr, ByVal wMsg As Long, _ 
    ByVal wParam As LongPtr, lParam As Any) As LongPtr 
    
    
    Formatting tags added by mark007
    Be as you wish to seem

  6. #6
    JKP's link is a good one to show several of those and how to do both types.

    Since this has so many views, some might like those listed at.
    https://support.microsoft.com/en-us/...64-bit-support

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
  •