ADAdministrator Syncfusion Team March 30, 2005 02:32 PM
As a general comment, even microsoft is a little luke warm in its support of using .NET controls in unmanaged code. If things work, then it works. But when they do not work, you have to trouble shoot each problem and try to work around it.
We do have a sample that shows the grid being used from MFC. There are some quirks. You''ll see we had to handle PreProcessKeyMessage to get key messages correctly routed to the grid. You have to check if you find other issues.
I uploaded the sample here: WindowsForms.zip
Additionally you should also add the following to the CMFCAppDlg and call it from OnInitDialog (I don''t think we do that in the sample but I found this mentioned in a support incident when I did a search for MFC interop - maybe it helps you).
void CMFCAppDlg::AddWS_EX_CONTROLPARENT(HWND theWnd)
bool hasChild = FALSE;
HWND tempWnd = NULL;
tempWnd = ::GetWindow(theWnd,GW_CHILD);
while(tempWnd != NULL)
hasChild = TRUE;
tempWnd = ::GetNextWindow(tempWnd, GW_HWNDNEXT);
DWORD currStyle = ::GetWindowLong(theWnd, GWL_EXSTYLE) ;
currStyle = currStyle | WS_EX_CONTROLPARENT;
::SetWindowLong(theWnd, GWL_EXSTYLE, currStyle);
>Has anyone tried to use the latest grid control from MFC/C++ unmanaged code and is it technically possible? Also any sample would be greatly appreciated.
>Thanks in advance,