Example #1
0
	void OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl) {
		CString str;

		str = _T("<b>Internal:</b><br>");
		for (int i = 0; i < 0x14; ++i) {
			if ((i & 3) == 0)
				str.AppendFormat(_T("<tt>$%X: </tt>"), i + 0x4000);
			
			str.Append(_T("<tt style=\"color:green\">"));
			str.AppendFormat(_T("$%02X "), m_pInternalRegs->R_2A03[i]);
			str.Append(_T("</tt>"));

			str.Append((i & 3) == 3 ? _T("<br>") : _T(""));
		}
		if (m_iChip & SNDCHIP_VRC6) {
			str.Append(_T("<br>"));
			for (int i = 0; i < 9; ++i) {
				if ((i % 3) == 0)
					str.AppendFormat(_T("<tt>$%X: </tt>"), (i / 3) * 0x1000 + 0x9000);
				str.Append(_T("<tt style=\"color:green\">"));
				str.AppendFormat(_T("$%02X "), m_pInternalRegs->R_VRC6[i]);
				str.Append(_T("</tt>"));

				str.Append((i % 3) == 2 ? _T("<br>") : _T(""));
			}
		}

		SetElementHtml(_T("resultInternal"), str.AllocSysString());

		str = _T("<b>Exported:</b><br>");
		for (int i = 0; i < 0x14; ++i) {
			if ((i & 3) == 0)
				str.AppendFormat(_T("<tt>$%X: </tt>"), i + 0x4000);

			str.AppendFormat(_T("<tt style=\"color:%s\">"), (m_pExternalRegs->R_2A03[i] == m_pInternalRegs->R_2A03[i]) ? _T("green") : _T("red"));
			str.AppendFormat("$%02X ", m_pExternalRegs->R_2A03[i]);
			str.Append(_T("</tt>"));

			str.AppendFormat((i & 3) == 3 ? _T("<br>") : _T(""));
		}
		if (m_iChip & SNDCHIP_VRC6) {
			str.Append(_T("<br>"));
			for (int i = 0; i < 9; ++i) {
				if ((i % 3) == 0)
					str.AppendFormat(_T("<tt>$%X: </tt>"), (i / 3) * 0x1000 + 0x9000);

				str.AppendFormat(_T("<tt style=\"color:%s\">"), (m_pExternalRegs->R_VRC6[i] == m_pInternalRegs->R_VRC6[i]) ? _T("green") : _T("red"));
				str.AppendFormat(_T("$%02X "), m_pExternalRegs->R_VRC6[i]);
				str.Append(_T("</tt>"));

				str.Append((i % 3) == 2 ? _T("<br>") : _T(""));
			}
		}

		SetElementHtml(_T("resultExternal"), str.AllocSysString());

		str.Format(_T("APU frames since last row: %i<br><br>"), m_iUpdateFrames);
		str.AppendFormat(_T("File size: %i kB"), m_iFileSize / 1024);
		SetElementHtml(_T("other"), str.AllocSysString());
	}
