HTML editor to use in MS ACCESS Form (1 Viewer)

dafepi-2012

New member
Local time
Today, 16:06
Joined
Aug 21, 2012
Messages
13
Hi. I am attaching this HTML editor.
It runs fine in 32 bit Access but in 64 bit Access it gets an error
Any suggestion
Thank you
 

Attachments

  • HTML_Editor.mdb
    572 KB · Views: 197

theDBguy

I’m here to help
Staff member
Local time
Today, 13:06
Joined
Oct 29, 2018
Messages
21,358
Hi. What kind of error?
 

isladogs

MVP / VIP
Local time
Today, 20:06
Joined
Jan 14, 2017
Messages
18,186
There are a lot of issues to sort out before the code will compile in 64-bit

First of all your conditional compilation is too complex and reminds me how I used to do it several years ago.
The #If VBA7 section works in both bitnesses so remove ALL the api code below that and remove the #If WIN64 line

for example
Code:
#If VBA7 Then
Private Declare PtrSafe Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" (ByVal hDC As LongPtr, ByVal lpszFamily As String, ByVal lpEnumFontFamProc As LongPtr, lParam As Any) As LongPtr
Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As LongPtr) As LongPtr
Private Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hWnd As LongPtr, ByVal hDC As LongPtr) As LongPtr
Private Declare PtrSafe Function apiGetFocus Lib "user32" Alias "GetFocus" () As LongPtr
#Else '32-bit Office
Private Declare Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" (ByVal hDC As Long, ByVal lpszFamily As String, ByVal lpEnumFontFamProc As Long, lParam As Any) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Declare Function apiGetFocus Lib "user32" Alias "GetFocus" () As Long
#End If

NOTE I haven't checked each api has been converted correctly
Next do the same in the other module

That's the easy part done

now you need to go through each procedure in turn and add conditional compilation for each handle/pointer such as hWnd wherever they are used/defined. ... including in the proedure arguments. Here's one example

Code:
Sub FillListWithFonts(s As Variant) 'ctl As Control)

#If VBA7 Then
    Dim hDC As LongPtr
#Else
    Dim hDC As Long
#End If
    hDC = GetDC(0) 'fhWnd(ctl))
    'ctl.RowSource = vbNullString
    EnumFontFamilies hDC, vbNullString, AddressOf EnumFontFamProc, s
    ReleaseDC 0&, hDC
End Sub

There are quite a few more. Its going to take a while so I'll leave the rest to you!
You may be able to save some time by moving those definitions up to the declarations section......

Have fun and good luck!

Alternatively find another html editor that works in 64-bit
 

dafepi-2012

New member
Local time
Today, 16:06
Joined
Aug 21, 2012
Messages
13
There are a lot of issues to sort out before the code will compile in 64-bit

First of all your conditional compilation is too complex and reminds me how I used to do it several years ago.
The #If VBA7 section works in both bitnesses so remove ALL the api code below that and remove the #If WIN64 line

for example
Code:
#If VBA7 Then
Private Declare PtrSafe Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" (ByVal hDC As LongPtr, ByVal lpszFamily As String, ByVal lpEnumFontFamProc As LongPtr, lParam As Any) As LongPtr
Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As LongPtr) As LongPtr
Private Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hWnd As LongPtr, ByVal hDC As LongPtr) As LongPtr
Private Declare PtrSafe Function apiGetFocus Lib "user32" Alias "GetFocus" () As LongPtr
#Else '32-bit Office
Private Declare Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" (ByVal hDC As Long, ByVal lpszFamily As String, ByVal lpEnumFontFamProc As Long, lParam As Any) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Declare Function apiGetFocus Lib "user32" Alias "GetFocus" () As Long
#End If

NOTE I haven't checked each api has been converted correctly
Next do the same in the other module

That's the easy part done

now you need to go through each procedure in turn and add conditional compilation for each handle/pointer such as hWnd wherever they are used/defined. ... including in the proedure arguments. Here's one example

Code:
Sub FillListWithFonts(s As Variant) 'ctl As Control)

#If VBA7 Then
    Dim hDC As LongPtr
#Else
    Dim hDC As Long
#End If
    hDC = GetDC(0) 'fhWnd(ctl))
    'ctl.RowSource = vbNullString
    EnumFontFamilies hDC, vbNullString, AddressOf EnumFontFamProc, s
    ReleaseDC 0&, hDC
End Sub

There are quite a few more. Its going to take a while so I'll leave the rest to you!
You may be able to save some time by moving those definitions up to the declarations section......

Have fun and good luck!

Alternatively find another html editor that works in 64-bit

Now it works in both 32 and 64 bit versions but in the 64bit version it does not open the color selection in the HTML editor

I think it's something in the clsCommonDialog module.

Thanks for your help !!
 

Attachments

  • HTML_Editor-32-64bit.mdb
    596 KB · Views: 233

isladogs

MVP / VIP
Local time
Today, 20:06
Joined
Jan 14, 2017
Messages
18,186
Now it works in both 32 and 64 bit versions but in the 64bit version it does not open the color selection in the HTML editor

I think it's something in the clsCommonDialog module.

Thanks for your help !!

Hi
Congratulations. I haven't checked all functionality but I can see it now compiles. Well done.
Stephen Lebans created some amazing utilities but they are often very difficult to convert to 64-bit due to his extensive use of APIs

However, in the 20+ years since Stephen wrote most of his code, some of the things he produced can now be done by simpler methods
This is one of my SHTML editor forms that I created about 10 years ago
It includes similar features to Stephen's without requiring the two standard modules included in your file and (mostly) works in 64-bit

1612378633174.png


However, like yours, it does includes the class module clsCommonDialog and, as you said, the ShowColor procedure doesn't work in 64-bit.
I've never bothered to fix that as I normally use the form above in 32-bit Access.
In fact it may not be fixable for 64-bit

Nevertheless, There are alternatives to that code that do work perfectly in 64-bit.
For example, have a look at the Colour converter utility attached. The Colour Categories form opens a colour dialog as shown

1612379222581.png


Hope that helps
 

Users who are viewing this thread

Top Bottom