Example #1
0
///////////////////////////////////////////////////////////////////////////////
// Korrektur des Namens, der am TRiAS-Objekt geschrieben werden soll
// Für DLK wird am Objekt geschrieben:
//		LetztesUnterVerzeichnis@@BildName
STDMETHODIMP CMapGeoPunktDLK::CorrectName (BSTR bstrDestDir, BSTR bstrName, BSTR *pbstrToWrite)
{
    CHECKINPOINTER(pbstrToWrite);
    *pbstrToWrite = NULL;

    CHECKINPOINTER(bstrDestDir);
    CHECKINPOINTER(bstrName);

    USES_CONVERSION;

// String erzeugen, der am Objekt gespeichert werden soll
    os_path path = OLE2A(bstrDestDir);
    CString strT;

    if (path.levels() > 1)
        strT = path[path.levels()-1].c_str();
    if (-1 != strT.Find(' '))
        strT = "\"" + strT + "\"";

    strT += "@@@";
    if (::SysStringLen(bstrName) > 0)
        strT += bstrName;
    else
        return E_UNEXPECTED;

    *pbstrToWrite = strT.AllocSysString();
    return S_OK;
}
Example #2
0
HRESULT CScriptManager::AddNamedItems( IActiveScript* pScript )
{
   HRESULT hResult;
   POSITION posNamedItem;
   IDispatch* pDispatch;
   CString strItemName;
   BSTR bstrItemName;

   ENSURE( pScript != NULL );

   hResult = pScript->AddNamedItem( L"TCForm", SCRIPTITEM_ISVISIBLE|
	  SCRIPTITEM_ISSOURCE );
   if( FAILED( hResult ) )
   {
	  return( hResult );
   }

   posNamedItem = m_mapNamedItems.GetStartPosition();
   while( posNamedItem != NULL )
   {
	  m_mapNamedItems.GetNextAssoc( posNamedItem, strItemName, pDispatch );
	  bstrItemName = strItemName.AllocSysString();
	  hResult = pScript->AddNamedItem( bstrItemName, SCRIPTITEM_ISVISIBLE|
		 SCRIPTITEM_ISSOURCE );
	  SysFreeString( bstrItemName );
	  if( FAILED( hResult ) )
	  {
		 return( hResult );
	  }
   }

   return( S_OK );
}
Example #3
0
BOOL CADOParameter::SetValue(CString strValue)
{
	_variant_t vtVal;

	ASSERT(m_pParameter != NULL);
	
	if(!strValue.IsEmpty())
		vtVal.vt = VT_BSTR;
	else
		vtVal.vt = VT_NULL;

	//Corrected by Giles Forster 10/03/2001
	vtVal.bstrVal = strValue.AllocSysString();
	//vtVal.SetString(strValue.GetBuffer(0));

	try
	{
		if(m_pParameter->Size == 0)
			m_pParameter->Size = sizeof(char) * strValue.GetLength();

		m_pParameter->Value = vtVal;
		::SysFreeString(vtVal.bstrVal);
		return TRUE;
	}
	catch(_com_error &e)
	{
		dump_com_error(e);
		::SysFreeString(vtVal.bstrVal);
		return FALSE;
	}
}
Example #4
0
void CSetBugTraqAdv::OnBnClickedOptions()
{
    m_provider_clsid = GUID_NULL;

    int index = m_cProviderCombo.GetCurSel();
    if (index != CB_ERR)
    {
        CBugTraqProvider *provider = (CBugTraqProvider *)m_cProviderCombo.GetItemDataPtr(index);
        m_provider_clsid = provider->clsid;
    }

    CComPtr<IBugTraqProvider2> pProvider;
    HRESULT hr = pProvider.CoCreateInstance(m_provider_clsid);

    if (SUCCEEDED(hr))
    {
        ATL::CComBSTR temp;
        CString p;
        GetDlgItemText(IDC_BUGTRAQPARAMETERS, p);
        ATL::CComBSTR params;
        params.Attach(p.AllocSysString());
        hr = pProvider->ShowOptionsDialog(GetSafeHwnd(), params, &temp);
        if (SUCCEEDED(hr))
        {
            SetDlgItemText(IDC_BUGTRAQPARAMETERS, temp == 0 ? "" : temp);
        }
        else
        {
            COMError ce(hr);
            CString sErr;
            sErr.FormatMessage(IDS_ERR_FAILEDISSUETRACKERCOM, ce.GetSource().c_str(), ce.GetMessageAndDescription().c_str());
            ::MessageBox(m_hWnd, sErr, L"TortoiseSVN", MB_ICONERROR);
        }
    }
}
Example #5
0
void CSetBugTraqAdv::OnBnClickedOptions()
{
    m_provider_clsid = GUID_NULL;

    int index = m_cProviderCombo.GetCurSel();
    if (index != CB_ERR)
    {
        CBugTraqProvider *provider = (CBugTraqProvider *)m_cProviderCombo.GetItemDataPtr(index);
        m_provider_clsid = provider->clsid;
    }

    CComPtr<IBugTraqProvider2> pProvider;
    HRESULT hr = pProvider.CoCreateInstance(m_provider_clsid);

    if (SUCCEEDED(hr))
    {
        BSTR temp = NULL;
        CString p;
        GetDlgItemText(IDC_BUGTRAQPARAMETERS, p);
        BSTR params = p.AllocSysString();
        if (SUCCEEDED(hr = pProvider->ShowOptionsDialog(GetSafeHwnd(), params, &temp)))
        {
            SetDlgItemText(IDC_BUGTRAQPARAMETERS, temp);
        }
        SysFreeString(temp);
    }
}
BSTR CHelloWorldCtrl::Show() 
{
	CString strResult;
	// TODO: Add your dispatch handler code here
	strResult="123456789";
	return strResult.AllocSysString();
}
//获取加密后的密码
BSTR COcxHxeditCtrl::GetDonePwd() 
{
	CString strResult = "";
	// TODO: Add your dispatch handler code here
	strResult = m_password;
//	SetText(_T("hllel"));

	return strResult.AllocSysString();
}
Example #8
0
void CEzShortcutDlg::OnDropFiles(HDROP hDropInfo)
{
	TCHAR szPathName[MAX_PATH];

	// 드롭된 파일의 갯수
	int nFiles=DragQueryFile(hDropInfo, 0xFFFFFFFF, szPathName, MAX_PATH);
	if( nFiles != 1)
	{
		AfxMessageBox(_T("This application is not support multi-file drag & drop"));
		return;
	}

	for(int index=0 ; index < nFiles ; index++)
	{
		DragQueryFile(hDropInfo, index, szPathName, MAX_PATH);     // 파일의 경로 얻어옴
		std::wstring strExt = light::get_file_ext(szPathName);

		if( strExt == _T("lnk" ))
		{
			IShellLink *link;
			IPersistFile *pfile;
			BSTR szLinkPath;
			CString szPrePath;
			TCHAR szBuffer[MAX_PATH];

			CString fname = szPathName;
			if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&link))) 
			{
				link->QueryInterface(IID_IPersistFile, (void **)&pfile);
				szLinkPath = fname.AllocSysString();
				pfile->Load(szLinkPath, STGM_READ);
				SysFreeString(szLinkPath);
				link->Resolve(NULL, NULL);
				link->GetPath(szBuffer, MAX_PATH, NULL, 0);

				// 리스트 박스나 메세지 박스로 해당 경로 값을 불러온다. (szBuffer)
				_tcsncpy_s(szPathName , szBuffer, _TRUNCATE);
				pfile->Release();
				link->Release();
			}
		}
		
		SHORTCUT_INFO ShortcutInfo(GetSafeHwnd());
		ShortcutInfo.m_strShortcutName = light::get_file_name_without_ext(szPathName);
		ShortcutInfo.m_strProgramPath = szPathName;
		if( true == OnEditShortcutDlg(ShortcutInfo) )
		{
			AddShortCutInfo(ShortcutInfo);
			RebuildShortcutList();
			AutoSave();
		}
	}

	DragFinish(hDropInfo);

	CDialog::OnDropFiles(hDropInfo);
}
Example #9
0
void CPropPannel::setSkinIndex(int sk)
{
	try
	{
		
		CString s;
		s.Format("%s\\%sdialog\\PropPanel_bk_mr.bmp",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());

		//CString s;
		//s.Format("%s\\%sdialog\\PropPanel_bk_mr.bmp",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());
		////	s.Format("%s\\image\\skin%d\\dialog\\dialog.bmp",CBcfFile::GetAppPath(true),m_skinIndex);
		//CGameImage bk;
		//CRect cRect;
		//GetWindowRect(&cRect);
		//bk.SetLoadInfo(s.GetBuffer(s.GetLength()),CGameImageLink::m_bAutoLock);
		//MoveWindow(cRect.left, cRect.top, bk.GetWidth(), bk.GetHeight(), TRUE);
		
		//*-------初始化 m_configDlg--------- 2012.10.17 yyf
		TCHAR pathConfig[MAX_PATH];
		TCHAR PathDefault[MAX_PATH];
	
		wsprintf(pathConfig,"%s%sdialog\\configDlg\\CPropPannelConfig\\configDlg.bcf",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());// 
		wsprintf(PathDefault,"%s%s",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());
		m_configDlg.LoadConfig(pathConfig,PathDefault);	

		int cx,cy; 
		cx=m_configDlg.GetDlgWide();
		cy=m_configDlg.GetDlgHigh(); 
	    SetWindowPos(NULL,0,0,cx,cy,SWP_NOMOVE|SWP_NOZORDER);
		//-----------------------------------------------------*/
#ifndef BZ_ZLIB
		imgDialog=Image::FromFile(s.AllocSysString());
#else
		CUnZipRes unZipRes;
		IStream * pStream=NULL;
		TCHAR * pchar=s.GetBuffer(s.GetLength()+1);
		pStream=unZipRes.LoadFileResFromZip(pchar);
		imgDialog=new Image(pStream);
#endif
		

		TCHAR path[MAX_PATH];

		wsprintf(path,"%s\\%sdialog\\log_exit_bt.bmp",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());//Rect_Close.bmp
		m_bnClose.LoadButtonBitmap(path,false);
	}
	catch (...)
	{
		TCHAR smsg[1000]={0};
		wsprintf(smsg,"PROP_PANNEL_TRY_CATCH : [%s]",__FUNCTION__);
		
	}
	// TODO:  在此添加额外的初始化


}
Example #10
0
BOOL CADOCommand::AddParameter(CString strName, int nType, int nDirection, long lSize, CString strValue)
{

	_variant_t vtValue;

	vtValue.vt = VT_BSTR;
	vtValue.bstrVal = strValue.AllocSysString();

	return AddParameter(strName, nType, nDirection, lSize, vtValue);
}
Example #11
0
STDMETHODIMP CCDDAReader::get_Title(BSTR* pbstrTitle)
{
    CheckPointer(pbstrTitle, E_POINTER);
    CString str = m_stream.m_trackTitle;
    if (str.IsEmpty()) {
        str = m_stream.m_discTitle;
    }
    *pbstrTitle = str.AllocSysString();
    return S_OK;
}
Example #12
0
STDMETHODIMP CCDDAReader::get_AuthorName(BSTR* pbstrAuthorName)
{
    CheckPointer(pbstrAuthorName, E_POINTER);
    CString str = m_stream.m_trackArtist;
    if (str.IsEmpty()) {
        str = m_stream.m_discArtist;
    }
    *pbstrAuthorName = str.AllocSysString();
    return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// COcxHxeditCtrl message handlers
//获取原始密码
BSTR COcxHxeditCtrl::GetPwdText() 
{
	CString strResult;
	// TODO: Add your dispatch handler code here
	strResult = m_password;
	EncryptPwdStr(strResult, false);
//	return GetText();
//	return m_password;

	return strResult.AllocSysString();
}
Example #14
0
// 写HTML到document
void CLog::WriteDocument(const CString& content)
{
	SAFEARRAY *arr = SafeArrayCreateVector(VT_VARIANT, 0, 1);
	VARIANT *str = NULL;
	if (FAILED(SafeArrayAccessData(arr, (LPVOID*)&str)))
		return;
	str->vt = VT_BSTR;
	str->bstrVal = content.AllocSysString();
	SafeArrayUnaccessData(arr);
	m_logDocument->write(arr);
	SafeArrayDestroy(arr);
}
Example #15
0
BOOL CXLAutomation::AddArgumentCString(LPOLESTR lpszArgName, WORD wFlags, CString szStr)
{
	BSTR b;
	
	b = szStr.AllocSysString();
	if (!b)
		return FALSE;
	AddArgumentCommon(lpszArgName, wFlags, VT_BSTR);
	m_aVargs[m_iArgCount++].bstrVal = b;
	
	return TRUE;
}
Example #16
0
STDMETHODIMP CWavPackSplitterFilter::ResGet(DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag)
{
	if (ppData) {
		CheckPointer(pDataLen, E_POINTER);
	}

	if (iIndex) {
		return E_INVALIDARG;
	}

	CheckPointer(m_pInputPin, E_NOTIMPL);

	if (m_pInputPin->m_Cover.IsEmpty()) {
		return E_NOTIMPL;
	}

	if (ppName) {
		*ppName = m_pInputPin->m_CoverFileName.AllocSysString();
	}
	if (ppDesc) {
		CString str = _T("cover");
		*ppDesc = str.AllocSysString();
	}
	if (ppMime) {
		CString str = m_pInputPin->m_CoverMime;
		*ppMime = str.AllocSysString();
	}
	if (ppData) {
		*pDataLen = (DWORD)m_pInputPin->m_Cover.GetCount();
		memcpy(*ppData = (BYTE*)CoTaskMemAlloc(*pDataLen), m_pInputPin->m_Cover.GetData(), *pDataLen);
	}
	if (pTag) {
		*pTag = 0;
	}

	return S_OK;
}
Example #17
0
/* 把当前工作的滤波器链表保存到*.grf */
void CVMR_Capture::SaveGraph(CString wFileName)
{
	HRESULT hr;

	{
		IStorage* pStorage=NULL;
		
		// First, create a document file that will hold the GRF file
		hr = ::StgCreateDocfile(wFileName.AllocSysString(), STGM_CREATE|STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_EXCLUSIVE,	0, &pStorage);
		if (FAILED(hr))
		{
			AfxMessageBox(TEXT("Can not create a document"));
			return;
		}

		// Next, create a stream to store.
		WCHAR wszStreamName[] = L"ActiveMovieGraph"; 
		IStream *pStream;

		hr = pStorage->CreateStream(wszStreamName,STGM_WRITE|STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &pStream);

		if(FAILED(hr))
		{
			AfxMessageBox(TEXT("Can not create a stream"));
			pStorage->Release();
			return;
		}

		// The IpersistStream::Save method converts a stream
		// into a persistent object.
		IPersistStream *pPersist = NULL;

		m_pGB->QueryInterface(IID_IPersistStream,  reinterpret_cast<void**>(&pPersist));
		hr = pPersist->Save(pStream, TRUE);
		pStream->Release();
		pPersist->Release();

		if(SUCCEEDED(hr))
		{
			hr = pStorage->Commit(STGC_DEFAULT);
			if (FAILED(hr))
			{
			AfxMessageBox(TEXT("can not store it"));
			}
		}
		pStorage->Release();
	}

}
CString C51JobWebPost::GetElementValue(CComPtr<IHTMLElement>   pElement)
{
	CString strRet = "";
	CString strName = "value";
	BSTR bstrText = strName.AllocSysString();
	VARIANT  varValue;
	pElement->getAttribute(bstrText,0,&varValue);
	if (varValue.vt == VT_BSTR)
	{
		strRet.Format ("%s",(const char*)(_bstr_t)(_variant_t)varValue);
	}
	strRet.MakeLower();
	::SysFreeString(bstrText);
	return strRet;
}
Example #19
0
STDMETHODIMP CLogFactory::Create(LONG FileType, 
								 BSTR AppName, 
								 BSTR Configue, 
								 BSTR Section, 
								 BSTR* LogName,
								 BSTR* XFile)
{
    //MessageBox(NULL, _T("CLogFactory::Create"), _T("CLogFactory::Create"), MB_OK);
	ATLASSERT(NULL != AppName);
	ATLASSERT(NULL != Configue);
	ATLASSERT(NULL != Section);
	if (NULL == AppName
		|| NULL == Configue
		|| NULL == Section
		|| NULL == LogName)
	{
		CString strError = _T("AppName(or Configue? Section? LogName?) is NULL. CLogFactory::Create return E_FAIL.");
		LOGGER_WRITE(strError.GetBuffer());
		LogEvent(strError);
		return E_FAIL;
	}

	CString strLogName;
	if (!CreateLogName(AppName, Configue, Section, FileType, strLogName))
		return E_FAIL;

	int iSerIndex = -1;
	if (!FindObject(strLogName, iSerIndex))
	{
		if (!CreateObject(strLogName, FileType, AppName, Configue, Section, iSerIndex))
			return E_FAIL;
	}

	ATLASSERT(-1 != iSerIndex);
	LOGSERVER &LogServer = m_sLogServer[iSerIndex];
	LogServer.oClientName.Add(CString(AppName));

	LONG Count = LockServer();
	LOGGER_WRITE(_T("增加客户端, 服务计数:") << Count);
	*LogName = strLogName.AllocSysString();

	TCHAR Buffer[MAX_PATH] = { 0 };
	GetModuleFileName(GetModuleHandle(NULL), Buffer, MAX_PATH - 1);
	CString ModuleFile(Buffer);
	*XFile = ModuleFile.AllocSysString();

	return S_OK;
}
void CReportTreeCtrl::OnLButtonDown(UINT nFlags, CPoint point)  {
UINT flags;
HTREEITEM node;
CString attributesFileName;
CString treeFileName;
char buf[1024];

	CTreeCtrl::OnLButtonDown(nFlags, point);
    node=HitTest(point,&flags);
	if(flags==TVHT_ONITEMLABEL) {
        // Register or get clipboard format for the task flow node
	    UINT formatID=RegisterClipboardFormat("DiscoverReportNode");
        if(GetEnvironmentVariable("PSETHOME",buf,1024)!=0) {
            treeFileName=buf;
            treeFileName+="\\Reports\\Templates\\";
		} else {
            treeFileName="C:\\Discover\\Reports\\Templates\\";
		}
		attributesFileName=treeFileName;
		treeFileName+="__tmp__.xxx";
		attributesFileName+="__tmp__.atr";
		((CReportTemplateCtrl *)m_Parent)->MakeSubTreeFile(node,treeFileName);
        STGMEDIUM dataStruct;
		dataStruct.tymed=TYMED_FILE;

		HGLOBAL dataID= GlobalAlloc(GMEM_FIXED,(treeFileName.GetLength()+1)*sizeof(short));
	    dataStruct.lpszFileName = (BSTR)::GlobalLock(dataID);
		BSTR sysString;
		sysString = treeFileName.AllocSysString();
        memmove(dataStruct.lpszFileName,sysString,treeFileName.GetLength()*sizeof(short));
		SysFreeString(sysString);
	    GlobalUnlock(dataID);

		dataStruct.pUnkForRelease=NULL;
		CRect dragRect;
		GetItemRect(node,&dragRect,FALSE);
        m_DropSource.CacheData(formatID, &dataStruct);
		((CReportTemplateCtrl *)m_Parent)->MakeAttributesFile(node,attributesFileName);
		if(m_DropSource.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_MOVE,&dragRect)==DROPEFFECT_MOVE) {
		      ((CReportTemplateCtrl *)m_Parent)->DeleteItem(node);
		}
		m_DropSource.Empty();
		DeleteFile(treeFileName); 
		DeleteFile(attributesFileName);
	}

}
Example #21
0
BOOL CADORecordset::SetFieldValue(LPCTSTR lpFieldName, CString strValue)
{
	_variant_t vtFld;

	if(!strValue.IsEmpty())
		vtFld.vt = VT_BSTR;
	else
		vtFld.vt = VT_NULL;

	//Corrected by Giles Forster 10/03/2001
	vtFld.bstrVal = strValue.AllocSysString();

	BOOL bret =  PutFieldValue(lpFieldName, vtFld);
	//Corrected by Flemming27 at CodeProject.com
	SysFreeString(vtFld.bstrVal);
	return bret;
}
Example #22
0
BOOL CADOCommand::AddParameter(CString strName, int nType, int nDirection, long lSize, _variant_t vtValue, int nPrecision, int nScale)
{
	try
	{
		_ParameterPtr pParam = m_pCommand->CreateParameter(strName.AllocSysString(), (DataTypeEnum)nType, (ParameterDirectionEnum)nDirection, lSize, vtValue);
		pParam->PutPrecision(nPrecision);
		pParam->PutNumericScale(nScale);
		m_pCommand->Parameters->Append(pParam);
		
		return TRUE;
	}
	catch(_com_error& e)
	{
		dump_com_error(e);
		return FALSE;
	}
}
Example #23
0
HINSTANCE CDllCenter::LoadDllLibrary(CString strDllPath)
{
	LPCWSTR lpwText = strDllPath.AllocSysString();

	HINSTANCE handler = LoadLibrary(lpwText);
	if (handler == NULL)
	{
		CString strError, strText;
		strText.LoadString(IDS_LOAD_DLL_FAIL);
		strError.Format(strText, strDllPath);

		Utility::ShowMessageBox(m_pParent->GetSafeHwnd(), strError, MB_OK);

		return NULL;
	}

	return handler;
}
Example #24
0
DISPID CSaxModule::GetDispId(LPCTSTR pszMemberName) const
{
	if (m_lpDispatch == NULL)
	{
		TRACE0("Warning: attempt to call Invoke with NULL m_lpDispatch!\n");
		return DISPID_UNKNOWN;
	}

	DISPID dispidMember = DISPID_UNKNOWN;
	CString sMember = pszMemberName;
	BSTR bstrMember = sMember.AllocSysString();
	HRESULT hr = m_lpDispatch->GetIDsOfNames(IID_NULL,&bstrMember,1,
											 LOCALE_USER_DEFAULT,&dispidMember);
	SysFreeString(bstrMember);
	if (FAILED(hr))
		return DISPID_UNKNOWN;

	return dispidMember;
}
Example #25
0
/*
	Function name	: CXML::GoToNode
	Description	    : Moves to the node having the specified text
	Return type		: bool 
	Argument        : CString csPathToNode
	Argument        : CString csNodeText
	Argument        : bool bCurrentNodeAsBase
	Tested			: Not working
*/
bool CXML::GoToNodeEx(CString csPathToNode,CString csNodeText,bool bCurrentNodeAsBase)
{
	CString csPath;
	IXMLDOMNode *pBaseNode = NULL;
	
	if(bCurrentNodeAsBase)
	{
		if(!m_pICurrentNode) return false;

		pBaseNode = m_pICurrentNode;
		pBaseNode->AddRef();
		csPath.Format("./%s[.= \"%s\"]",csPathToNode,csNodeText);
	}
	else
	{
		if(!m_pIRootNode) return false;
		pBaseNode = m_pIRootNode;
		pBaseNode->AddRef();
		csPath.Format("/%s[.= \"%s\"]",csPathToNode,csNodeText);
	}

	BSTR bstrPath = csPath.AllocSysString();

	IXMLDOMNode * pNode = NULL;
	m_hr = pBaseNode->selectSingleNode(bstrPath,&pNode);
	pBaseNode->Release();
	SysFreeString(bstrPath);

	if(!SUCCEEDED(m_hr) || !pNode)
		return false;


	if(m_pICurrentNode)
	{
		m_pICurrentNode->Release();
		m_pICurrentNode = NULL;
	}
	m_pICurrentNode = pNode;
	m_pICurrentNode->AddRef();
	pNode->Release();	
	return true;
}
Example #26
0
bool AddSupportPath( const CString& arxPath )
{
    AutoCAD::IAcadPreferences* pPrefer;
    AutoCAD::IAcadPreferencesFiles* pPreferFiles;
    HRESULT hr = NOERROR;

    bool ret = true;
    TRY
    {
        LPDISPATCH pAcadDisp = acedGetAcadWinApp()->GetIDispatch( TRUE );
        AutoCAD::IAcadApplication* pAcad = NULL;
        if ( SUCCEEDED( pAcadDisp->QueryInterface( AutoCAD::IID_IAcadApplication, ( void** )&pAcad ) ) )
        {
            BSTR supportPath;
            hr = pAcad->get_Preferences( &pPrefer );
            pAcad->Release();

            hr = pPrefer->get_Files( &pPreferFiles );
            pPrefer->Release();

            hr = pPreferFiles->get_SupportPath( &supportPath );
            CString stemp = supportPath;
            if( !IsPathExit( stemp, arxPath ) )
            {
                stemp = stemp + _T( ";" ) + arxPath;
                supportPath = stemp.AllocSysString();
                pPreferFiles->put_SupportPath( supportPath );
            }
            SysFreeString( supportPath ); // 用完释放
        }
        pPreferFiles->Release();
    }
    CATCH( COleDispatchException, e )
    {
        //e->ReportError(); // 调试用
        e->Delete();
        ret = false;
    }
BSTR CMUSHclientDoc::WindowMenu(LPCTSTR Name, long Left, long Top, LPCTSTR Items) 
{

  CString strResult;

  MiniWindowMapIterator it = m_MiniWindows.find (Name);

	CView* pView = NULL;
  
  for(POSITION pos = GetFirstViewPosition(); pos != NULL; )
	  {
	  pView = GetNextView(pos);

	  if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
      break;

    }

  if (pView && it != m_MiniWindows.end ())
    strResult = it->second->Menu (Left, Top, Items, (CMUSHView *) pView);

	return strResult.AllocSysString();

}   // end of CMUSHclientDoc::WindowMenu
Example #28
0
CString CIVConnection::Login()
{
	
	CString strQuery;
	CString strURL;
	if(-1 == m_opts.m_strURL.Find(_T("http")))
	{
		strURL  = _T("http://");
		strURL += m_opts.m_strURL;
	}
	else
		strURL = m_opts.m_strURL;

	strQuery.Format (_T("%s/auth.asp?name=%s"), (LPCTSTR) strURL, (LPCTSTR) m_opts.m_strAccount);
	
	CString strResult;
	if(!m_opts.m_strAccount.GetLength())
	{
		CString strError;
		AfxFormatString1 (strError, ERR_IDS_IV_CANNOT_LOGIN, _T(""));
		SetError (strError);
		
		AfxThrowUserException();

	}

	GetHTTPData(strQuery, strResult);

	if (strResult.IsEmpty() || strResult.GetLength()<6 || *(LPCSTR)strResult < '0' || *(LPCSTR)strResult >'9')
	{
		CString strError;
		AfxFormatString1 (strError, ERR_IDS_IV_CANNOT_LOGIN, m_opts.m_strAccount);
		SetError (strError);
		
		AfxThrowUserException();
	}
	
	if (m_spIMD5 == NULL)
	{
		HRESULT hr = m_spIMD5.CreateInstance (__uuidof(IC::MD5));
		if (FAILED (hr))
		{
			SetError (ERR_IDS_IV_MD5);
			AfxThrowUserException();
		}
	}		
	

	CString strSID;
	try
	{
		CString strInput  = strResult;
		strInput += m_opts.m_strPassword;

		BSTR bstrInput = strInput.AllocSysString();
		_bstr_t bstrTemp (bstrInput, false);

		strSID = (BSTR)  m_spIMD5->GetMDString (&bstrInput);
	}
	catch (_com_error & )
	{
		CString strErr ( (LPCSTR) ERR_IDS_UNEXPECTED   ) ;
		AfxThrowUserException();
	}


	return strSID;
}
Example #29
0
/*******************************************************************************
  Function Name  : vInitGraphControl
  Input(s)       : -
  Output         : -
  Functionality  : This function will initialise graph control. This will set
                   viewstyle parameters of the graph control
  Member of      : CGraphBottomView
  Author(s)      : Raja N
  Date Created   : 10/12/2004
  Modifications  :
*******************************************************************************/
void CGraphBottomView::vInitGraphControl()
{
    CGraphList* podList = NULL;
    CGraphChildFrame* pParentWnd = NULL;
    pParentWnd = (CGraphChildFrame*)pomGetParentWindow();

    if(pParentWnd != NULL)
    {
        podList = pParentWnd->pGetSignalListDetails();
    }
    else
    {
        return;
    }

    if( podList != NULL )
    {
        CGraphParameters* pEnv = &podList->m_odGraphParameters;
        if( pEnv != NULL )
        {
            // Init Active Axis
            m_nAxis = pEnv->m_nActiveAxis;
            // Init Active Action
            m_nAction = pEnv->m_nAction;
            // Set Show Grid Action
            vSetShowButtonState( pEnv->m_bShowGrid );
            // Set Graph Params
            if( m_pDMGraphCtrl != NULL )
            {
                // Set Axis Color
                m_pDMGraphCtrl->put_AxisColor((OLE_COLOR)pEnv->m_nAxisColor);
                // Set Plot Area Color
                m_pDMGraphCtrl->put_PlotAreaColor((OLE_COLOR)pEnv->m_nPlotAreaColor);
                // Set Grid Color
                m_pDMGraphCtrl->put_GridColor((OLE_COLOR)pEnv->m_nGridColor);
                // Set Frame Style
                m_pDMGraphCtrl->put_FrameStyle((FrameStyle)pEnv->m_nFrameStyle);
                // Set Frame Color
                m_pDMGraphCtrl->put_ControlFrameColor((OLE_COLOR)pEnv->m_nFrameColor);
                // Set Grid Lines Count
                CComPtr<IDMGraphAxis> spAxisX;
                m_pDMGraphCtrl->get_Axis( HorizontalX, &spAxisX);
                spAxisX->put_GridNumber((short)pEnv->m_nXGridLines);

                CComPtr<IDMGraphAxis> spAxisY;
                m_pDMGraphCtrl->get_Axis( VerticalY, &spAxisY);
                spAxisY->put_GridNumber((short)pEnv->m_nYGridLines);
                // Set Show Grid
                spAxisX->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE);
                spAxisY->put_ShowGrid(pEnv->m_bShowGrid ? VARIANT_TRUE : VARIANT_FALSE);
                // Set Format String
                spAxisX->put_Format( CComBSTR(defSTR_X_AXIS_FORMAT) );
                spAxisY->put_Format( CComBSTR(defSTR_Y_AXIS_FORMAT) );

                /* Set default RANGE */
                m_pDMGraphCtrl->SetRange(   defDEFAULT_XRANGE_MIN, defDEFAULT_XRANGE_MAX,
                                            defDEFAULT_YRANGE_MIN, defDEFAULT_YRANGE_MAX    );

                //Set the caption
                CString CStringCaption = _("Signal Graph - CAN");
                //BSTR bstrCaption(L"Graph Display - CAN");
                //m_pDMGraphCtrl->put_Caption(bstrCaption);
                m_pDMGraphCtrl->put_Caption(CStringCaption.AllocSysString());
            }
            // Update Local DDX Variables
            UpdateData( FALSE );
            // Update Axis and action
            vSetAction();
        }
    }
}
Example #30
0
BOOL CraftView::OnInitDialog() 
{
	CTabPageSSL::OnInitDialog();
	
	UpdateData(false);

	COleSafeArray saRet;
	
	SAFEARRAYBOUND sab[2];
	CString csTemp;
	long index[2] = {0,0}; //a 2D graph needs a 2D array as index array
	BSTR bstr;
	index[0]=1;
	int x=1, max_x =0, i;
	

	for( i = 0; i < MAX_CRAFT; i++)
	{
		if(GetLoadedObjCount() == 0)
			break;

		if(GetObjCraftCount(i) > 0)
			max_x++;
	}
	m_ChartControl.SetRowCount(1);
	m_ChartControl.SetShowLegend(TRUE);
	//m_ChartControl.SetAllowSelections(false);

	sab[0].cElements =1;
	sab[1].cElements = max_x+1;//number of columns + 1 (because the first column is where we put 

	sab[0].lLbound = sab[1].lLbound = 1;	
	
	saRet.Create(VT_BSTR, 2, sab);
	
	m_ChartControl.SetColumnCount(max_x);
	m_ChartControl.SetColumnLabelCount(max_x);
	
	index[1]=1;
	csTemp = "Craftsmanship";
	bstr = csTemp.AllocSysString(); // Row label
	saRet.PutElement(index, bstr);

	for(i = 0; i < MAX_CRAFT; i++)
	{
		if(GetLoadedObjCount() == 0)
			break;

		if(GetObjCraftCount(i) > 0)
		{
			x++;
			index[1]=x;
			csTemp.Format("%f", GetObjCraftPercent(i));
			bstr = csTemp.AllocSysString();
			saRet.PutElement(index, bstr);
			::SysFreeString(bstr);
		}
	}
	
	if(GetLoadedObjCount() >  0)
		m_ChartControl.SetChartData(saRet.Detach());
	
	x = 1;
	for(i = 0; i< MAX_CRAFT; i++)
	{
		if(GetLoadedObjCount() == 0)
			break;
		if(GetObjCraftCount(i) > 0)
		{
			m_ChartControl.SetColumn(x);
			m_ChartControl.SetColumnLabel(craftsmanship[i]);
			x++;
		}
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}