コード例 #1
0
void vmsGetItButton::onClick()
{
	m_bWasClick = true;

	if (m_youtubeVideo)
	{
		IFDMFlashVideoDownloadsPtr spFVDownloads;
		verify (SUCCEEDED (spFVDownloads.CreateInstance (__uuidof (FDMFlashVideoDownloads))));
		assert (spFVDownloads != NULL);
		if (spFVDownloads == NULL)
		{
			return;
		}
		verify (SUCCEEDED (spFVDownloads->CreateFromUrl (SysAllocString (m_wstrHtmlPageUrl.c_str ()))));
		return;
	}

	DWORD dw;
	CloseHandle (
		CreateThread (NULL, 0, _threadOnDownloadItBtnClicked, this, 0, &dw));

	CWaitDlg dlg;
	dlg.m_strMsg = vmsFdmTranslations::o ().GetString (L_SEARCHING_FLVS);
	dlg.m_hEvCloseDlg = m_hEvCloseDlg = CreateEvent (NULL, TRUE, FALSE, NULL);
	if (dlg.m_strMsg.empty ())
		dlg.m_strMsg = _T ("Searching flash videos...");
	dlg.Create (GetFocus ());

	while (IsWindow (dlg))
	{
		MSG msg;
		while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
			DispatchMessage (&msg);
		Sleep (10);
	}
	
	CloseHandle (m_hEvCloseDlg);
	m_hEvCloseDlg = NULL;
}
コード例 #2
0
ファイル: CtlPanel.cpp プロジェクト: jimmccurdy/ArchiveGit
//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
LRESULT CCtlPanel::OnPrint(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/,
							BOOL & /*bHandled*/)
{
	if (m_pAGDoc)
	{
		AGDOCTYPE DocType = m_pAGDoc->GetDocType();
		bool bSingleFold = (DocType == DOC_CARD_SINGLEFOLD_PORTRAIT || DocType == DOC_CARD_SINGLEFOLD_LANDSCAPE);

		PRINTDLG pd;
		memset(&pd, 0, sizeof(pd));
		pd.lStructSize = sizeof(pd);
		pd.hwndOwner = GetParent();
		pd.hDevMode = m_hDevMode;
		pd.hDevNames = m_hDevNames;
		pd.hInstance = _Module.GetResourceInstance();
		pd.lCustData = (DWORD) &bSingleFold;
		pd.lpfnPrintHook = PrintHookProc;
		pd.lpPrintTemplateName = MAKEINTRESOURCE(PRINTDLGORD);
		pd.Flags = PD_ENABLEPRINTTEMPLATE | PD_ENABLEPRINTHOOK;

		if (PrintDlg(&pd))
		{
			DEVNAMES *pDevNames = (DEVNAMES *) GlobalLock(pd.hDevNames);
			DEVMODE *pDevMode = (DEVMODE *) GlobalLock(pd.hDevMode);
			char *pszDriver = ((char *) pDevNames) + pDevNames->wDriverOffset;
			char *pszDevice = ((char *) pDevNames) + pDevNames->wDeviceOffset;
			char *pszOutput = ((char *) pDevNames) + pDevNames->wOutputOffset;

			int nDuplex;
			if (! GetRegistryDuplex(pszDevice, nDuplex))
				nDuplex = -1;

			if (bSingleFold && nDuplex == -1)
			{
				CDblSideIntro	Intro;
				CDblSideStep1	Step1;
				CDblSideStep2	Step2;
				CDblSideEnd 	End;

				PROPSHEETPAGE *pPropPages = new PROPSHEETPAGE[4];
				pPropPages[0] = Intro.m_psp;
				pPropPages[1] = Step1.m_psp;
				pPropPages[2] = Step2.m_psp;
				pPropPages[3] = End.m_psp;

				Intro.m_pszDriver = Step1.m_pszDriver = pszDriver;
				Intro.m_pszDevice = Step1.m_pszDevice = pszDevice;
				Intro.m_pszOutput = Step1.m_pszOutput = pszOutput;
				Intro.m_pDevMode = Step1.m_pDevMode = pDevMode;

				PROPSHEETHEADER psh;
				psh.dwSize = sizeof(PROPSHEETHEADER);
				psh.dwFlags = PSH_WIZARD | PSH_PROPSHEETPAGE;
				psh.hwndParent = GetParent();
				psh.hInstance = NULL;
				psh.hIcon = NULL;
				psh.pszCaption = NULL;
				psh.nPages = 4;
				psh.nStartPage = 0;
				psh.ppsp = pPropPages;
				psh.pfnCallback = NULL;

				::PropertySheet(&psh);
				if (End.IsFinished())
				{
					nDuplex = Step2.GetSelected();
					SetRegistryDuplex(pszDevice, nDuplex);
				}

				delete [] pPropPages;
			}

			if (!(bSingleFold && nDuplex == -1))
			{
				CWaitDlg WaitDlg;
				WaitDlg.Create(GetParent());
				WaitDlg.UpdateWindow();

				MSG msg;
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					TranslateMessage(&msg);
					DispatchMessage(&msg);
				}

				bool bRotated;
				int nCopies = pd.nCopies;
				while (nCopies-- > 0)
				{
					if (bSingleFold)
					{
						m_pAGDoc->PrintCardSingle(PRINT_OUTSIDE, pszDriver,
						  pszDevice, pszOutput, pDevMode, bRotated);
					}
					else
					{
						m_pAGDoc->PrintCardQuarter(pszDriver, pszDevice,
						  pszOutput, pDevMode);
					}
				}

				WaitDlg.DestroyWindow();

				if (bSingleFold)
				{
					char szFace[10];
					if (nDuplex > 2)
						lstrcpy(szFace, "UP");
					else
						lstrcpy(szFace, "DOWN");

					DWORD dwOrientation = ::DeviceCapabilities(pszDevice,
					  pszOutput, DC_ORIENTATION, NULL, pDevMode);

					bool bHorz = (DocType == DOC_CARD_SINGLEFOLD_LANDSCAPE || DocType == DOC_CARD_QUARTERFOLD_LANDSCAPE);
					if (!bHorz && dwOrientation == 270)
						bRotated = !bRotated;

					char szDirection[15];
					int nDirection = PaperDirection[nDuplex % 2][bHorz][bRotated];
					if (nDirection == 1)
						lstrcpy(szDirection, "AWAY FROM");
					else
						lstrcpy(szDirection, "TOWARD");

					char szMsg[256];
					wsprintf(szMsg, "To print the inside of your card, reinsert the page with the printed side %s\nand the front panel of the card %s the printer.\n\n\nClick OK when you are ready to print the inside.",
					  szFace, szDirection);

					if (MessageBox(szMsg, "Print inside", MB_OKCANCEL) == IDOK)
					{
						WaitDlg.Create(GetParent());
						WaitDlg.UpdateWindow();

						MSG msg;
						while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
						{
							TranslateMessage(&msg);
							DispatchMessage(&msg);
						}

						nCopies = pd.nCopies;
						while (nCopies-- > 0)
						{
							m_pAGDoc->PrintCardSingle(PRINT_INSIDE, pszDriver,
							  pszDevice, pszOutput, pDevMode, bRotated);
						}

						WaitDlg.DestroyWindow();
					}
				}
			}

			GlobalUnlock(pd.hDevNames);
			GlobalUnlock(pd.hDevMode);
		}

		m_hDevMode = pd.hDevMode;
		m_hDevNames = pd.hDevNames;
	
		m_pMainWnd->SetFocus();
	}
	
	return (TRUE);
}