<DIV =OutlookMessageer lang=it dir=ltr align=left>I'm writing an integration between Proe and PLM,
and for the sake of technology I'm using bees weblink.
The approach that I'm having is to use protoolkit only for the management of menus and listener, the rest to use weblink encapsulated in an application Remoting.Net.
I managed through this code to retrieve items com weblink in protoolkit and go all'assembly. NET reference to the MpfcComGlobal.
The problem is that I can not return the session, they will hand side Protoolkit weblink.
In fact if I protoolkit side GetProeSession the subject I have nothing if I do so in the plugin. Net me PcfXNotConnectedToProe exception. Attention, if I run the same code by calling the assembly via COM. Net in an application javascript in your browser integrated work of all, the session is safely recovered.
What's wrong?
Thank you,
Vincenzo.</DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left></DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left></DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left>
#include "windows.h"
#import "ProeWildfireWebLink.tlb" named_guids raw_interfaces_only
#import "C:\Programmi\proeWildfire 2.0\i486_nt\lib\pfcscom.dll" named_guids raw_interfaces_only
#include <ProToolkit.h>
#include <ProCore.h>
#include <ProMenu.h>
#include <ProMenuBar.h>
#include <ProWstring.h>
#include <ProMessage.h>
#include <ProUtil.h>
#include <ProSection.h>
#include <ProSecerror.h>
#include <ProMdl.h>
#include <Pro2dEntdef.h>
#include <ProFeature.h>
#include <ProFeatType.h>
#include <ProSolid.h>
#include <ProWindows.h>
extern "C" int MenuFunction();
static ProName msgfil;
extern "C" int MenuFunction()
{
CoInitialize(NULL); //Initialize all COM Components
ProeWildfireWebLink::IStartComProePtr glob;
HRESULT hRes = glob.CreateInstance(ProeWildfireWebLink::CLSID_StartupComPro e);
pfc::IMpfcCOMGlobalPtr myPfc;
HRESULT hRes1 = myPfc.CreateInstance(pfc::CLSID_CMpfcCOMGlobal);
VARIANT mts;
mts.vt = VT_DISPATCH;
pfc::IDpfcSessionPtr mySession1;
pfc::IpfcSession *mySession;
MessageBox(NULL, L"This is a message from a ProTK App", L"Pro/Toolkit App", MB_OK);
HRESULT dd = myPfc->GetProESession(&mySession);
if (dd!=0) MessageBox(NULL, L"Error" + dd, L"Pro/Toolkit App", MB_OK);
if (mySession == NULL) MessageBox(NULL, L"sema", L"Pro/Toolkit App", MB_OK);
MessageBox(NULL, L"This is a message from a ProTK App", L"Pro/Toolkit App", MB_OK);
/*mts.pdispVal = const_cast<LPDISPATCH> (mySession);
*/
mySession1 = (pfc::IDpfcSessionPtr)mySession;
mts.pdispVal = (LPDISPATCH) (mySession1);
glob->myLogin(&mts);
/* pfc::CMpfcCOMGlobal *pfc = new pfc::CMpfcCOMGlobal();
pfc::CCpfcModelTypeClass *modelType = new pfc::CCpfcModelTypeClass();
pfc::CCpfcFeatureTypeClass *FeatureType = new pfc::CCpfcFeatureTypeClass();
glob->SetApplication(&pfc,modelType,FeatureType);
glob->login("eplms", "eplms");*/
return 0;
}
static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
/*========================================================== =================*\
Function : main
Purpose : Call the ProToolkitMain() function. main is optional function.
\*========================================================== =================*/
extern "C" int main(int argc, char **argv)
{
ProToolkitMain(argc, argv);
return(0);
}
/*========================================================== =================*\
Function : user_initialize
Purpose : Required entry point for Pro/Toolkit
\*========================================================== =================*/
extern "C" int user_initialize()
{
uiCmdCmdId menu_id;
ProError status;
status = ProMenubarMenuAdd( "Menu", "MenuLabel", "Help", PRO_B_FALSE, ProStringToWstring(msgfil, "menu.txt"));
ProCmdActionAdd("Menu", (uiCmdCmdActFn)MenuFunction, uiProe2ndImmediate, TestAccessDefault, PRO_B_TRUE,
PRO_B_TRUE, &menu_id);
ProMenubarmenuPushbuttonAdd("Menu", "PushButton", "PushButton", "PushButton",
NULL, PRO_B_TRUE, menu_id, ProStringToWstring(msgfil, "menu.txt"));
return 0;
}
extern "C" void user_terminate()
{
return;
}</DIV>
and for the sake of technology I'm using bees weblink.
The approach that I'm having is to use protoolkit only for the management of menus and listener, the rest to use weblink encapsulated in an application Remoting.Net.
I managed through this code to retrieve items com weblink in protoolkit and go all'assembly. NET reference to the MpfcComGlobal.
The problem is that I can not return the session, they will hand side Protoolkit weblink.
In fact if I protoolkit side GetProeSession the subject I have nothing if I do so in the plugin. Net me PcfXNotConnectedToProe exception. Attention, if I run the same code by calling the assembly via COM. Net in an application javascript in your browser integrated work of all, the session is safely recovered.
What's wrong?
Thank you,
Vincenzo.</DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left></DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left></DIV>
<DIV =OutlookMessageer lang=it dir=ltr align=left>
#include "windows.h"
#import "ProeWildfireWebLink.tlb" named_guids raw_interfaces_only
#import "C:\Programmi\proeWildfire 2.0\i486_nt\lib\pfcscom.dll" named_guids raw_interfaces_only
#include <ProToolkit.h>
#include <ProCore.h>
#include <ProMenu.h>
#include <ProMenuBar.h>
#include <ProWstring.h>
#include <ProMessage.h>
#include <ProUtil.h>
#include <ProSection.h>
#include <ProSecerror.h>
#include <ProMdl.h>
#include <Pro2dEntdef.h>
#include <ProFeature.h>
#include <ProFeatType.h>
#include <ProSolid.h>
#include <ProWindows.h>
extern "C" int MenuFunction();
static ProName msgfil;
extern "C" int MenuFunction()
{
CoInitialize(NULL); //Initialize all COM Components
ProeWildfireWebLink::IStartComProePtr glob;
HRESULT hRes = glob.CreateInstance(ProeWildfireWebLink::CLSID_StartupComPro e);
pfc::IMpfcCOMGlobalPtr myPfc;
HRESULT hRes1 = myPfc.CreateInstance(pfc::CLSID_CMpfcCOMGlobal);
VARIANT mts;
mts.vt = VT_DISPATCH;
pfc::IDpfcSessionPtr mySession1;
pfc::IpfcSession *mySession;
MessageBox(NULL, L"This is a message from a ProTK App", L"Pro/Toolkit App", MB_OK);
HRESULT dd = myPfc->GetProESession(&mySession);
if (dd!=0) MessageBox(NULL, L"Error" + dd, L"Pro/Toolkit App", MB_OK);
if (mySession == NULL) MessageBox(NULL, L"sema", L"Pro/Toolkit App", MB_OK);
MessageBox(NULL, L"This is a message from a ProTK App", L"Pro/Toolkit App", MB_OK);
/*mts.pdispVal = const_cast<LPDISPATCH> (mySession);
*/
mySession1 = (pfc::IDpfcSessionPtr)mySession;
mts.pdispVal = (LPDISPATCH) (mySession1);
glob->myLogin(&mts);
/* pfc::CMpfcCOMGlobal *pfc = new pfc::CMpfcCOMGlobal();
pfc::CCpfcModelTypeClass *modelType = new pfc::CCpfcModelTypeClass();
pfc::CCpfcFeatureTypeClass *FeatureType = new pfc::CCpfcFeatureTypeClass();
glob->SetApplication(&pfc,modelType,FeatureType);
glob->login("eplms", "eplms");*/
return 0;
}
static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
/*========================================================== =================*\
Function : main
Purpose : Call the ProToolkitMain() function. main is optional function.
\*========================================================== =================*/
extern "C" int main(int argc, char **argv)
{
ProToolkitMain(argc, argv);
return(0);
}
/*========================================================== =================*\
Function : user_initialize
Purpose : Required entry point for Pro/Toolkit
\*========================================================== =================*/
extern "C" int user_initialize()
{
uiCmdCmdId menu_id;
ProError status;
status = ProMenubarMenuAdd( "Menu", "MenuLabel", "Help", PRO_B_FALSE, ProStringToWstring(msgfil, "menu.txt"));
ProCmdActionAdd("Menu", (uiCmdCmdActFn)MenuFunction, uiProe2ndImmediate, TestAccessDefault, PRO_B_TRUE,
PRO_B_TRUE, &menu_id);
ProMenubarmenuPushbuttonAdd("Menu", "PushButton", "PushButton", "PushButton",
NULL, PRO_B_TRUE, menu_id, ProStringToWstring(msgfil, "menu.txt"));
return 0;
}
extern "C" void user_terminate()
{
return;
}</DIV>