Create two versions in your resource string - one that operates as a function, and one that operates as a command.
A simple example that I have is my
APPEND LIMB function/command combination.
Here are the resource strings used for that command.
APPEND LIMB[%LLLS%AppendLimb_3%Object number, Mesh number, Limb name
APPEND LIMB%LLS%AppendLimb_3%Object number, Mesh number, Limb name
APPEND LIMB[%LLL%AppendLimb_2%Object number, Mesh number
APPEND LIMB%LL%AppendLimb_2%Object number, Mesh number
One thing to note is that each function and its equivalent command use the same C++ function - even though the C++ function returns a value, when called as a command, DBPro will just ignore it.