怎样获取TImage的窗口句柄?
导师限定了Image组件,需要利用此组件进行Direct Draw的窗口开发。但是Image似乎没有句柄。我试过Canvas,也失败了。
请问有解决的办法吗?
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
HWND hWnd;
DWORD dwRet = m_draw.Init(Img->Canvas->Handle,
SCREEN_WIDTH, SCREEN_HEIGHT, 24);
if(DD_OK != dwRet)
{
wsprintf(g_szErr,
"Direct Draw 7 initialize failed!\nError code is %u", dwRet);
MessageBox(NULL, g_szErr, "Error", MB_OK);
Application->Terminate();
}
}
在SetCooperativeLevel(m_hWnd, DDSCL_NORMAL)时,Img->Canvas->Handle导致失败。