you can either use SetCursorPos and get the coordinates of the window on the screen, and set your cursor somewhere inside your window or
you could use ClipCursor and GetWindowRect duo.(ClipCursor need a RECT, you get RECT of engine window with GetWindowRect)
edit: i.e. this will trap mouse in the middle as long as you keep pressing space.
#include <acknex.h>
#include <windows.h>
void main(){
RECT* window_rect;
while(1){
if(key_space){
GetWindowRect(hWnd,window_rect);
SetCursorPos(window_rect.left+screen_size.x/2,window_rect.top+screen_size.y/2);
}
wait(1);
}
}