Retrive the handle of Picture Control
Hi,
I have a Picture control,and its ID is IDC_STATIC_SCREEN.
I want to retrive the window Handle of the Picture control.
Using MFC, I know how to do that:
Code:
void CLiveVideoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLiveVideoDlg)
DDX_Control(pDX, IDC_STATIC_SCREEN, m_staticScreen);
//}}AFX_DATA_MAP
}
...
CStatic m_staticScreen;
//Retrive the window Handle of the Video Screen
HWND hWnd = m_staticScreen.GetSafeHwnd() ;
...
But what shall do if I want to do the same thing by calling Win32 API ?
HWND hWnd = ?????;
Thank you!
Re: Retrive the handle of Picture Control
just perform subclassing on this and use
m_wndPicture.SubclassWindow(GetDlgItem(IDC_PIC));
IDC_PIC is the id of your picture control.and m_WndPicture is the object of your Picture Class.
Re: Retrive the handle of Picture Control
Quote:
Originally Posted by humptydumpty
just perform subclassing on this and use
m_wndPicture.SubclassWindow(GetDlgItem(IDC_PIC));
IDC_PIC is the id of your picture control.and m_WndPicture is the object of your Picture Class.
I use Win32 API to write program, not MFC.
What kind of type is m_wndPicture ?
I can't do :
HWND hScreen;
hScreen.SubclassWindow(GetDlgItem(IDC_PIC));
Re: Retrive the handle of Picture Control
Quote:
Originally Posted by Cooker
I use Win32 API to write program, not MFC.
What kind of type is m_wndPicture ?
I can't do :
HWND hScreen;
hScreen.SubclassWindow(GetDlgItem(IDC_PIC));
try this to get handle of your control
HWND hWnd = GetDlgItem(IDC_MYPIC);//id of your picture control
if you want to perform some operation extra let me your mail id.i will send you my Files to you.
Re: Retrive the handle of Picture Control
GetDlgItem API function needs the handle of parent dialog of that control, as for example:
Code:
HWND hWnd = GetDlgItem(hWndDialog, IDC_STATIC_SCREEN);
BTW. Why do you not take a look in MSDN?
Re: Retrive the handle of Picture Control
Quote:
Originally Posted by ovidiucucu
GetDlgItem API function needs the handle of parent dialog of that control, as for example:
Code:
HWND hWnd = GetDlgItem(hWndDialog, IDC_STATIC_SCREEN);
BTW. Why do you not take a look in
MSDN?
according to MSDN
CWindow::GetDlgItem
This method retrieves the specified child window.
The GetDlgItem method only works for immediate child controls of a dialog box—it does not search through nested dialog boxes.
HWND GetDlgItem(int nID )const;
Re: Retrive the handle of Picture Control
Thank you for pointing us to CWindow::GetDlgItem, but:
- CWindow is an ATL class.
Quote:
Originally Posted by Cooker
I use Win32 API to write program
- this is "C++ and WinAPI" forum.
Re: Retrive the handle of Picture Control
Quote:
Originally Posted by ovidiucucu
GetDlgItem API function needs the handle of parent dialog of that control, as for example:
Code:
HWND hWnd = GetDlgItem(hWndDialog, IDC_STATIC_SCREEN);
BTW. Why do you not take a look in
MSDN?
Thank you!