Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE Server and Cannot Quit FoxPro
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
OLE Server and Cannot Quit FoxPro
Divers
Thread ID:
00104956
Message ID:
00104956
Vues:
82
I'm setting up a VFP Automation Server derived from Custom compiled to a .DLL. And instantiating the server from a VC++5 .exe (code below). At the very end of the InitInstance() code below when the oDataServer variable goes out of scope VFP throws up a Cannot Quit FoxPro dialog. After clicking the OK button the server gets a Destroy() message.

Now I have a server method Terminate() which closes down the server, and in there I can do a "keyboard chr(13)" to dismiss the dialog, but talk about your all time kludges. I'm trying to find out what triggers the stupid thing in the first place. There is no UI code the only output of the server is done via table inserts and replaces, and using TEXTMERGE to output diagnostic messages to a text file.

TIA,
df
// start generated code
BOOL CTest2App::InitInstance()
{
// Initialize OLE libraries
if (!AfxOleInit())
{
	AfxMessageBox(IDP_OLE_INIT_FAILED);
	return FALSE;
}

AfxEnableControlContainer();

if (RunEmbedded() || RunAutomated())
{
	// Register all OLE server (factories) as running.  This enables the
	//  OLE libraries to create objects from other applications.
	COleTemplateServer::RegisterAll();
}
else
{
	// When a server application is launched stand-alone, it is a good idea
	//  to update the system registry in case it has been damaged.
	COleObjectFactory::UpdateRegistryAll();
}

CTest2Dlg dlg;
m_pMainWnd = &dlg;

// end generated code

cstDataServer oDataServer;
COleException *pError = new COleException;
oDataServer.CreateDispatch( "dataserver2.cstdataserver", pError );
oDataServer.Initialize();
//... calls to server in here work fine
oDataServer.Terminate();
oDataServer.ReleaseDispatch();

int nResponse = dlg.DoModal();

if (nResponse == IDOK)
{
	// TODO: Place code here to handle when the dialog is
	//  dismissed with OK
}
else if (nResponse == IDCANCEL)
{
	// TODO: Place code here to handle when the dialog is
	//  dismissed with Cancel
}

return FALSE;
}
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform