Join a computer to Domain?

I am looking for a function call that allows my local computer
to go from a workgroup member to joining a specific domain. I know how
to do it through the Network control panel; how can it be done
programmatically? I have been searching the NET APIs, and found
“NetJoinDomain()”
but this function just supported by Win2K, My program must run on
Win9X/NT/2K/XP,
Does anybody have some suggestion?