Start VC, choose File>New> Projects. Type in MT as the name of the project, and choose Win32 Application as the project type. Choose File>New>Files>C++ Source file, Add to project, and name it mt.cpp. Make sure your vfp COM server project has been built into a MTDLL with the Multi-Use attribute if you want to take advantage of MT. Paste the following code: #include "windows.h" #import "c:\fox\test\myserver.tlb" #define NUMTHREADS 10 #define NUMITER 10 class CThreadObj { public: static unsigned long __stdcall RealThreadStart(void *p); int VirtualThreadStart(); DWORD m_threadId; //and the thread ID int m_nthread; }; //These 2 macros make it easier to call methods on VFP servers. #define XDOCMD(cmd) v1 = cmd;v2 = pmyclass->mydocmd(&v1); #define XDOMETH(meth, cmd) v1 = cmd; v2 = pmyclass->##meth(&v1) int CThreadObj::VirtualThreadStart() { char szBuf[1000]; int i; CoInitialize(0); using namespace myserver; ImyclassPtr pmyclass; // declare a smart ptr to the server pmyclass.CreateInstance("myserver.myclass"); _variant_t v1,v2; long vfpthreadid; XDOCMD("declare integer GetCurrentThreadId in win32api"); for (i = 0 ; i < NUMITER ; i++) { //ask the server for the thread ID XDOMETH(myeval,"GetCurrentThreadId()"); vfpthreadid = v2.lVal; wsprintf(szBuf, "i = %d Thread # %d ID = %d VFPID = %d\n", i,m_nthread,m_threadId, vfpthreadid); //show the output in the VC Output Window OutputDebugString(szBuf); } pmyclass = 0; // release the server CoUninitialize(); return 0; } //this is the static real thread starting proc unsigned long __stdcall CThreadObj::RealThreadStart(void *p) { CThreadObj *pobj; //get a pointer to the thread object pobj = (CThreadObj *) p; // and call it's thread start routine pobj->VirtualThreadStart(); return 0; } int WINAPI WinMain(HINSTANCE , HINSTANCE , LPSTR , int ) { CThreadObj threads[NUMTHREADS]; //decl array of CThreadObj objects HANDLE harray[NUMTHREADS]; //array of handles for (int i = 0 ; i < NUMTHREADS ; i++) { threads[i].m_nthread = i; //record the thread # harray[i] = //record the thread ID CreateThread(NULL,0, CThreadObj::RealThreadStart, //thd strt addr (void *)&threads[i], //parm to pass to thrd NULL, &threads[i].m_threadId); } //now wait for all the threads to finish WaitForMultipleObjects(NUMTHREADS, harray, TRUE, INFINITE); return 0; }>I have a COM object created in FoxPro that I would like to use in a C++ COM Object. What I would like to do is have the C++ COM Object create an instance of the Fox COM object and return it. I am having problems getting my object to return and I think it is related to the datatype for the return item (the fox object). Is there anyone here who could help me with this? Thanks in advance for your help.