Example #2
0
//----------------------------------------------------------------------------
//  GetMemberName
HRESULT CDispExIdManager::GetMemberName(
  DISPID  id,
  BSTR  * pbstrName)
{
  ENSURE_RETVAL(pbstrName);
  CString sName;
#ifdef CDispExIdManager_USE_REVERSELOOKUPMAP
  if (m_Names.Lookup(id, sName))
  {
    (*pbstrName) = sName.AllocSysString();
    return S_OK;
  }
#else
  DISPID dispid;

  POSITION pos = m_IDs.GetStartPosition();
  while(pos)
  {
    m_IDs.GetNextAssoc(pos, sName, dispid);
    if (dispid == id)
    {
      (*pbstrName) = sName.AllocSysString();
      return S_OK;
    }
  }
#endif
  return DISP_E_UNKNOWNNAME;
}
void CLryEDBQryView::SingleReport(CReportSele *pDlg)
{
	_variant_t str;
	int nItemIndex;
	CLryEDBQryDoc* pDoc = GetDocument();
	if(( nItemIndex=GetListCtrl().GetNextItem(-1,LVNI_SELECTED))!=-1)
	{
		pDoc->Rs->Move(nItemIndex,(long)adBookmarkFirst);
		str = pDoc->Rs->GetCollect(_bstr_t("试验编号")); 		 
		CString	strSQL;
		strSQL.Format(_T("select * from 热容量 where  试验编号='%s'"),VariantToStr(str)); 		
		try
		{ 
			
			HRESULT hr; 
			
			if(pDoc->RsPrintData->State==adStateOpen)
				pDoc->RsPrintData->Close();			
			hr = pDoc->RsPrintData->Open(strSQL.AllocSysString(),
				theApp.pConn.GetInterfacePtr(),
				adOpenStatic,
				adLockOptimistic,
				-1);
			TESTHR(hr); 
			
			if(pDoc->RsTitle->State==adStateOpen)
				pDoc->RsTitle->Close();
			strSQL = _T("select * from 系统参数");
			hr = GetDocument()->RsTitle->Open(strSQL.AllocSysString(),
				theApp.pConn.GetInterfacePtr(),
				adOpenStatic,
				adLockOptimistic,
				-1);
			TESTHR(hr); 
			
			pReportdlg.Init(0);
			pReportdlg.SetModifyPrepared(TRUE);	
			LPCTSTR dbName2 = _T("CopyHeat");
			pReportdlg.AddAdoDataSet(dbName2,((CLryEDBQryDoc*)GetDocument())->RsTitle);
			pReportdlg.SetModifyPrepared(TRUE);
			LPCTSTR dbName1  = _T("SReportHeat");
			pReportdlg.AddAdoDataSet(dbName1,((CLryEDBQryDoc*)GetDocument())->RsPrintData);
			//nItemIndex = pDoc->RsPrintData->GetRecordCount();	
			//pDoc->RsPrintData->MoveFirst();
			CString File(pDlg->cPath);
			File+=_T("reports\\")+pDlg->cFile;
			LPCTSTR path = File.GetBuffer(File.GetLength());
			pReportdlg.SetReportFile(path);
			File.ReleaseBuffer();
			if(pDlg->m_iSelect==0)
				pReportdlg.ShowReport();       //设计报表 
			else
				pReportdlg.DesignReport();		// 预览报表 
		}
		catch(_com_error &e)
		{ 
			dump_com_error(e);
		} 
	}	
}
//****************************************************************************
HRESULT CBCGPToolBoxPage::get_accName(VARIANT varChild, BSTR *pszName)
{
	if (varChild.vt == VT_I4)
	{
		if (varChild.lVal == CHILDID_SELF)
		{
			CString strText = _T("Toolbox Page");

			if (GetSafeHwnd() != NULL)
			{
				GetWindowText(strText);
			}

			*pszName = strText.AllocSysString();
			return S_OK;
		}
		else
		{
			CBCGPToolBoxButton* pButton = GetAccChild(varChild.lVal);
			if (pButton != NULL)
			{
				CString strName = pButton->m_strLabel;
				*pszName = strName.AllocSysString();

				return S_OK;
			}
		}
	}

	return S_FALSE;
}
Example #5
0
/**
* OnLoadDir
*
* Description: 
*/
LRESULT CMainFrame::OnLoadDir(WPARAM wParam, LPARAM lParam)
{
	CConnectionListView * connectionView = (CConnectionListView *)m_mainSplitter.GetPane(0,0);
	CFileListView * fileListView = (CFileListView *)m_mainSplitter.GetPane(0,1);

	CString * dirArg = (CString*)lParam;
	if(dirArg){
		TRACE1(" Load dir: %s \n", dirArg->AllocSysString());
		CString dir(dirArg->AllocSysString());

		// Load file list view
		//fileListView->LoadServerConnection(connection_id);
		fileListView->LoadDirectory(dir);

		// Load url in header history.
		if(m_headerDoc && ((int)wParam) == 1){
			m_headerDoc.SetUrl( CString( fileListView->m_connection->host + dir) );
			//m_headerDoc.SetConnectionID(connection_id); 
			m_headerDoc.m_path = CString(dir);          // This needs work
			CFileListView * v = (CFileListView *)m_mainSplitter.GetPane(0,1);
			m_headerDoc.m_path = CString(v->GetPath());
		}

		// Cleanup
		delete dirArg;
	}
	return 1;
}
Example #6
0
CHttpRequest::CHttpRequest(const CString& url)
: m_pIXMLHttpRequest(NULL)
, m_state(HTTP_CLOSED)
{
    HRESULT hr;
    //hr = CoInitialize(NULL); 

    // Create XMLHttpRequest object and initialize m_pIXMLHttpRequest.
    hr = CoCreateInstance(CLSID_XMLHTTPRequest, NULL, CLSCTX_INPROC, 
        IID_IXMLHttpRequest, (void **)&m_pIXMLHttpRequest);

    if(FAILED(hr))
        return;

    VARIANT vAsync;
    vAsync.vt = VT_BOOL;
    vAsync.boolVal = VARIANT_TRUE;

    VARIANT vUser;
    vUser.vt = VT_BSTR;
    vUser.bstrVal = NULL;

    VARIANT vPassword;
    vPassword.vt = VT_BSTR;
    vPassword.bstrVal = NULL;

    BSTR str = url.AllocSysString();
    hr = m_pIXMLHttpRequest->open(_T("POST"), str, vAsync, vUser, vPassword);
    ASSERT(hr == S_OK);
}
BOOL CWizardBasedProjectTemplateItem::InitItem(LPCTSTR lpszPath, CImageList &ImageList32, CImageList &ImageList16)
{
	m_strPath = lpszPath;

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// retrieve the wizard interface
	CString strProgId;
	strProgId.Format(_T("%s.ProjectWizard"), CPathTool::GetFileTitle(m_strPath));

	BSTR bstrProgId = strProgId.AllocSysString();
	HRESULT result = m_wizard.CoCreateInstance(bstrProgId, NULL, CLSCTX_INPROC_SERVER);

	if (result != S_OK)
		return FALSE;

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// get the icon
	HICON hIcon = NULL;

	int nIconIndex = m_wizard.GetIconIndex();
	if (nIconIndex >= 0)
		hIcon = ExtractIcon(AfxGetInstanceHandle(), m_strPath, nIconIndex);
	if (!hIcon)
		hIcon = theApp.LoadIcon(IDR_LATEXWIZARD);

	m_nImageIndex = ImageList32.Add(hIcon);
	ImageList16.Add(hIcon);

	return TRUE;
}
Example #8
0
HRESULT GetElementById(IHTMLDocument2 *pDoc, CString szId, IHTMLElement** pElem)
{
    *pElem = NULL;
    HRESULT hr = S_OK;

    BSTR bstrID = szId.AllocSysString();
    VARIANT varName, varIndex;
    varName.vt = VT_BSTR;
    varName.bstrVal = bstrID;
    varIndex.vt = VT_I4;
    varIndex.intVal = 0;        

    IHTMLElementCollection *pColl;
    hr = pDoc->get_all(&pColl);

    if (hr == S_OK && pColl)
    {
        IDispatch* pDisp;
        hr = pColl->item(varName, varIndex, &pDisp);
        if (hr == S_OK && pDisp)
        {
            hr = pDisp->QueryInterface(IID_IHTMLElement, (void**)pElem);
        }
    }
    
    ::SysFreeString(bstrID);

    return hr;
}
Example #9
0
void CPictureProperty::SetPictureHight(CString pictureHight)
{
	CMFCPropertyGridProperty* this1=this->GetSubItem(1);
	COleVariant oleVar=this1->GetValue();
	oleVar.bstrVal=pictureHight.AllocSysString();
	this1->SetValue(oleVar);
}
Example #10
0
void CCmdTarget::GetStandardProp(const AFX_DISPMAP_ENTRY* pEntry,
	VARIANT* pvarResult, UINT* puArgErr)
{
	ASSERT(pEntry != NULL);
	ASSERT(*puArgErr != 0);

	// it is a DISPATCH_PROPERTYGET (for standard, non-function property)
	void* pProp = (BYTE*)this + pEntry->nPropOffset;
	if (pEntry->vt != VT_VARIANT)
		pvarResult->vt = pEntry->vt;
	switch (pEntry->vt)
	{
	case VT_I1:
		pvarResult->bVal = *(BYTE*)pProp;
		break;
	case VT_I2:
		pvarResult->iVal = *(short*)pProp;
		break;
	case VT_I4:
		pvarResult->lVal = *(long*)pProp;
		break;
	case VT_R4:
		pvarResult->fltVal = *(float*)pProp;
		break;
	case VT_R8:
		pvarResult->dblVal = *(double*)pProp;
		break;
	case VT_DATE:
		pvarResult->date = *(double*)pProp;
		break;
	case VT_CY:
		pvarResult->cyVal = *(CY*)pProp;
		break;
	case VT_BSTR:
		{
			CString* pString = (CString*)pProp;
			pvarResult->bstrVal = pString->AllocSysString();
		}
		break;
	case VT_ERROR:
		pvarResult->scode = *(SCODE*)pProp;
		break;
	case VT_BOOL:
		V_BOOL(pvarResult) = (VARIANT_BOOL)(*(BOOL*)pProp != 0 ? -1 : 0);
		break;
	case VT_VARIANT:
		if (VariantCopy(pvarResult, (LPVARIANT)pProp) != S_OK)
			*puArgErr = 0;
		break;
	case VT_DISPATCH:
	case VT_UNKNOWN:
		pvarResult->punkVal = *(LPDISPATCH*)pProp;
		if (pvarResult->punkVal != NULL)
			pvarResult->punkVal->AddRef();
		break;

	default:
		*puArgErr = 0;
	}
}
Example #11
0
BSTR CMUSHclientDoc::GetRecentLines(long Count) 
{
	CString strResult;

  // assemble multi-line match text
  int iPos = m_sRecentLines.size () - Count;
  if (iPos < 0)
    iPos = 0;

  string s;

  for (int iCount = 0; 
        iCount < Count &&
        iPos != m_sRecentLines.size ()
        ; iPos++, iCount++
      )
    {
    if (!s.empty ())
      s += '\n';
    s += m_sRecentLines [iPos];
    } // end of assembling text
  strResult = s.c_str ();

	return strResult.AllocSysString();
}  // end of CMUSHclientDoc::GetRecentLines
Example #12
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 #13
0
    HRESULT StackFrame::GetFunctionName( 
        FRAMEINFO_FLAGS flags, 
        UINT radix, 
        BSTR* funcName )
    {
        _ASSERT( funcName != NULL );
        HRESULT hr = S_OK;
        CString fullName;

        if ( (flags & FIF_FUNCNAME_MODULE) != 0 )
        {
            if ( mModule != NULL )
            {
                CComBSTR modNameBstr;
                mModule->GetName( modNameBstr );
                fullName.Append( modNameBstr );
                fullName.AppendChar( L'!' );
            }
        }

        hr = AppendFunctionNameWithSymbols( flags, radix, fullName );
        if ( FAILED( hr ) )
        {
            hr = AppendFunctionNameWithAddress( flags, radix, fullName );
            if ( FAILED( hr ) )
                return hr;
        }

        *funcName = fullName.AllocSysString();

        return hr;
    }
