I have this code that I ported to VBA by using the original command as defined in aced.h The types seem to be correct, unless of course I am missing something really huge. The efforts always bring AutoCAD to a fatal error .. of course, I know this is not the preferred method, but I really would like to have this color dialog interface.
Here is the code
' This is the definition of acedSetColorDialogTrueColor as found in aced.h
' acedSetColorDialogTrueColor(
' AcCmColor& color,
' Adesk::Boolean bAllowMetaColor,
' const AcCmColor& curLayerColor,
' AcCm::DialogTabs tabs = (AcCm::DialogTabs)(AcCm::kACITab | AcCm::kTrueColorTab| AcCm::kColorBookTab));
'
' My understanding is that AcCmColor& is a pointer to the AcCmColor object(AcadAcCmColor in VBA)
' Constants are directly from aced.h
Private Declare Function acedSetColorDialogTrueColor Lib "acad.exe" (ByVal pColor As Long, _
ByVal bAllowMetaColor As Boolean, ByVal pCurLayerColor As Long, ByVal DialogTabs As Integer) As Boolean
Private Const kACITab = 1
Private Const kTrueColorTab = 2
Private Const kColorBookTab = 4
Public Function GetAcadTrueColor(MtaCol As Boolean) As Object
Dim SelectColor As AcadAcCmColor 'This is returned from the call
Dim LayColor As New AcadAcCmColor ' This is sent to the call, thus I initialize it first without regard to the color
On Error Resume Next
If acedSetColorDialogTrueColor(ObjPtr(SelectColor), MtaCol, ObjPtr(LayColor), kACITab Or kTrueColorTab Or kColorBookTab) Then
Set GetAcadTrueColor = SelectColor 'return AcadAcCmColor
End If
End Function
I have seen where many other people would like this functionality as well, so it would be a good thing if it could be completed accurately.