API and Rich edit control

This is a discussion on API and Rich edit control within the Windows Programming forums, part of the Platform Specific Boards category; I wrote an app for a friend with MFC, but it won't run on his computer for some unknown reason. ...

API and Rich edit control

I wrote an app for a friend with MFC, but it won't run on his computer for some unknown reason. Anyway, I'm rewriting it with API, but I am not an API programmer, so I need some assistance.

I have a rich edit control and I want to handle the WM_CHAR and WM_KEYDOWN messages (among others) and know that I need to create a separate procedure to handle the richedit's messages, but I don't know how to do that... I've created it with CreateWindowEx(), but how do I tell the app where to send its messages?

>>I've created it with CreateWindowEx(), but how do I tell the app where to send its messages?

The msgs are sent to the parents or owners HWND as supplied. The resouce ID is cast as the HMENU param.

change on fly

Code:

//get old WNDPROC to send msg's we are not interested in back to
lpfnDefOldProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
//set to the new WNDPROC
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)NewWndProc);