locked
Office 32-bit vs 64-bit - comdlg32.dll RRS feed

  • Question

  • I'm sure this is an easy fix, but I'm a newbie and haven't run into this before.

    I have many small databases with the code "Declare Function GetOpenFileName Lib "comdlg32.dll" Alias and another with GetSaveFileName . . . .

    Is there a change I could make that would allow this database to be run by a mixture of 32-bit and 64-bit Office machines?


    Thursday, September 5, 2019 6:52 PM

Answers

  • In 32-bit

    Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    
    Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
    In 64-bit, it becomes
    Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    
    Declare PtrSafe Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long

    You may like to read http://www.devhut.net/2017/04/13/access-x32-vs-x64-compatibility/

    Daniel Pineault, 2010-2019 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net



    • Edited by Daniel Pineault (MVP)MVP Thursday, September 5, 2019 7:22 PM Fixed the url (msdn messed it up somehow)
    • Marked as answer by Big Itch Friday, September 6, 2019 8:03 PM
    Thursday, September 5, 2019 7:20 PM

All replies

  • In 32-bit

    Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    
    Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
    In 64-bit, it becomes
    Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    
    Declare PtrSafe Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long

    You may like to read http://www.devhut.net/2017/04/13/access-x32-vs-x64-compatibility/

    Daniel Pineault, 2010-2019 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net



    • Edited by Daniel Pineault (MVP)MVP Thursday, September 5, 2019 7:22 PM Fixed the url (msdn messed it up somehow)
    • Marked as answer by Big Itch Friday, September 6, 2019 8:03 PM
    Thursday, September 5, 2019 7:20 PM
  • Thanks so much for the reference . . . I will study that . . . 

    Thursday, September 5, 2019 7:28 PM