⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propdialog.cpp

📁 视频放大或缩小的滤波器
💻 CPP
字号:
 #include <windows.h>
#include <ocidl.h>
#include <streams.h>
#include <shellapi.h>
#include <string.h>
#include <stdio.h>
#include "resource.h"
#include "iresizer.h"
#include "cresizer.h"
#include "propdialog.h"
#include "resizeuids.h"
 
CUnknown*
SizeSelect_Dialog::CreateInstance (LPUNKNOWN owner, HRESULT* result)
{
	CUnknown* instance = new SizeSelect_Dialog (owner, result);
	if (instance == 0)
	{
		*result = E_OUTOFMEMORY;
	}
	return instance;
}

//
// default creation
//
SizeSelect_Dialog::SizeSelect_Dialog (LPUNKNOWN owner, HRESULT* result)
	:	CBasePropertyPage (NAME ("SizeSelect Dialog"), owner, IDD_SIZE_SELECT, 
	IDS_ABOUT_TITLE),
	m_pResizer(NULL)
{

}

HRESULT SizeSelect_Dialog::OnConnect(IUnknown *pUnknown)
{
    ASSERT(m_pResizer == NULL);

    HRESULT hr = pUnknown->QueryInterface(IID_ITIMResizer, (void **) &m_pResizer);
    if (FAILED(hr)) {
        return E_NOINTERFACE;
    }
    ASSERT(m_pResizer);

	return NOERROR;
}

HRESULT SizeSelect_Dialog::OnDisconnect()
{
   if (m_pResizer == NULL) {
        return E_UNEXPECTED;
    }

    m_pResizer->Release();
    m_pResizer = NULL;

	return	NOERROR;
}
HRESULT	SizeSelect_Dialog::OnApplyChanges()
{
	return(NOERROR);
}
//
// Called when a message is sent to the property page dialog box. 
//
BOOL SizeSelect_Dialog::OnReceiveMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	
	int	nWidth;
	int nHeight;
	SizeSelect_Dialog* dialog = (SizeSelect_Dialog*)(GetWindowLong (window, GWL_USERDATA));
	switch (msg)
	{
		char string [5];
		case WM_INITDIALOG:
			pIResizer()->get_VideoSize(nWidth, nHeight);
		//	if(nWidth==352)
		//		MessageBox(m_hwnd, "ddd", "",MB_OK);
			sprintf (string, "%d", nWidth);
			SetDlgItemText (hwnd, IDC_EDIT_WIDTH, string);
			sprintf (string, "%d", nHeight);
			SetDlgItemText (hwnd, IDC_EDIT_HEIGHT, string);

			return TRUE;

		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
			case IDC_BUTTON_DEFAULT:
				sprintf (string, "%d", 352 );
				SetDlgItemText (hwnd, IDC_EDIT_WIDTH, string);
				sprintf (string, "%d", 240 );
				SetDlgItemText (hwnd, IDC_EDIT_HEIGHT, string);
				pIResizer()->set_VideoSize(352, 240);
				break;
			case IDC_BUTTON_APPLY:
				if (m_pResizer == NULL)
					break;
				BOOL	bTrans;
				int	nWidth = 0, nHeight = 0;
						
				nWidth = GetDlgItemInt(hwnd, IDC_EDIT_WIDTH, &bTrans, FALSE);
				nHeight = GetDlgItemInt(hwnd, IDC_EDIT_HEIGHT, &bTrans, FALSE);

				int	temp1=0,temp2=0;
				temp1 = (nWidth-352)/16;
				temp2 = (nWidth-352)%16;
				if(temp2)
				{
					if(temp1>=0)
						nWidth = 352+(temp2>8?temp1+1:temp1)*16;
					else
						nWidth = 352+(temp2<8?temp1-1:temp1)*16;
				}
				
				temp1 = (nHeight-288)/16;
				temp2 = (nHeight-288)%16;
				
				if (temp2)
				{
					if(temp1>=0)
						nHeight = 288+(temp2>8?temp1+1:temp1)*16;
					else
						nHeight = 288+(temp2>8?temp1-1:temp1)*16;
				}
			
				sprintf (string, "%d", nWidth );
				SetDlgItemText (hwnd, IDC_EDIT_WIDTH, string);
				sprintf (string, "%d", nHeight );
				SetDlgItemText (hwnd, IDC_EDIT_HEIGHT, string);
				
				pIResizer()->set_VideoSize(nWidth, nHeight);
				break;
			}
	}
	return this->CBasePropertyPage::OnReceiveMessage (hwnd, msg, wParam, lParam);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -