p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Access VBA (http://p2p.wrox.com/forumdisplay.php?f=24)
-   -   Declare statement in Win64 VBA Office (http://p2p.wrox.com/showthread.php?t=99621)

jmppgarcia September 26th, 2017 06:05 AM

Declare statement in Win64 VBA Office
I have used vba code in Windows 32 bit. Now that I've migrated to Windows 10 64 bit I got the message "The code in this project should be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with OTrSafe attribute." The Declare commands I have are the following:


Public Declare Function GetUserNameEx Lib "Secur32.dll" Alias "GetUserNameExA" ( _
  ByVal lpNameBuffer As String, _
  ByRef lpnSize As Long) As Long

  NameUnknown = 0
  NameFullyQualifiedDN = 1
  NameSamCompatible = 2
  NameDisplay = 3
  NameUniqueId = 6
  NameCanonical = 7
  NameUserPrincipal = 8
  NameCanonicalEx = 9
  NameServicePrincipal = 10
  NameDnsDomain = 12
End Enum

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    lpstrFilter As String
    lpstrCustomFilter As String
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As String
    nMaxFile As Long
    lpstrFileTitle As String
    nMaxFileTitle As Long
    lpstrInitialDir As String
    lpstrTitle As String
    flags As Long
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
End Type

Public Declare Function ShellExecute _
    Lib "shell32.dll" _
    Alias "ShellExecuteA" ( _
    ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) _
    As Long

I've looked at some documentation but I can not really understand it when using the LongLong and LongPtr statements. Or if you simply declare PtrSafe in the Declare statement.

Link to MSoft documentation

Can someone help me?

All times are GMT -4. The time now is 04:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.