Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with dual running x86 and x64 #59

Open
jlln28 opened this issue Jan 26, 2023 · 1 comment
Open

Compilation error with dual running x86 and x64 #59

jlln28 opened this issue Jan 26, 2023 · 1 comment

Comments

@jlln28
Copy link

jlln28 commented Jan 26, 2023

Hello,

I have an access database and need to run on office x86 and x64.
I have adapt your code to load the right DLL :

Public Function DLL() As Object
    On Error Resume Next
    If dllObject Is Nothing Then
        'load from the dll
#If Win64 Then
    LoadLibrary (Application.CurrentProject.Path & "\KrishDll\x64\VBA_TOOLS.dll")
#Else
    LoadLibrary (Application.CurrentProject.Path & "\KrishDll\x86\VBA_TOOLS.dll")
#End If
        Set dllObject = KRISH_VBA_TOOLS()
        
        On Error Resume Next
        
        'Send this applicaiton full name to the dll for future references. i.e. call backs
        dllObject.SetAccessApplicationPath CurrentProject.FullName
        
        'Enable this to see any erros happening when loading the dll
        dllObject.ShowDllWarnings = True
    End If
    
    Set DLL = dllObject
End Function

But when I want to compile I have an error on Function Toast : FormHelper. variable not define.

I don't understand why ?
Can you help me.

Ps: Thx for your good job and share it with the community

@EmanueleTinari
Copy link

Problems here too: Win11x64 and Officex32 in my pc. Problems as shown in pics. I tried to change dll declarations. I got both x32 and x64 dlls in the same dir, but I add two IFs in CLASS.KrishDll. Bottom, as you can see, notice that I call the entire dll PATH, so no problems with find it.

Option Explicit

#If Win64 Then
    #If VBA7 Then
        Private Declare PtrSafe Function KRISH_VBA_TOOLS Lib "D:\Documenti\Downloads\VBA_TOOLSx64.DLL" () As Object
    #Else
        Private Declare Function KRISH_VBA_TOOLS Lib "D:\Documenti\Downloads\VBA_TOOLSx64.DLL" () As Object
    #End If
#Else
    #If VBA7 Then
        Private Declare PtrSafe Function KRISH_VBA_TOOLS Lib "VBA_TOOLSx32.DLL" () As Object
    #Else
        Private Declare Function KRISH_VBA_TOOLS Lib "D:\Documenti\Downloads\VBA_TOOLSx32.DLL" () As Object
    #End If
#End If

Private dllObject As Object
......

' A simple Sub:

Sub TryCursorPosition()
Dim p

    If gDll Is Nothing Then
        Exit Sub
    Else
        p = gDll.GetCursorPosition()
    End If

End Sub


<img width="326" alt="Screenshot 2023-11-06 132935" src="https://github.com/krishKM/Modern-UI-Components-for-VBA/assets/82208785/c05cfe1b-b323-424e-88ab-f65b812f9e14">

<img width="590" alt="Screenshot 2023-11-06 121026" src="https://github.com/krishKM/Modern-UI-Components-for-VBA/assets/82208785/f7a4401d-0b03-4334-8304-fd02bb37a3f6">



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants