regaa im not sure why you get the error, but this will work.
add the sendmessage to the extern ... end extern
Function SendMessage:Int(hWnd:Int,MSG:Int,wParam:Int,lParam:Int) = "SendMessageA@16"
then to test use SendMessage window,WM_DESTROY,0,0 after creating the window.
kev