rewrite axwindow in cpp