LRESULT CFlashPlayerDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();

	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	if(m_applang == 2)
		m_popmenu.LoadMenu(IDR_MENU_FLASH_EN);
	else if(m_applang == 3 || m_applang == 4)
		m_popmenu.LoadMenu(IDR_MENU_FLASH_TC);
	else
		m_popmenu.LoadMenu(IDR_MENU_FLASH);

	s_uTBBC = RegisterWindowMessage(L"TaskbarButtonCreated");
	HINSTANCE user32 = GetModuleHandle(L"user32.dll");
	if(user32) ChangeWindowMessageFilterDLL = (ChangeWindowMessageFilterFunction)GetProcAddress(user32, "ChangeWindowMessageFilter");
	if(ChangeWindowMessageFilterDLL) {
		ChangeWindowMessageFilterDLL(s_uTBBC, MSGFLT_ADD);
		ChangeWindowMessageFilterDLL(WM_COMMAND, MSGFLT_ADD);
	}

	m_wndFlashPlayer.Attach(GetDlgItem(IDC_SHOCKWAVEFLASH));
	m_control.Attach(GetDlgItem(IDC_SLIDER_CONTROL));

	m_wndFlashPlayer.QueryControl(&pFlashPtr);

	m_control.SetRange(0, 100);
	m_inited = true;


	if(m_ontop)
		::SetWindowPos(this->m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
	SetTimer(0, 300, 0);

	DoDataExchange();

	LoadConfig();
	
	pFlashPtr->put_Loop(FALSE);
	if(m_playlist.GetSize() > 0) {
		m_current = 0;
		PlayFile();
		if(m_fs_init)
			FullScreen(true);
	}
	
	return TRUE;
}
Exemple #2
0
DWORD __stdcall CreateThreadActiveX(IN void* pParam)
{
	static TCHAR szAppName[] = TEXT ("HelloWin") ;
	MSG          msg ;
	WNDCLASS     wndclass ;
	HWND         hwnd ;

	wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
	wndclass.lpfnWndProc   = WndProc ;
	wndclass.cbClsExtra    = 0 ;
	wndclass.cbWndExtra    = 0 ;
	wndclass.hInstance     = g_hInstance ;
	wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
	wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
	wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
	wndclass.lpszMenuName  = NULL ;
	wndclass.lpszClassName = szAppName ;

	//HWND hq=FindWindow(TEXT("Chrome_WidgetWin_100"),NULL);

	HWND hwndChrome=FindWindow(TEXT("Chrome_WidgetWin_1"),0);
	hwndChrome=GetParent(hwndChrome);   // ¸¸´°¿Ú

	if (!RegisterClass (&wndclass))
	{
		MessageBox (NULL, TEXT ("This program requires Windows NT!"), 
			szAppName, MB_ICONERROR) ;
		return 0 ;
	}

	hwnd = CreateWindow (szAppName,                  // window class name
		TEXT ("The Hello Program"), // window caption
		WS_CHILDWINDOW,//WS_POPUP|WS_EX_TOOLWINDOW,//WS_OVERLAPPEDWINDOW,        // window style
		200,              // initial x position
		200,              // initial y position
		400,              // initial x size
		40,              // initial y size
		//CW_USEDEFAULT,              // initial x position
		//CW_USEDEFAULT,              // initial y position
		hwndChrome,                       // parent window handle
		NULL,                       // window menu handle
		g_hInstance,                  // program instance handle
		NULL) ;                     // creation parameters


	AtlAxWinInit();

	CoInitialize(NULL);

	// The window is attached; act appropriately

	if(hwnd)
	{			

		CAxWindow wnd;
		CLSID clsid;
		LPUNKNOWN pUnkCtrl, pUnkCont;

		IDispatch* pIDsp=NULL;

		HRESULT hr =::CLSIDFromString(L"{ED75F074-4A89-40B3-844C-B28281C3FD8E}",&clsid);

		hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown,
			(void**)&pUnkCtrl);
		CComQIPtr <IPersistStreamInit> spPerStm(pUnkCtrl);
		spPerStm->InitNew();
		wnd.Attach(hwnd);
		wnd.AttachControl(pUnkCtrl, &pUnkCont);

		wnd.QueryControl(IID_IDispatch, (void**)&pIDsp);
	}
			
	ShowWindow (hwnd, SW_SHOW) ;
	UpdateWindow (hwnd) ;

	

	while (GetMessage (&msg, NULL, 0, 0))
	{
		TranslateMessage (&msg) ;
		DispatchMessage (&msg) ;
	}

	::CoUninitialize();

	return msg.wParam;
}