HRESULT CCommands::XApplicationEvents::WindowDeactivate(IDispatch* theWindow)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return S_OK;
}
Esempio n. 2
0
CRhinoCommand::result CCommandVRCreateViews::RunCommand( const CRhinoCommandContext& context )
{
	AFX_MANAGE_STATE( ::RhinoApp().RhinoModuleState() ); // dunno, from example

	ON_wString wStr;
	wStr.Format( L"READY SET\n", EnglishCommandName() );
	RhinoApp().Print( wStr );

	ON_SimpleArray<CRhinoView*> viewList; // don't know what is up with* this*
	ON_SimpleArray<ON_UUID> viewportIds;
	CRhinoView* lView = 0;
	CRhinoView* rView = 0;
	ON_SimpleArray<CRhinoView*> lrViews; // will contain our vr views
	int i = 0; // also use this in loops
	int lr = 0; // use to track 1st and 2nd find

	// builds a list of (current) viewport IDs
	context.m_doc.GetViewList( viewList, true, false );
	for ( i = 0; i < viewList.Count(); i ++)
	{
		CRhinoView* tempView = viewList[i]; // pull view out -> this is redeclared here, in sample, but not in second loop
		if (tempView)
			viewportIds.Append( tempView->ActiveViewportID() );
	}
	viewList.Empty(); // empty bc we are going to re-build later when new views

	context.m_doc.NewView( ON_3dmView() );
	context.m_doc.NewView( ON_3dmView() ); // we will build two

	// find viewport UUID just created
	context.m_doc.GetViewList( viewList, true, false);
	for (i = 0; i < viewList.Count(); i++)
	{
		CRhinoView* tempView = viewList[i];
		if (tempView)
		{
			int rc = viewportIds.Search( tempView->ActiveViewportID() ); // returns index of 1st element which satisfies search. returns -1 when no such item found
			if (rc < 0 ) // if current tempView did not exist prior to this running
			{
				if (lr > 0) // and if lr already found 1
				{
					rView = tempView; // right is 2nd view we find 
					break;
				// so this breaks when we find, and lView is left as the viewList[i] where we found the new viewport, whose ID was not in our list.
				// and we are left with lView being = viewList[i] at new view
				}
				if (lr == 0)
				{
					lView = tempView; // left is 1st view
					lr = 1;
				}
			}

			else
				tempView = 0; // reset lView to null and re-loop
		}
	}

	lrViews.Append(lView);
	lrViews.Append(rView);

	// init points
	ON_3dPoint locationL = ON_3dPoint(100.0,100.0,100.0);
	ON_3dPoint locationR = ON_3dPoint(100.0,165.1,100.0);
	ON_3dPoint targetSetup = ON_3dPoint(0,0,0);

	if (lView && rView)
	{
		for (int i = 0; i < 2; i++)
		{
			// 			RhinoApp().ActiveView()->
			ON_3dmView onView = lrViews[i]->ActiveViewport().View();

			if(i == 0)
				onView.m_name = L"lView";
				//lrViews[i]->MoveWindow(0,0,VR().resolution.w/2,VR().resolution.h, true);
			if(i == 1)
				onView.m_name = L"rView";
				//lrViews[i]->MoveWindow(960,0,VR().resolution.w/2,VR().resolution.h, true);
			lrViews[i]->ActiveViewport().SetView(onView);
			lrViews[i]->ActiveViewport().m_v.m_vp.ChangeToPerspectiveProjection(50,true,35);
			lrViews[i]->ActiveViewport().m_v.m_vp.SetCameraLocation(locationL);
			lrViews[i]->FloatRhinoView(true);
			lrViews[i]->Redraw();
		}
	}

	VR().lView = lView;
	VR().rView = rView;

	ON_wString SYNC;
	SYNC.Format(L"SYNCVRBEGIN\n" );
	RhinoApp().Print( SYNC );

	if (vrConduit.IsEnabled()
	&& ::IsWindow( vrConduit.m_hWnd1 )
	&& ::IsWindow( vrConduit.m_hWnd2 ) ) // if is already enabled ?
	{
		vrConduit.m_pView1 = 0;
		vrConduit.m_pView2 = 0;
		vrConduit.Disable();
	}
	else
	{
		vrConduit.m_pView1 = lView;
		vrConduit.m_pView2 = rView;
		vrConduit.m_hWnd1 = vrConduit.m_pView1->m_hWnd;
		vrConduit.m_hWnd2 = vrConduit.m_pView2->m_hWnd;

		SyncVR(lView, rView); // ok it runs once. we should also set them up perspective & looking at 0,0

		vrConduit.Bind( *lView );
		vrConduit.Bind( *rView );

		lView->Redraw();
		rView->Redraw();
		
		vrConduit.Enable();
	}

	// but do not update names immediately; have to refresh somehow

	// now re-name update positions outside of loop: continuously
	// bring in OVR Tracking and assign to VR Viewports
	// then, orbit?

	return CRhinoCommand::success;
}
Esempio n. 3
0
STDAPI DllCanUnloadNow(void)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
Esempio n. 4
0
// Dieser Code wird beim ersten Laden des Add-Ins und beim Starten der Anwendung aufgerufen
//  jeder nachfolgenden Developer Studio-Sitzung
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
		long dwCookie, VARIANT_BOOL* OnConnection)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// An uns übergebene Info speichern
	IApplication* pApplication = NULL;
	if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
		|| pApplication == NULL)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	m_dwCookie = dwCookie;

	// Befehlsverteilung erzeugen, Rückmeldung an DevStudio
	CCommandsObj::CreateInstance(&m_pCommands);
	m_pCommands->AddRef();

	// Das obige QueryInterface hat AddRef auf das Objekt Application angewendet. Es
	//  wird im Destruktor von CCommand freigegeben.
	m_pCommands->SetApplicationObject(pApplication);

	// (siehe Definition von VERIFY_OK in stdafx.h)

	VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));

	// DevStudio über die implementierten Befehle informieren

	VARIANT_BOOL bRet;
	CString strCmdString;

	LPCTSTR szNewQtProject = _T("New Qt Project");
	strCmdString.LoadString(IDS_NEWQTPROJECT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtProject + strCmdString), CComBSTR(_T("QMsDevNewQtProject")), 0, m_dwCookie, &bRet));
