Callback to WinAPI

@ihnorton Thank you for the explanation. Still my attempt crashes julia:

function foreach_window{T}(hwnd::T, lParam::T)
   return convert(Cint, 1)::Cint
end
const windowEnumCallback = cfunction(foreach_window, Cint, (Ref{Cint}, Ref{Cint}))
ccall((:EnumWindows, "User32"), stdcall, Cint, (Ptr{Void}, Ptr{Cint}), windowEnumCallback, Ref{Cint}(0))

the signatures are

BOOL WINAPI EnumWindows(
  _In_ WNDENUMPROC lpEnumFunc,
  _In_ LPARAM      lParam
);
BOOL CALLBACK EnumWindowsProc(
  _In_ HWND   hwnd,
  _In_ LPARAM lParam
);