Handle to Static Text / Group Box
I have a Static Text control in my Form View based SDI application. I need to dynamically resize the Static Text control's border on resizing the main frame (Window).
I attempt to obtain a pointer to the Static Text control using the conventional way -
CWnd *ptr = (CWnd*)GetDlgItem(IDC_STATIC);
But, ptr is always found to be NULL.
Doing the same on a button control in the same Form View gave me a valid pointer.
Is it not possible to obtain a handle to Static Text / Group Box frames in a dialog for the purpose of resizing ?
Can someone give me some hints ?
# 2 Re: Handle to Static Text / Group Box
and simply move them as follows:
GetDlgItem(IDC_STAT1)->MoveWindow(x,y,dx,dy);
GetDlgItem(IDC_STAT2)->MoveWindow(x,y,dx,dy);
etc
# 3 Re: Handle to Static Text / Group Box
Thanks. Basically I needed a frame around a button which maximizes and minimizes as the button size increases and decreases. The Static Text Control actually overwrites the button and the button cannot be seen on running the application.
The other solution is to use a Group Box but then GetDlgItem() returns a NULL pointer in case of a Group Box (even after changing IDC_STATIC to something else.)
Is there any other option ?