#if 1
	LPCTSTR szGenerateQtProject = _T("Generate Qt Project");
	strCmdString.LoadString(IDS_GENERATEQTPROJECT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szGenerateQtProject + strCmdString), CComBSTR(_T("QMsDevGenerateQtProject")), 1, m_dwCookie, &bRet));
#endif
	LPCTSTR szNewQtDialog = _T("New Qt Dialog");
	strCmdString.LoadString(IDS_NEWQTDIALOG_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtDialog + strCmdString), CComBSTR(_T("QMsDevNewQtDialog")), 2, m_dwCookie, &bRet));

	LPCTSTR szOpenDesigner = _T("Open Qt GUI Designer");
	strCmdString.LoadString(IDS_OPENDESIGNER_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szOpenDesigner + strCmdString), CComBSTR(_T("QMsDevStartDesigner")), 3, m_dwCookie, &bRet));

	LPCTSTR szUseQt = _T("Use Qt");
	strCmdString.LoadString(IDS_USEQT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szUseQt + strCmdString), CComBSTR(_T("QMsDevUseQt")), 4, m_dwCookie, &bRet));

	LPCTSTR szAddMOCStep = _T("Add MOC step");
	strCmdString.LoadString(IDS_ADDMOCSTEP_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddMOCStep + strCmdString), CComBSTR(_T("QMsDevAddMOCStep")), 5, m_dwCookie, &bRet));

	LPCTSTR szAddUICStep = _T("Add UIC step");
	strCmdString.LoadString(IDS_ADDUICSTEP_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddUICStep + strCmdString), CComBSTR(_T("QMsDevAddUICStep")), 6, m_dwCookie, &bRet));

	if (bRet == VARIANT_FALSE)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	if (bFirstTime == VARIANT_TRUE)
	{
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szNewQtProject), m_dwCookie));
#if 1
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szGenerateQtProject), m_dwCookie));
#endif
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szNewQtDialog), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szOpenDesigner), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szUseQt), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szAddMOCStep), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szAddUICStep), m_dwCookie));
	}

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Esempio n. 5
0
// This is called when the user first loads the add-in, and on start-up
//  of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
		long dwCookie, VARIANT_BOOL* OnConnection)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	// Store info passed to us
	IApplication* pApplication = NULL;
	if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
		|| pApplication == NULL)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	m_dwCookie = dwCookie;

	// Create command dispatch, send info back to DevStudio
	CCommandsObj::CreateInstance(&m_pCommands);
	m_pCommands->AddRef();

	// The QueryInterface above AddRef'd the Application object.  It will
	//  be Release'd in CCommand's destructor.
	m_pCommands->SetApplicationObject(pApplication);

	// (see stdafx.h for the definition of VERIFY_OK)

	VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));

	// Inform DevStudio of the commands we implement

	// TODO: Replace the AddCommand call below with a series of calls,
	//  one for each command your add-in will add.

	// The command name should not be localized to other languages.  The 
	//  tooltip, command description, and other strings related to this
	//  command are stored in the string table (IDS_CMD_STRING) and should
	//  be localized.
	LPCTSTR szCommand = _T("BackupProjectsAddinCommand");
	VARIANT_BOOL bRet;
	CString strCmdString;
	strCmdString.LoadString(IDS_CMD_STRING);
	strCmdString = szCommand + strCmdString;
	CComBSTR bszCmdString(strCmdString);
	CComBSTR bszMethod(_T("BackupProjectsAddinCommandMethod"));
	CComBSTR bszCmdName(szCommand);
	VERIFY_OK(pApplication->AddCommand(bszCmdString, bszMethod, 0, m_dwCookie, &bRet));
	if (bRet == VARIANT_FALSE)
	{
		// AddCommand failed because a command with this name already
		//  exists.  You may try adding your command under a different name.
		//  Or, you can fail to load as we will do here.
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	// Add toolbar buttons only if this is the first time the add-in
	//  is being loaded.  Toolbar buttons are automatically remembered
	//  by Developer Studio from session to session, so we should only
	//  add the toolbar buttons once.
	if (bFirstTime == VARIANT_TRUE)
	{
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, bszCmdName, m_dwCookie));
	}

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Esempio n. 6
0
void CLuaIDEInterfaceImpl::prepareDebug(const char *tmpProjectFile, lua_realloc_t reallocfunc, lua_free_t freefunc, HWND mainWnd)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    theApp.GetMainFrame()->InitExternalDebug(tmpProjectFile, reallocfunc, freefunc);
    theApp.m_EmbeddingAppWnd = mainWnd;
}
Esempio n. 7
0
void CLuaIDEInterfaceImpl::showDebugger(bool visible /*=true*/)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    theApp.GetMainFrame()->ShowWindow(visible ? SW_MAXIMIZE: SW_HIDE);
}
Esempio n. 8
0
//////////////////////////////////////////////////////////////////////////
//简要描述 : 设置扩展属性配置文件
//输入参数 :
//返 回 值 :
//
//
//修改日志 :
//////////////////////////////////////////////////////////////////////////
STDMETHODIMP CDwgWriter::put_XDataXMLConfigFile(BSTR sXMLFile)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    if (sXMLFile == NULL) return S_OK;

    CString sXml = sXMLFile;
    if (sXml.IsEmpty()) return S_OK;

    m_XDataCfgs.RemoveAll();

    try
    {
        CXMLFile xmlfile;
        xmlfile.load(sXml);
        MSXML2::IXMLDOMNodePtr pNode;
        MSXML2::IXMLDOMNodePtr pExtAttrNode = NULL;
        xmlfile.GetNode("LAYERS", pNode);
        if (pNode == NULL)
        {
            //AfxMessageBox("XML配置文件不正确,请检查。");
            m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
            return S_FALSE;
        }
        pNode = pNode->GetfirstChild();
        if (pNode == NULL)
        {
            //AfxMessageBox("XML配置文件不正确,请检查。");
            m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
            return S_FALSE;
        }
        CComBSTR bsNodeName;
        CComBSTR bsExtAttrs;
        CString sLayerName;
        CString sRegAppName;
        CString sExtAttrs;
        while (pNode != NULL)
        {
            //得到图层名
            pNode->get_nodeName(&bsNodeName);
            sLayerName = bsNodeName;

            //去掉前面的_前缀,解决数字开头的节点问题
            CString sSign = "";
            sSign = sLayerName.Mid(0, 1);
            if (sSign.CompareNoCase("_") == 0)
            {
                sLayerName = sLayerName.Mid(1);
            }

            XDataAttrLists* pExtAttrs = new XDataAttrLists();
            //得到图层下的注册应用名
            if (pNode->hasChildNodes())
            {
                pExtAttrNode = pNode->GetfirstChild();
                while (pExtAttrNode != NULL)
                {
                    pExtAttrNode->get_nodeName(&bsNodeName);
                    sRegAppName = bsNodeName;

                    //去掉前面的_前缀,解决数字开头的节点问题
                    sSign = sRegAppName.Mid(0, 1);
                    if (sSign.CompareNoCase("_") == 0)
                    {
                        sRegAppName = sRegAppName.Mid(1);
                    }

                    pExtAttrNode->get_text(&bsExtAttrs);
                    sExtAttrs = bsExtAttrs;
                    CStringList* pAttrLst = new CStringList();
                    //解析注册应用名下的属性字段名称
                    CString sAttr;
                    int iPos  = sExtAttrs.Find(',');
                    while (iPos > 0)
                    {
                        sAttr = sExtAttrs.Mid(0, iPos);
                        sExtAttrs = sExtAttrs.Mid(iPos + 1);
                        if (!sAttr.IsEmpty())
                        {
                            pAttrLst->AddTail(sAttr);
                        }
                        iPos  = sExtAttrs.Find(',');
                    }
                    if (iPos == -1)
                    {
                        if (!sExtAttrs.IsEmpty())
                        {
                            pAttrLst->AddTail(sExtAttrs);
                        }
                    }
                    pExtAttrs->SetAt(sRegAppName, pAttrLst);
                    //得到下一个注册应用名的配置
                    pExtAttrNode = pExtAttrNode->GetnextSibling();
                }
            }

            m_XDataCfgs.SetAt(sLayerName, pExtAttrs);
            //得到下一个图层的扩展属性的配置
            pNode = pNode->GetnextSibling();
        }
    }
    catch (...)
    {
		m_dwgWriter.WriteLog("解析XML文件出错,请检查。");
        return S_FALSE;
    }

    return S_OK;
}
Esempio n. 9
0
STEP_API UINT WINAPI STEPGetAPIVersion(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return STEP_API_VERSION;
}
Esempio n. 10
0
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return AfxDllGetClassObject(rclsid, riid, ppv);
}
Esempio n. 11
0
STDAPI DllCanUnloadNow(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return AfxDllCanUnloadNow();
}
STDMETHODIMP CCommands::CodeRoverActivateMethod() {
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

    connections->sendEvent("popup");
	return S_OK;
}
HRESULT CCommands::XDebuggerEvents::BreakpointHit(IDispatch* pBreakpoint)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return S_OK;
}
HRESULT CCommands::XApplicationEvents::NewWorkspace()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return S_OK;
}
Esempio n. 15
0
void CLuaIDEInterfaceImpl::sortFiles()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    theApp.GetMainFrame()->GetWorkspaceWnd()->GetTreeViewFiles()->Sort();
}
Esempio n. 16
0
STEP_API LPCTSTR WINAPI STEPGetPluginName(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return "STEP_fla";
}
Esempio n. 17
0
void CLuaIDEInterfaceImpl::debugInfo(const char *msg)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    theApp.GetMainFrame()->GetOutputWnd()->GetOutput(COutputWnd::outputDebug)->Write((std::string(msg) +  "\n").c_str());
}
Esempio n. 18
0
STEP_API bool WINAPI STEPSupportTrackNumberSIF(UINT nFormat) {
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return true;
}
Esempio n. 19
0
void CLuaIDEInterfaceImpl::stopDebug()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    theApp.GetMainFrame()->GetDebugger()->GetLuaHelper().Free();
    theApp.GetMainFrame()->ShowWindow(SW_HIDE);
}
Esempio n. 20
0
STEP_API bool WINAPI STEPHasSpecificColumnName(UINT)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return true;
}
Esempio n. 21
0
bool CLuaIDEInterfaceImpl::isBreaked()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return theApp.GetMainFrame()->appMode == CMainFrame::modeDebugBreak;
}
Esempio n. 22
0
void CBrowserPlugin::Draw(CDC* pDC)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
Esempio n. 23
0
BOOL CALLBACK CShellExt::PageDlgProc_mp3_LAME(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	LPCSHELLEXT	lpcs = (CShellExt *)GetWindowLongPtr(hDlg,DWLP_USER);
	CString strTmp;

	switch(uMessage){
	case WM_USER+1:	//表示のリフレッシュ
		DispInfo(hDlg,lpcs);
		break;
	case WM_INITDIALOG:
		{
			lpcs = (LPCSHELLEXT )((LPPROPSHEETPAGE )lParam)->lParam;
			SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)lpcs);
			//Ver情報
			SetDlgItemText(hDlg,IDC_STATIC_VER_INFO,SOFT_NAME);
			//情報を表示
			DispInfo(hDlg,lpcs);
		}
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam)){
		case IDC_CHECK_AOT:
			if(IsDlgButtonChecked(hDlg,IDC_CHECK_AOT) == BST_CHECKED)
			{
				lpcs->m_bPropAOT = TRUE;
				SetWindowPos(GetParent(hDlg),HWND_TOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			else
			{
				lpcs->m_bPropAOT = FALSE;
				SetWindowPos(GetParent(hDlg),HWND_NOTOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			if(lpcs->m_hwndId3v1)
				PostMessage(lpcs->m_hwndId3v1,WM_USER+1,0,0);
			if(lpcs->m_hwndId3v2)
				PostMessage(lpcs->m_hwndId3v2,WM_USER+1,0,0);
			regSetDword(HKEY_CURRENT_USER,MP3INFP_REG_ENTRY,_T("PropAOT"),(DWORD )lpcs->m_bPropAOT);
			break;
		case IDC_SETUP:
			ShellExecute(hDlg,_T("open"),_T("rundll32.exe"),_T("shell32.dll,Control_RunDLL mp3infp.cpl,,2"),NULL,SW_SHOW);
			break;
		case IDC_HELPVIEW:
			lpcs->OpenHtmlHelp(hDlg,_T("extension.htm"));
			break;
		}
		break;

	//状況依存ヘルプ
	case WM_HELP:
	{
		TCHAR szTmp[256];
		lstrcpy(szTmp,SOFT_NAME);
		lstrcat(szTmp,_T(" "));
		lstrcat(szTmp,COPY_RIGHT);
		MessageBox(hDlg,szTmp,_T("About"),MB_APPLMODAL);
		break;
	}


	default:
		return FALSE;
	
	}

	return TRUE;
}
Esempio n. 24
0
BOOL WebLogic(const char * strParas, char * szReturn, int& nSize)
//(CStringList &paramList, char *szReturn)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	//参数解析:
	CString		
        strServIp = _T(""), 
		strServPort = _T(""), 
		strUserName = _T(""), 
		strUserPwd = _T(""),
		strTaskType = _T(""),
		strTaskParam = _T("");
	
	CString	
        strProxyServ = _T(""), 
		strProxyUser = _T(""); 
	
	int	nServerPort = 21;		
	int nTimeout = 60;

	BOOL bRet = FALSE;
	
	// Check Content Change
	CStringList paramList;

	MakeStringListByChar(paramList,strParas);
	POSITION pos = paramList.GetHeadPosition();
	while(pos)
	{
		CString strTemp = paramList.GetNext(pos);
		if(strTemp.Find(__USERNAME__, 0) == 0)
		{
			strUserName = strTemp.Right(strTemp.GetLength() - strlen(__USERNAME__));
		}
		else if(strTemp.Find(__PASSWORD__, 0) == 0)
		{
			strUserPwd = strTemp.Right(strTemp.GetLength() - strlen(__PASSWORD__));
		}
		else if(strTemp.Find(__TIMEOUT__, 0) == 0)
		{
			nTimeout = atoi(strTemp.Right(strTemp.GetLength() - strlen(__TIMEOUT__)));
		}
		else if(strTemp.Find(__SERVERIP__, 0) == 0)
		{
			strServIp = strTemp.Right(strTemp.GetLength() - strlen(__SERVERIP__));
		}
		else if(strTemp.Find(__SERVERPORT__, 0) == 0)
		{
			strServPort = strTemp.Right(strTemp.GetLength() - strlen(__SERVERPORT__));
		}
		else if(strTemp.Find(__TASKTYPE__, 0) == 0)
		{
			strTaskType = strTemp.Right(strTemp.GetLength() - strlen(__TASKTYPE__));
		}
		else if(strTemp.Find(__TASKPARAM__, 0) == 0)
		{
			strTaskParam = strTemp.Right(strTemp.GetLength() - strlen(__TASKPARAM__));
		}
		else
		{
		
		}
	}
				
	if(strUserName.IsEmpty())
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_UserName"));//"缺少用户姓名!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
		return FALSE;
	}
	
	if(strUserPwd.IsEmpty())
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_Password"));//"缺少用户密码!");//<%IDS_Monitor_40%>
		return FALSE;
	}
	
	if(strServIp.IsEmpty())
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerAddress"));//"缺少服务器地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
		return FALSE;
	}
	
	if(strServPort.IsEmpty())
	{
        sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerPort"));//"缺少服务器端口地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
		return FALSE;
	}

	if(strTaskType.IsEmpty())
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_TaskType"));//"缺少任务类型!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
		return FALSE;
	}	

	if(strTaskParam.IsEmpty())
	{
		//为解决大部分Weblogic监视器不能工作问题,修改代码。修改开始  苏合 2007-09-18
		//strTaskParam = "null";
		strTaskParam = "";
		//为解决大部分Weblogic监视器不能工作问题,修改代码。修改结束  苏合 2007-09-18
	}	

	
	if(nTimeout <= 0)
	{
        sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_TimeoutParamError"));//"超时参数有错误!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"		  		  
		return FALSE;
	}
	

	//取数据的实现
	CString		strCustomerPath = _T("");
	strCustomerPath.Format("%s\\fcgi-bin", FuncGetInstallRootPath());

    //CString strCmdLine = "CMD /C " + strCustomerPath + "\\MonitorManager\\WeblogicMonitor.bat \"";

	CString strCmdLine = "CMD /C \"" + strCustomerPath + "\\WeblogicMonitor.bat\" ";

	strCmdLine += strUserName + " ";
	strCmdLine += strUserPwd + " ";
	//为解决大部分Weblogic监视器不能工作问题,修改代码。修改开始  苏合 2007-09-18
	//strCmdLine += "t3://" + strServIp + ":" + strServPort;
	//strCmdLine += " " + strTaskType;
	//strCmdLine += " " + strTaskParam;
	strCmdLine += strServIp + " ";
	strCmdLine += strServPort + " ";
	strCmdLine += strTaskType + " ";
	strCmdLine += strTaskParam;
	//为解决大部分Weblogic监视器不能工作问题,修改代码。修改结束  苏合 2007-09-18

	SECURITY_ATTRIBUTES sa;	
	sa.nLength = sizeof(SECURITY_ATTRIBUTES);
	sa.bInheritHandle = TRUE;
	sa.lpSecurityDescriptor = NULL;
	
	HANDLE hRead, hWrite;
	long retval = CreatePipe(&hRead, &hWrite, &sa, 12000) ;
	if(retval == 0)
	{
		return false;
	}
	else
	{
		STARTUPINFO si;
		memset(&si, 0, sizeof(STARTUPINFO));
		si.cb = sizeof(STARTUPINFO);
		si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
		si.hStdOutput = hWrite;
		si.hStdError = hWrite;
	//	si.wShowWindow =SW_HIDE;
		
		PROCESS_INFORMATION pi;
		memset(&pi, 0, sizeof(PROCESS_INFORMATION));
		puts(strCmdLine);
		if (CreateProcess(NULL, strCmdLine.GetBuffer(strCmdLine.GetLength()),  &sa, &sa, TRUE, CREATE_NEW_CONSOLE/*CREATE_NO_WINDOW*/, NULL, NULL, &si, &pi)) 
		{
			bRet = TRUE;
			DWORD dwResult = WaitForSingleObject(pi.hProcess, 6000*1000);
			if (dwResult == WAIT_OBJECT_0) 
			{				
				DWORD dwExitCode = 0;
				if (GetExitCodeProcess(pi.hProcess, &dwExitCode)) 
				{
					//if (dwExitCode == 0) 
					{ 
						//
						CFile* pFile = NULL;
						int nFileLength = 0;
						TRY	
						{
							pFile = new CFile(hRead);								
							nFileLength = pFile->GetLength();
						}
						CATCH(CFileException, pEx) 
						{
							// Do Nothing.
						}
						END_CATCH
							
						char * buffer = NULL;
						buffer = (char*)malloc(nFileLength+1);
						
						//
						pFile->Read(buffer, nFileLength);
						
						CString strSource = _T("");
						strSource.Format("%s", buffer);
						
						//WeblogicMonitor(去掉call setWLSEnv.cmd所生成的输出)
						int nOrder = strSource.Find("FileSplitFlag");
						nOrder += 13;
						strSource = strSource.Mid(nOrder);

						//
						nOrder = strSource.Find("EndSplitFlag");
						//nOrder += 13;
						strSource = strSource.Left(nOrder);
						
						strSource.Replace("WaitingForConnectionCurrentCount","WaitConnetCurCount");
						strSource.Replace( "Error=","error=" );
						//生成正确格式的输出串
						strcpy(szReturn, strSource);
						
						//sprintf(szReturn, "error=%s",buffer);
						
						//
						free(buffer);
						
						if (pFile != NULL)   
						{
							pFile->Close();
							delete pFile;
						}					
					}
					//else
					{
						
					}
				}
Esempio n. 25
0
void CSelectMemberDlg::OnMemberAdded(LPCTSTR lpszName, BYTE* abMac, DWORD dwMemberIp, DWORD dwUserData)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
Esempio n. 26
0
int	WINAPI RecordMacro(BOOL bJScript, HWND hParent, const char* szFileOut)
{
	__FLOWLOG
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	COleDateTime dt=COleDateTime::GetCurrentTime();
	if(dt.GetMonth()!=4){
		AfxMessageBox("This is demo version of macro recorder.\nContact WiredPlane.com for full version");
		return 0;
	}
	if(hMacroRecControlWindow!=0){
		AfxMessageBox("To record new macro, You have to stop\nrecording previous macro");
		return 0;
	}
	hwndDlgBeforeActive=GetForegroundWindow();
	static long lMacroCounter=1;
	plgOptions.sLastMacroContent="";
	DWORD dwStart=GetTickCount();
	plgOptions.lMFormat=bJScript?2:0;
	plgOptions.bRecPauses=1;
	plgOptions.bAppSwitchesRTyp=0;
	plgOptions.lPauseLevel=1;
	plgOptions.bAppSwitchesRTyp=0;
	bSkipPreparations=1;
	ATOM at=GlobalAddAtom("WK_RECORDING");
	{
		__FLOWLOG
		DWORD dwRes=DialogBox(WKGetPluginContainer()->GetPluginDllInstance(),MAKEINTRESOURCE(IDD_OPTIONS),hParent,OptionsDialogProc);
	}
	if(!WKUtils::isWKUpAndRunning()){
		return 0;
	}
	GlobalDeleteAtom(at);
	if(plgOptions.sLastMacroContent==""){
		return 0;
	}
	CString sMacroTemplate=	"// Language: %s\r\n"\
							"// Title: %s\r\n"\
							"// Description: Recorded macro\r\n"\
							"// ParamType: String\r\n\r\n"\
							"%s"\
							"%s"\
							"\r\n"\
							"// <wkMain>: Action\r\n"\
							"function wkMain()\r\n"\
							"{// wkMain description: Replay keystrokes\r\n"\
							"%s"\
							"};\r\n"\
							"// </wkMain>: End of Action\r\n"\
							"\r\n";
	CString sDopFunc=		(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"":"// System object that will be used to replay recorded keystrokes\r\nvar WshShell = new ActiveXObject('WScript.Shell');\r\n";
	sDopFunc+=				"// Playback Speed ratio ('1' means as recorded)\r\n";
	sDopFunc+=				"var iMacroSpeed = 1.0;";
	sDopFunc+=				"\r\n";
	CString sWaitFunc=		(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"":"function Wait(time)\r\n"\
							"{\r\n"\
							"	var d = new Date();\r\n"\
							"	var timeCounter = 0;\r\n"\
							"	while((new Date()).getSeconds()-d.getSeconds()<(time*iMacroSpeed)){\r\n"\
							"		timeCounter++;\r\n"\
							"	};\r\n"\
							"}\r\n";
	plgOptions.sLastMacroContent=Format(sMacroTemplate,(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"JScript":"JScript",plgOptions.sLastMacroName,sDopFunc,(plgOptions.bRecPauses?sWaitFunc:""),plgOptions.sLastMacroContent);
	DWORD dwStop=GetTickCount();
	SaveFile(szFileOut,plgOptions.sLastMacroContent);
	return 1;
}
Esempio n. 27
0
void CExtMiniDockFrameWnd::_ResizingStart(
	UINT nHitTest,
	const CPoint & point
	)
{
#ifdef _USRDLL
	// If this is a DLL, need to set up MFC state
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif

	ASSERT( m_nResizingMode == HTNOWHERE );
	ASSERT( IsWindowVisible() );

	CExtPopupMenuWnd::CancelMenuTracking();
	CWnd::CancelToolTips();

CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );
	if( !pExtBar->_IsShowContentWhenDragging()
		&&	pExtBar->IsFixedMode()
		)
	{
		m_nResizingMode = HTNOWHERE;
		pExtBar->m_pDockContext->StartResize(nHitTest, point);
		return;
	}

	switch( nHitTest )
	{
	case HTLEFT:
	case HTRIGHT:
	case HTTOP:
	case HTTOPLEFT:
	case HTTOPRIGHT:
	case HTBOTTOM:
	case HTBOTTOMLEFT:
	case HTBOTTOMRIGHT:
		m_nResizingMode = nHitTest;
	break;
	default:
		return;
	} // switch( nHitTest )

#ifdef _DEBUG
int nPos = 1;
CControlBar * pDebugDummyBar = NULL;
	while(
		pDebugDummyBar == NULL
		&& nPos < m_wndDockBar.m_arrBars.GetSize()
		)
		pDebugDummyBar =
			reinterpret_cast<CExtDockBar&>
				(m_wndDockBar).
					GetDockedControlBar(nPos++);
	ASSERT(pDebugDummyBar != NULL);
	ASSERT_KINDOF(CExtControlBar, pDebugDummyBar);
	ASSERT(pDebugDummyBar->m_pDockContext != NULL);
	// CBRS_SIZE_DYNAMIC toolbars cannot have the CBRS_FLOAT_MULTI style
	ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0);
#endif // _DEBUG
	
	ASSERT( pExtBar == pDebugDummyBar );
	ASSERT(pExtBar->m_pDockContext != NULL);

	if( !pExtBar->IsFixedMode() )
		ModifyStyle( __REMOVED_NONFIXMODE_STYLES, 0 );
	BringWindowToTop();
	CExtMouseCaptureSink::SetCapture( GetSafeHwnd() );
	GetWindowRect( &m_rcWndResizingStart );

	while( m_nResizingMode != HTNOWHERE )
	{
		::WaitMessage();
		MSG msg;
		// Process all the messages in the message queue
		while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
		{
			bool bStop = false;
			switch( msg.message )
			{
			case WM_ACTIVATEAPP:
			case WM_COMMAND:
				bStop = true;
			break;
			default:
				if(	WM_KEYFIRST <= msg.message
					&& msg.message <= WM_KEYLAST
					)
				bStop = true;
			break;
			} // switch( msg.message )
			if( (!bStop) &&
				CExtMouseCaptureSink::GetCapture() != GetSafeHwnd()
				)
				bStop = true;
			if( bStop )
			{
				_ResizingEnd();
				return;
			}
			if( !AfxGetApp()->PumpMessage() )
			{
				PostQuitMessage(0);
				return; // Signal WM_QUIT received
			} // if( !AfxGetApp()->PumpMessage() )
		} // while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
		
		if( CExtControlBar::g_bEnableOnIdleCalls )
		{
			LONG lIdle = 0;
			while( AfxGetApp()->OnIdle(lIdle++) );
		}
	} // while( m_nResizingMode != HTNOWHERE )
}
Esempio n. 28
0
int	WINAPI WKInitRecording(HWND hParent)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	if(!pInter){
		AfxMessageBox("Container not found!!!");
		return 0;
	}
	if(hMacroRecControlWindow!=0){
		AfxMessageBox(_pl("To record new macro, You have to stop\nrecording previous macro"));
		return 0;
	}
	static long lMacroCounter=1;
	plgOptions.sLastMacroName="";
	COleDateTime dt=COleDateTime::GetCurrentTime();
	plgOptions.sLastMacroName.Format("%s (%02lu.%02lu.%04lu)",GetRandomName(),dt.GetDay(),dt.GetMonth(),dt.GetYear());
	lMacroCounter++;
	char szPrefFolder[MAX_PATH]="";
	pInter->GetPreferencesFolder(szPrefFolder,sizeof(szPrefFolder));
	CString sTargetFile=szPrefFolder;
	sTargetFile+="RecorderMacro\\";
	if(int(GetFileAttributes(sTargetFile))==-1){
		::CreateDirectory(sTargetFile,NULL);
	}
	plgOptions.sLastMacroContent="";
	DWORD dwStart=GetTickCount();
	ATOM at=GlobalAddAtom("WK_RECORDING");
	DWORD dwRes=DialogBox(WKGetPluginContainer()->GetPluginDllInstance(),MAKEINTRESOURCE(IDD_OPTIONS),hParent,OptionsDialogProc);
	if(!WKUtils::isWKUpAndRunning()){
		return 0;
	}
	GlobalDeleteAtom(at);
	if(dwRes!=0){
		// Пользователь отказался...
		return 0;
	}
	if(pInter){
		pInter->PushMyOptions(0);
	}
	if(plgOptions.sLastMacroContent==""){
		return 0;
	}
	CString sMacroFileNm=plgOptions.sLastMacroName;
	MakeSafeFileName(sMacroFileNm);
	sTargetFile+=sMacroFileNm;
	sTargetFile+=".wkm";
	// Добавлять иконку на время записи макроса
	// Префикс макроса...
	CString sMacroTemplate=	"// Language: %s\r\n"\
							"// Title: %s\r\n"\
							"// Description: Recorded macro\r\n"\
							"// ParamType: String\r\n"\
							"// Hint: wait_for_key_release;\r\n\r\n"\
							"%s"\
							"%s"\
							"\r\n"\
							"// <wkMain>: Action\r\n"\
							"function wkMain()\r\n"\
							"{// wkMain description: Replay keystrokes\r\n"\
							"%s"\
							"};\r\n"\
							"// </wkMain>: End of Action\r\n"\
							"\r\n";
	CString sDopFunc=		(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"":"// System object that will be used to replay recorded keystrokes\r\nvar WshShell = new ActiveXObject('WScript.Shell');\r\n";
	sDopFunc+=				"// Playback Speed ratio ('1' means as recorded)\r\n";
	sDopFunc+=				"var iMacroSpeed = 1.0;";
	sDopFunc+=				"\r\n";
	CString sWaitFunc=		(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"":"function Wait(time)\r\n"\
							"{\r\n"\
							"	var d = new Date();\r\n"\
							"	var timeCounter = 0;\r\n"\
							"	while((new Date()).getSeconds()-d.getSeconds()<(time*iMacroSpeed)){\r\n"\
							"		timeCounter++;\r\n"\
							"	};\r\n"\
							"}\r\n";
	plgOptions.sLastMacroContent=Format(sMacroTemplate,(plgOptions.lMFormat==0 || plgOptions.lMFormat==1 || plgOptions.lMFormat==3)?"JScript":"JScript",plgOptions.sLastMacroName,sDopFunc,(plgOptions.bRecPauses?sWaitFunc:""),plgOptions.sLastMacroContent);
	DWORD dwStop=GetTickCount();
	CString sTime;
	sTime.Format("%.2f",double(dwStop-dwStart)/1000);
	int iRes=::MessageBox(NULL,_pl("Macro recorded")+"!\n"+_pl("Duration")+": "+sTime+_pl("sec")+". "+_pl("Continue")+"?",_pl("Macro successfully recorded")+"!",IDOK);
	if(iRes==IDOK){
		SaveFile(sTargetFile,plgOptions.sLastMacroContent);
		if(plgOptions.bAP_Add2WK && pInter){
			pInter->AddQrunFromFile(sTargetFile);
		}
		if(plgOptions.bAP_OpenInEd && pInter){
			int iRes=(int)::ShellExecute(NULL,"open","notepad.exe",CString("\"")+sTargetFile+CString("\""),NULL,SW_SHOWNORMAL);
		}
	}
	return 1;
}
Esempio n. 29
0
void UIThread::OnDoWork() 
{
	AFX_MANAGE_STATE (theApp.GetModuleState ());
	AfxEndThread (m_pfnThread (m_lpParam));
}
HRESULT CCommands::XApplicationEvents::NewDocument(IDispatch* theDocument)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return S_OK;
}