Home > database >  Comdlg32. DLL GetOpenFileName and GetSaveFileName can not run in the 64 - bit environment
Comdlg32. DLL GetOpenFileName and GetSaveFileName can not run in the 64 - bit environment

Time:09-25

in 64 bitaccess, originally the 32 bit Declare Function GetOpenFileName Lib "comdlg32. DLL error problem, can be solved by the following methods:


the first step: behind Delcare increase PtrSafe keyword, :
Private Declare Function GetOpenFileName Lib "comdlg32. DLL" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Instead of
Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32. DLL" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

step 2: change to Long for LongPtr
Will OPENFILENAME hwndOwner, hInstance lpfnHook three types from long to LongPtr

In the third step: will lStructSize Len () instead of LenB ()
Such as: Len (fFileName) to LenB (fFileName)

Thus solve the 32 bit system can run, and can't run in the 64 - bit problem,
  • Related