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
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
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
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