Click to See Complete Forum and Search --> : Resizing a video-capture window


ZillionDollarSadist
April 27th, 2005, 02:53 AM
Hi,
I'd need to resize a video-capture window, but it remains fixed and only the panel housing it resizes; when the application is closed and reopened, the capture window is shown in the same size it should have had if correctly resized before.
I skipped through the documentation, but it doesn't seem to be a size property or similar - but I hope as always to be wrong!
Thanks.

ahoodin
April 27th, 2005, 06:39 AM
Have a look at MoveWindow:

It can be called as a member function for CWnd, CWindow or as a SDK function call. I used used FindWindow and called CWnd::MoveWindow.

CWindow::MoveWindow():
BOOL MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );
CWnd::MoveWindow
void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );
SDK:

BOOL MoveWindow(
HWND hWnd, // handle to window
int X, // horizontal position
int Y, // vertical position
int nWidth, // width
int nHeight, // height
BOOL bRepaint // repaint flag
);

I have used that solution in the past.
boolean exec_scrn(void)
{
boolean bretval = false;
CWnd* CWndScrnDisplay;
LPCTSTR svScreen = " New App Screen Display Function";
CWndScrnDisplay= CWndScrnDisplay->FindWindow( NULL, svScreen );
if (!CWndScrnDisplay)
{
CString strPath="";
ShellExecute(NULL, _T("open"),"NewApp.exe", _T(strPath), _T("c:\\Program Files\\NewAppn\\"), SW_SHOW);
//NOTE return val bretval is meaningless for this case.
unsigned int i = (unsigned)time( NULL );
do{
CWndScrnDisplay= CWndScrnDisplay->FindWindow( NULL, svScreen );
}while(!CWndScrnDisplay && ((unsigned)time(NULL) < i+6));//time out after 5 secs
if (CWndScrnDisplay) bretval = true;
}
else
{
bretval = true;
}
if (CWndScrnDisplay)
{
CWndScrnDisplay->MoveWindow(0,0,650,528,TRUE);
CWndScrnDisplay->SetForegroundWindow();
}
return bretval;
}

ZillionDollarSadist
April 27th, 2005, 08:56 AM
It works, it works! Many thanks! :)
I have another question now, which may be odd at best.

For videocaptures I use EZCapture, a simple device by AVerMedia.
It has its sdk and a sample application, and of course I installed drivers and stuff.
Now here comes the absurd part:

1)I run first my own application: then the videocapture goes nuts and it's shown very badly;

2)If I run first the AverCap software, shut it, then I run my app, my capture goes ok.

I was thinking about some initialization problem, but I'm just guessing... any idea?

ZillionDollarSadist
April 27th, 2005, 11:28 AM
I found the initialization problem! To initialize the EZCapture, I have to call some functions featured in its sdk. And it would be fine, if I wasn't programming with Borland! Now, I guess inserting MFC in Borland may turn out terrifying, isn't it?
One more thing: the same application doesn't need any of this if run under Win98, while it does under WinXP - I think the two systems handle drivers differently?