Vlad
There are lots of errors in the API declarations. Although it compiles in 64-bit, that doesn't mean all the declarations actually work
For example, all handles/pointers such as hWnd, hDc need to be LongPtr...
I suspect almost all of the declarations aren't actually in use in your example file
Anyway, in case it helps, I've gone through the declarations in frmMBox:
Code:
#If VBA7 Then
'Declarations for A2010 or later (32-bit or 64-bit)
....
'pixels2twips declares
Private Declare PtrSafe Function apiGetDC Lib "user32" Alias "GetDC" (ByVal hwnd As LongPtr) As LongPtr 'CR
Private Declare PtrSafe Function apiReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As LongPtr, ByVal hDC As LongPtr) As Long 'CR
Private Declare PtrSafe Function apiGetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hDC As LongPtr, ByVal iCapability As Long) As Long 'CR
....
Private Declare PtrSafe Function apiMoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As LongPtr, _
ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare PtrSafe Function apiGetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As LongPtr, lpRect As RECT) As Long
Private Declare PtrSafe Function apiGetSysColor Lib "user32" Alias "GetSysColor" (ByVal nIndex As Long) As Long
Private Const COLOR_BTNFACE = 15
Private Declare PtrSafe Function apiGetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare PtrSafe Function apiGetTextFace Lib "gdi32" Alias "GetTextFaceA" (ByVal hDC As LongPtr, _
ByVal nCount As Long, ByVal lpFacename As String) As Long
'SL's autosize declares
...
Private Declare PtrSafe Function apiSelectObject Lib "gdi32" Alias "SelectObject" (ByVal hDC As LongPtr, _
ByVal hObject As LongPtr) As LongPtr 'CR
...
Private Declare PtrSafe Function apiCreateIC Lib "gdi32" Alias "CreateICA" _
(ByVal lpDriverName As String, ByVal lpDeviceName As String, _
ByVal lpOutput As String, lpInitData As Any) As LongPtr 'CR
Private Declare PtrSafe Function apiDeleteDC Lib "gdi32" _
Alias "DeleteDC" (ByVal hDC As LongPtr) As Long 'CR
Private Declare PtrSafe Function apiDrawText Lib "user32" Alias "DrawTextA" _
(ByVal hDC As LongPtr, ByVal lpStr As String, ByVal nCount As Long, _
lpRect As RECT, ByVal wFormat As Long) As Long 'CR
...
#Else
....
See attached
NOTE: I've not looked through the declarations in the rest of the file):
A useful resource for 32/64-bit conversion: https://www.rondebruin.nl/win/dennis...sapiviewer.htm