Example #14
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 );
}
HRESULT	  ColumnProvider::FBInfo::GetVariant(const CString& str,VARIANT *vt) {
  if (V_BSTR(vt)=str.AllocSysString()) {
    V_VT(vt)=VT_BSTR;
    return S_OK;
  }
  return E_OUTOFMEMORY;
}
Example #16
0
bool XmlIOStreamImp::WriteNodeAttribute(const CString& attrName, const CString& attrValue)
{
	DATA_ASSERT(!mbIsRead);
	if(mbIsRead)
		return false; // Can't write to the read stream.

	DATA_ASSERT(mpCurrentNode != NULL);
	if(NULL == mpCurrentNode)
		return false;

	MSXML2::IXMLDOMDocumentPtr xmlDocument = mpCurrentNode->GetownerDocument();
	if (xmlDocument)
	{
		// Create attribute node
		MSXML2::IXMLDOMAttributePtr attr = xmlDocument->createAttribute((LPCTSTR)attrName);

		VARIANT va;
		va.vt=VT_BSTR;
		va.bstrVal = attrValue.AllocSysString();
		attr->put_value(va);

		mpCurrentNode->attributes->setNamedItem(attr);

		VariantClear(&va);

		return true;
	}

	return false;
}
VARIANT CMUSHclientApp::GetGlobalOption(LPCTSTR Name) 
{
	VARIANT vaResult;
	VariantInit(&vaResult);

  int i;

  for (i = 0; GlobalOptionsTable [i].pName; i++)
    {
    if (_stricmp (Name, GlobalOptionsTable [i].pName) == 0)
      {
      const char * p = (const char *) this +  GlobalOptionsTable [i].iOffset;
      const int Value = * (const long *) p;
      vaResult.vt = VT_I4;
      vaResult.lVal = Value; 
  	  return vaResult;
      }

    };

  for (i = 0; AlphaGlobalOptionsTable [i].pName; i++)
    {
    if (_stricmp (Name, AlphaGlobalOptionsTable [i].pName) == 0)
      {
      const char * p = (const char *) this +  AlphaGlobalOptionsTable [i].iOffset;
      CString strValue = * (CString *) p;
      vaResult.vt = VT_BSTR;
      vaResult.bstrVal = strValue.AllocSysString (); 
  	  return vaResult;
      }
    };

	return vaResult;   // not found (empty)
}
Example #18
0
// CJs2nCtrl message handlers
BSTR CJs2nCtrl::Send(LPCTSTR szCommand) 
{
	string strCmd		= szCommand;
	string strResult	= m_NativeLogic.InvokeFunction( strCmd );
	CString strRet		= strResult.c_str();
	return strRet.AllocSysString();
}
Example #19
0
DISPID CScriptEngine::GetDispid (const CString & strName)
    {

 // Do Lua differently
  if (L)
    return GetLuaDispid (strName);

  if (!m_pDispatch)
    return DISPID_UNKNOWN;   // no script engine

BSTR bstrProcedure;
HRESULT hr;
DISPID dispid;

  bstrProcedure = strName.AllocSysString ();

// LCID en_us = MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);

  hr = m_pDispatch->GetIDsOfNames (IID_NULL, &bstrProcedure, 1, LOCALE_SYSTEM_DEFAULT, &dispid);    // was LCID of 9
  
  ::SysFreeString (bstrProcedure);

  if (hr != S_OK)
     return DISPID_UNKNOWN;

  return dispid;     // might be zero, the way PHP currently is :)

  } // end of CScriptEngine::GetDispid
