Page 1 of 1

How to get the position and size of the DD video panel

Posted: Fri Nov 09, 2007 4:05 pm
by chattana
Hi Rel,

Please let me know how to get the position and size of the DD video panel, which is the window actually show the video.
I guess these events would provide the video panel information, please correct me if I am wrong:
DDEVENT_BEFORE_RESIZE
DDEVENT_AFTER_RESIZE
DDEVENT_BEFORE_DISPLAYMODE
DDEVENT_AFTER_DISPLAYMODE
DDEVENT_AFTER_INITIALITION

And how to get the position and size for the DD video panel from EventParams?

Thanks

Posted: Fri Nov 09, 2007 11:11 pm
by rel
To get window handle,
EventParams is a pointer to HWND for DDEVENT_AFTER_INITIALITION

hWindow = *((HWND *) (EventParams))

you can then get the window size with Windows API
RECT rWin;
GetWindowRect(hWindow, &rWin);


You must check and update this value after every DDEVENT_AFTER_RESIZE event.

---------------------

Alternatively you can use DDEVENT_AFTER_RESIZE to get the values:

EventParams is a pointer to a pointer of WINDOWPOS. (double reference)
DDEVENT_AFTER_RESIZE


typedef struct _WINDOWPOS { // wp
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
} WINDOWPOS;


usage must be something like following line in C
(WINDOWPOS *) ((void *)(*EventParams))


(WINDOWPOS *) ((void *)(*EventParams))->x
(WINDOWPOS *) ((void *)(*EventParams))->Y
(WINDOWPOS *) ((void *)(*EventParams))->cx (width)
(WINDOWPOS *) ((void *)(*EventParams))->cy (height)