[plt-scheme] Extensibility of MrEd

From: Ben Goetter (goetter at mazama.net)
Date: Tue Sep 30 01:17:09 EDT 2008

I wrote:
> LRESULT CALLBACK NewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, 
> LPARAM lParam)
> { if (uMsg == WM_RBUTTONDOWN) // easy enough to catch
>  { Dispatch(hwnd, LOWORD(lParam), HIWORD(lParam)); return 0; }
>  return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam); }
Fixed it by wrapping the call to Dispatch in scheme_start_atomic() and 
scheme_end_atomic_no_swap().  Resulting stub wndproc now looks like

LRESULT CALLBACK NewWndProc(HWND h, UINT n, WPARAM w, LPARAM l)
{
  if (n == WM_RBUTTONDOWN) {
    scheme_start_atomic();
    Dispatch(h, LOWORD(l), HIWORD(l)); /* queues a callback from Scheme */
    scheme_end_atomic_no_swap();
    return 0;
  }
  return CallWindowProc(OldWndProc, h, n, w, l);
}

"Never mind,"
Ben


Posted on the users mailing list.