CScriptErrHandler::CScriptErrHandler(void)
{
	CString strJavaScriptCode = TEXT("function fnOnError(msg,url,lineno){alert('script error:\\n\\nURL:'+url")
		TEXT("+'\\n\\nMSG:'+msg +'\\n\\nLine:'+lineno+'\\n\\nframes:' + window.frames.length);return true;}window.onerror=fnOnError;");
	//屏蔽的脚本,可以改进为从文本里读取
	m_bstrScript = strJavaScriptCode.AllocSysString();
}
Example #21
0
_variant_t strtovar(CString value)
{
	_variant_t vt;
	vt.vt = value.IsEmpty() ? VT_NULL : VT_BSTR;
	vt.bstrVal = value.AllocSysString();
	return vt;
}
bool CEOSSCreateAccessDatabase::CreateDaysTable ()
{
	bool bSuccess = false;
	//Create First table
	m_pTable.CreateInstance(__uuidof (ADOX::Table));

	if (m_pTable !=NULL && m_pCatalog !=NULL)
	{
		CString datatable = "DaysDataTable";
		m_pTable->PutName(datatable.AllocSysString ());
		m_pTable->Columns->Append("Reader_ID",ADOX::adInteger,16);
		m_pTable->Columns->Append("DayStartTimestamp",ADOX::adDate,16);
		m_pTable->Columns->Append("DataStartTimestamp",ADOX::adDate,16);
		m_pTable->Columns->Append("DataEndTimestamp",ADOX::adDate,1);
		m_pTable->Columns->Append("NumberDataPoints",ADOX::adInteger,16);
		m_pCatalog->Tables->Append(_variant_t((IDispatch *)m_pTable));
		bSuccess = true;	
		// Now create a primary key and don't allow dups
		m_pCatalog->Tables->Refresh ();
		
		m_pTable  = NULL;		//Reset pointer so as to use again
	}
	else
	{
		bSuccess = false;
	}
	return bSuccess;
}
Example #23
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 #24
0
// 해당 URL을 이용해 웹 브라우저를 연다.
bool CCopyProperties::OpenNewWindow(LPCTSTR pAddress)
{
	IWebBrowser2 *pWebBrowser;
	HRESULT hr;

	// 웹브라우저 객체를 생성한다.
	hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (void**)&pWebBrowser);
	if(FAILED(hr) || pWebBrowser == NULL)	return FALSE;

	CString strAddress = pAddress;

	// Navigate()에 필요한 인자들을 초기화한다
	VARIANT vtFlags, vtTarget, vtPostData, vtHeader;
	::VariantInit(&vtFlags);
	::VariantInit(&vtTarget);
	::VariantInit(&vtPostData);
	::VariantInit(&vtHeader);

	// 웹브라우저를 화면에 보이게 한다
	pWebBrowser->put_Visible(VARIANT_TRUE);
	// 사이트를 연다
	hr = pWebBrowser->Navigate(strAddress.AllocSysString(), &vtFlags, &vtTarget, &vtPostData, &vtHeader);

	// 웹브라우저 인터페이스의 참조 횟수를 줄인다
	pWebBrowser->Release();

	return SUCCEEDED(hr);
}
Example #25
0
// warning - different in Lua
BSTR CMUSHclientDoc::GetWorldWindowPositionX(short Which) 
{
CString strResult;
int i = 0;

  CWindowPlacement wp;

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

    if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
      {
      CSendView* pmyView = (CSendView*)pView;

      i++;

      if (i != Which)
        continue;   // wrong one

      pmyView->GetParentFrame ()->GetWindowPlacement(&wp); 
    	windowPositionHelper (strResult, wp.rcNormalPosition);

      break;

      }	
    }

	return strResult.AllocSysString();
}   // end of CMUSHclientDoc::GetWorldWindowPositionX
Example #26
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 #27
0
void SetControlStringAttribute(IHTMLDocument2 *pDoc, CString szId, CString szAttributeName, CString szValue)
{    
    HRESULT hr = S_OK;
    IHTMLElement* pElem = NULL;
    hr = GetElementById(pDoc, szId, &pElem);
    if (hr == S_OK && pElem)
    {
        BSTR bstrAttributeName = szAttributeName.AllocSysString();
        BSTR bstrValue = szValue.AllocSysString();
        VARIANT varAttr;
        varAttr.vt = VT_BSTR;
        varAttr.bstrVal = bstrValue;
        pElem->setAttribute(bstrAttributeName, varAttr);
        ::SysFreeString(bstrAttributeName);
    }
}
BSTR CHardInfoActiveXCtrl::getMacAddress()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CString strResult;

	// TODO:  在此添加调度处理程序代码
	char value[512];
	int len = sizeof(value);
	memset(value, '\0', len);
	bool bRet = false;

	bRet = GetMacAddress(value, len);

	if (bRet)
	{

		strResult = value;

	}
	else
	{

		strResult = "";

	}

	return strResult.AllocSysString();
}
bool CEOSSCreateAccessDatabase::CreateEOSSDataFileTable()
{
	//Will create table with the single last date timestamp read into the EOSS data
	bool bSuccess = false;
	//Create First table
	m_pTable.CreateInstance(__uuidof (ADOX::Table));

	if (m_pTable !=NULL && m_pCatalog !=NULL)
	{
		CString datarecordstable = "EOSSDataRecordsReadTable";
		m_pTable->PutName(datarecordstable.AllocSysString ());
		m_pTable->Columns->Append("Date_Time_LastRecord",ADOX::adDate,16);
		m_pTable->Columns->Append("Date_Timestamp_LastRecord",ADOX::adDouble,32);
		m_pCatalog->Tables->Append(_variant_t((IDispatch *)m_pTable));
		bSuccess = true;	
		// Now create a primary key and don't allow dups
		
		m_pCatalog->Tables->Refresh ();

		m_pTable  = NULL;		//Reset pointer so as to use again
	}
	else
	{
		bSuccess = false;
	}
	return bSuccess;
}
Example #30
0
void _stdcall OnNotifyBest5( short sMarketNo, short sStockidx)
{
	if( m_nType == 2 )
	{
		TBest5* tBest5 = new TBest5();

		SKQuoteLib_GetBest5(sMarketNo,sStockidx,tBest5);

		
		CString strMsg;
		strMsg.Format(_T("Best5 %d %d %d %d"),
			tBest5->m_nBid1,
			tBest5->m_nBidQty1,
			tBest5->m_nAsk1,
			tBest5->m_nAskQty1);

		BSTR bstrMsg = strMsg.AllocSysString();

		SendMessage(FindWindow(NULL,_T("QuoteTester")),WM_DATA,m_nType,(int)bstrMsg);

		delete tBest5;
		tBest5 = NULL;
		
		SysFreeString(bstrMsg);

	}
}