コード例 #1
0
ファイル: TransChatWebWnd.cpp プロジェクト: tantaishan/MyEcho
int CTransChatWebWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!theApp.GetWindowManager()->Attach(GetSafeHwnd(), _T("trans_chat_web_wnd")))
		return -1;
	
	SetWindowText(_T("专人翻译"));

	g_SessionData.chat_hwnd = GetSafeHwnd();

	m_shadow_win.create(GetSafeHwnd());

	m_Recorder.Attach(GetSafeHwnd());

	//m_pV8Exthandler = new ClientV8ExtHandler(this);

	CefRefPtr<CefWebClient> client(new CefWebClient());
	m_cWebClient = client;

	CefSettings cSettings;
	CefSettingsTraits::init(&cSettings);
	cSettings.multi_threaded_message_loop = true;
	CefRefPtr<CefApp> spApp;
	CefInitialize(cSettings, spApp);

	//CefRegisterExtension("v8/Ext", s_JsExt, m_pV8Exthandler);

	duHwndObj* pWebHwndobj = (duHwndObj*)GetPluginByName(GetSafeHwnd(), _T("chat_web_hwndobj"));
	RECT rc = { 0, 0, 0, 0 };
	pWebHwndobj->GetRect(&rc);
	CefWindowInfo info;
	info.SetAsChild(GetSafeHwnd(), rc);

	TCHAR szHtml[MAX_PATH] = { 0 };
	::GetModuleFileName(GetModuleHandle(NULL), szHtml, _countof(szHtml));
	::PathRemoveFileSpec(szHtml);
	::PathAppend(szHtml, _T("html\\trans.html"));

	CefBrowserSettings browserSettings;
	CefBrowser::CreateBrowser(info, static_cast<CefRefPtr<CefClient>>(client),
		szHtml, browserSettings);

	InitExtension();
	//RunExtensionTest(m_cWebClient->GetBrowser());

	//pWebHwndobj->Attach(m_cWebClient->GetBrowser()->GetWindowHandle());

	//m_Recorder.StartRecord();
	
	//StrCpy(m_szVoicePath, _T("C:\\Users\\Administrator\\AppData\\Roaming\\MyEcho\\oDHO7Q3LRUtxLg4E9R1adjrsv5irzYa8\\task\\test.amr"));

	return 0;
}
コード例 #2
0
ファイル: nglContext.cpp プロジェクト: jbl2024/nui3
bool nglContext::CheckExtension (const nglChar* pExtName)
{
  if (!pExtName)
    return false;

  MakeCurrent();
  
  nglString temp(pExtName);
  char* extname = temp.Export();

  int extname_l = strlen(extname);
  const char* ext0 = (const char*)glGetString(GL_EXTENSIONS);
  const char* ext = ext0;
  bool success = false;

  while (!success && (ext = strstr(ext, extname)))
  {
    success = (ext == ext0 || ext[-1] == ' '); // Check previous separator
    ext += extname_l;
    success = success && (*ext == 0 || *ext == ' '); // Check next separator
  }

  if (success || !strncmp(extname, "GL_VERSION_1_", 13) || !strncmp(extname, "GL_VERSION_2_", 13))
  {
    success = InitExtension(pExtName);
#ifdef _DEBUG_
    if (!success)
      NGL_LOG(_T("context"), NGL_LOG_WARNING, _T("'%s' extension setup failed"), pExtName);
  }
  else
  {
    NGL_LOG(_T("context"), NGL_LOG_DEBUG, _T("'%s' extension not found"), pExtName);
#endif
  }

  if (extname)
    free (extname);

  return success;
}
コード例 #3
0
ファイル: IDEHD.C プロジェクト: jdsm81/HelloX_Kernel
//For each extension partition in hard disk,this function travels the
//extension partition table list,to install one by one into IOManager.
//How many logical partition(s) is returned.
static int InitExtension(int nHdNum,          //The hard disk number.
						 BYTE* pSector0,      //First sector of extension partition.
						 DWORD dwStartSector, //Position of this partition,in physical disk.
						 DWORD dwExtendStart, //Start position of extension partition.
						 int nBaseNumber,     //The partition base number.
						 __DRIVER_OBJECT* lpDrvObject)
{
	__DEVICE_OBJECT* pDevObject = NULL;
	__PARTITION_EXTENSION* pPe = NULL;
	BYTE* pStart = NULL;
	BYTE  buffer[512];  //Buffer used to read one sector.
	DWORD dwNextStart;  //Next extension's start sector if any.
	DWORD dwAttributes = DEVICE_TYPE_PARTITION;
	CHAR strDevName[MAX_DEV_NAME_LEN + 1];
	DWORD dwFlags;
	int nPartitionNum = 0;

	if((NULL == pSector0) || (NULL == lpDrvObject)) //Invalid parameters.
	{
		goto __TERMINAL;
	}
	//Locate the partition table's position.
	pStart = pSector0 + 0x1BE;
	if(0 == *(pStart + 4)) //Partition type is zero,invalid.
	{
		goto __TERMINAL;
	}
	//Now create the partition extension object and initialize it.
	pPe = (__PARTITION_EXTENSION*)CREATE_OBJECT(__PARTITION_EXTENSION);
	if(NULL == pPe)
	{
		goto __TERMINAL;
	}
	pPe->dwCurrPos     = 0;
	pPe->BootIndicator = *pStart;
	pStart += 4;
	pPe->PartitionType = *pStart;
	pStart += 4;
	pPe->dwStartSector = *(DWORD*)pStart;
	pStart += 4;
	pPe->dwSectorNum   = *(DWORD*)pStart;
	pStart += 4;  //Now pStart pointing to next partition entry.
	//Validate if all parameters are correct.
	if((pPe->dwStartSector == 0)  ||  //Should invalid.
	   (pPe->dwSectorNum   == 0))     //Impossible.
	{
		goto __TERMINAL;
	}
	switch(pPe->PartitionType)
	{
	case 0x0B:  //FAT32
	case 0x0C:  //FAT32
	case 0x0E:
		dwAttributes |= DEVICE_TYPE_FAT32;
		break;
	case 0x07:
		dwAttributes |= DEVICE_TYPE_NTFS;
		break;
	default:
		break;
	}
	pPe->dwStartSector += dwStartSector;  //Adjust the start sector to physical one.
	//Partiton information is OK,now create the device object.
	StrCpy(PARTITION_NAME_BASE,strDevName); //Form device name.
	__ENTER_CRITICAL_SECTION(NULL, dwFlags);
	strDevName[StrLen(PARTITION_NAME_BASE) - 1] += (CHAR)IOManager.dwPartitionNumber;
	IOManager.dwPartitionNumber += 1;
	__LEAVE_CRITICAL_SECTION(NULL, dwFlags);
	pDevObject = IOManager.CreateDevice(
		(__COMMON_OBJECT*)&IOManager,
		strDevName,
		dwAttributes,
		512,
		16384,
		16384,
		pPe,
		lpDrvObject);
	nPartitionNum += 1;

	//Now check the next table entry to see if there is another extension embeded.
	if(*(pStart + 4) == 0x05)  //Is a extension partition.
	{
		dwNextStart = dwExtendStart + (*(DWORD*)(pStart + 8));
		if(!ReadSector(
			nHdNum,
			dwNextStart,
			1,
			buffer))
		{
			goto __TERMINAL;
		}
		nPartitionNum += InitExtension(
			nHdNum,
			buffer,
			pPe->dwStartSector + pPe->dwSectorNum,//dwStartSector,
			dwExtendStart,
			nBaseNumber + 1,
			lpDrvObject);
	}

__TERMINAL:
	if(0 == nPartitionNum)  //Not any logical partiton is created.
	{
		if(pPe)
		{
			RELEASE_OBJECT(pPe);
		}
		if(pDevObject)
		{
			IOManager.DestroyDevice((__COMMON_OBJECT*)&IOManager,
				pDevObject);
		}
	}
	return nPartitionNum;
}
コード例 #4
0
ファイル: IDEHD.C プロジェクト: jdsm81/HelloX_Kernel
//This function travels all partition table in sector 0 in current
//hard disk,from the MBR,to install each primary partition into IOManager.
//For extension partition,it calls InitExtension function to install.
static int InitPartitions(int nHdNum,
						  BYTE* pSector0,
						  __DRIVER_OBJECT* lpDrvObject)
{
	static int nPartNum = 0;  //How many partitons in current system.
	__DEVICE_OBJECT* pDevObject = NULL;
	__PARTITION_EXTENSION* pPe  = NULL;
	BYTE* pStart                = NULL;
	DWORD dwStartSector;  //Used to seek next partition.
	DWORD dwAttributes = DEVICE_TYPE_PARTITION;
	CHAR strDevName[MAX_DEV_NAME_LEN + 1];
	int i;
	DWORD dwFlags;
	BYTE Buff[512];

	if((NULL == pSector0) || (NULL == lpDrvObject))  //Invalid parameter.
	{
		return 0;
	}
	pStart = pSector0 + 0x1be;  //Locate to the partition table start position.
	for(i = 0;i < 4;i ++) //Analyze each partition table entry.
	{
		if(*(pStart + 4) == 0) //Table entry is empty.
		{
			break;
		}
		if(*(pStart + 4) == 0x0F)  //Extension partiton.
		{
			dwStartSector = *(DWORD*)(pStart + 8);
			if(!ReadSector(nHdNum,dwStartSector,1,Buff))
			{
				break;
			}
			nPartNum += InitExtension(nHdNum,
				Buff,
				dwStartSector,
				dwStartSector,
				i,
				lpDrvObject);
			pStart += 16;  //Pointing to next partition table entry.
			continue;
		}
		pPe = (__PARTITION_EXTENSION*)CREATE_OBJECT(__PARTITION_EXTENSION);
		if(NULL == pPe)  //Can not create object.
		{
			break;
		}
		pPe->dwCurrPos     = 0;
		pPe->BootIndicator = *pStart;
		pStart += 4;
		pPe->PartitionType = *pStart;
		pStart += 4;
		pPe->dwStartSector = *(DWORD*)pStart;
		pStart += 4;
		pPe->dwSectorNum   = *(DWORD*)pStart;
		pStart += 4;  //Pointing to next partition table entry.
		switch(pPe->PartitionType)
		{
		case 0x0B:   //FAT32.
		case 0x0C:   //Also FAT32.
		case 0x0E:   //FAT32 also.
			dwAttributes |= DEVICE_TYPE_FAT32;
			break;
		case 0x07:
			dwAttributes |= DEVICE_TYPE_NTFS;
			break;
		default:
			break;
		}

		//Create device object for this partition.
		//strcpy(strDevName,PARTITION_NAME_BASE);  // -------- CAUTION !!! ---------
		StrCpy(PARTITION_NAME_BASE,strDevName);
		__ENTER_CRITICAL_SECTION(NULL, dwFlags);
		strDevName[StrLen(PARTITION_NAME_BASE) - 1] += (BYTE)IOManager.dwPartitionNumber;
		IOManager.dwPartitionNumber += 1;
		__LEAVE_CRITICAL_SECTION(NULL, dwFlags);
		nPartNum ++;  //Increment the partition number.
		pDevObject = IOManager.CreateDevice(
			(__COMMON_OBJECT*)&IOManager,
			strDevName,
			dwAttributes,
			512,
			16384,
			16384,
			pPe,
			lpDrvObject);
		if(NULL == pDevObject)  //Can not create device object.
		{
			RELEASE_OBJECT(pPe);
			break;
		}
		dwAttributes = DEVICE_TYPE_PARTITION;  //Reset to default value,very important.
	}
	return nPartNum;
}
コード例 #5
0
ファイル: EIKSBFRM.CPP プロジェクト: cdaffara/symbiandump-mw1
CEikScrollBarFrame::CEikScrollBarFrame(CCoeControl* aParentWindow, MEikScrollBarObserver* aObserver, TBool /*aPreAlloc*/, TBool aDoubleSpan)
	{
    InitExtension(aParentWindow,aObserver);
	GetScrollBars(aDoubleSpan);
	}
コード例 #6
0
ファイル: EIKSBFRM.CPP プロジェクト: cdaffara/symbiandump-mw1
EXPORT_C CEikScrollBarFrame::CEikScrollBarFrame(CCoeControl* aParentWindow, MEikScrollBarObserver* aObserver, TBool /*aPreAlloc*/)
	{
    InitExtension(aParentWindow,aObserver);
	GetScrollBars(EFalse);	
	}