在64bitAccess中,原來32bit的Declare Function GetOpenFileName Lib "comdlg32.dll" 報錯問題,可以通過下面方法解決:
第一步:在Delcare后面增加PtrSafe關鍵字。比如:
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
改為
Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
第二步:改Long型別為LongPtr
將OPENFILENAME的hwndOwner、hInstance、lpfnHook三個型別由long改為LongPtr
第三步:將lStructSize中的Len()改為LenB()
如:Len(fFileName)改為LenB(fFileName)
這樣就解決了32bit系統可以運行,而64bit中無法運行的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/76729.html
標籤:Access
