SetLocation
procedure SetLocation (lLeft: LongInt; lTop: LongInt; lWidth: LongInt; lHeight: LongInt);
public void SetLocation(int lLeft, int lTop, int lWidth, int lHeight);
Public Sub SetLocation(lLeft As Integer, lTop As Integer, lWidth As Integer, lHeight As Integer)
void SetLocation (int lLeft, int lTop, int lWidth, int lHeight);
Used to set the location of the video window within the parent control (not available in Delphi / CppBuilder, the component resizes automatically when the parent control is resized). E.g.:
CMFCFormDlg::CMFCFormDlg(CWnd pParent /=nullptr/)
: CDialogEx(IDD_MFCFORM_DIALOG, pParent)
, m_VideoGrabber(NULL)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_VideoGrabber = new CVideoGrabber(this);
}
CMFCFormDlg::~CMFCFormDlg()
{
delete m_VideoGrabber;
}
BOOL CMFCFormDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_VideoGrabber->SetParentWindow(this->GetSafeHwnd());
...
return TRUE; // return TRUE unless you set the focus to a control
}
void CMFCFormDlg::OnSize(UINT nType, int w, int h)
{
m_VideoGrabber->SetLocation(0, 0, w, h);
}
void CMFCFormDlg::OnBnClickedOk()
{
m_VideoGrabber->SetVideoSource(TVideoSource::vs_ScreenRecording); m_VideoGrabber->StartPreview();