Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7720445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:40:33+00:00 2026-06-01T03:40:33+00:00

First of all I’m not sure if .exe window is the proper term. It’s

  • 0

First of all I’m not sure if “.exe window” is the proper term. It’s the window that pops up when you start the application.

I’m a game programmer, and when I’m debugging, I very rapidly start it up, look at the problem, then close it down again to make minor changes in the code, then start it again etc. I do this like once per minute, so it happens a lot. My problem is that the .exe window always appears at the middle of my main screen (where I’m coding), and I’m running double monitors, and I’d like the game window to appear on my second screen instead of my main screen (obscuring my code).

Can I change where the exe window appears in VS2010? I’ve looked around everywhere, it feels like. Or is it something that will have to be managed by a 3rd party program? If so, what program?

Edit:
OK, OK, I found the solution. I did a really dumb mistake where I didn’t mention that I am using XNA, and not using winforms. Sorry for misleading you guys. Here’s how I solved it:

First off I had to include:

    using System.Runtime.InteropServices;

Then at the top of my main class I created a tiny class:

    public static class User32 
    { 
    [DllImport("user32.dll")] public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); 
    }

Then in my Initialize function I simply call:

    #if DEBUG
              User32.MoveWindow(Game.Window.Handle, 2000, 400, 600, 480, true);
    #endif

It’s a little ugly, but it’s only for debugging and only called once, so psh.

Original solution found here: http://social.msdn.microsoft.com/forums/en-US/xnagamestudioexpress/thread/bc9588a9-542f-425b-9025-d69fe2b0b182/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:40:35+00:00Added an answer on June 1, 2026 at 3:40 am

    Although you are not using winforms, you still change it in Xna by using winforms objects. I know you found a solution but here is how to change it without using interop.

    Add a reference to System.Windows.Forms and System.Drawing to the References in the game project.

    Resist the temptation to add using statements for these as it can cause ambiguity with some Xna objects (Point, for instance, which in Xna uses floats).

    In the Game.Initialize method:

    System.Drawing.Point p = new System.Drawing.Point(2000, 400);// or wherever you want
    System.Windows.Forms.Control c =  Control.FromHandle(this.Window.Handle);
    c.Location = p;
    

    the game window will now start at the screen 2000,400 location.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, let me say that I am not a professional coder -
first of all, I'm not a programmer, so the answer to this might be
(First of all, sorry for my english, it's not my first language) I have
First of all. I want to say that i've acctualy read the other posts
First of all I have to admit that these are very basic and primitive
First of all, I'm using ARC. If I have a class that, for example,
First of all I have seen that there are many questions about unrecognized selector
first of all, I'm not good with jQuery and coding. I'm trying to achieve
First of all, I know how to build a Java application. But I have
First of all I am using JQGrid in my application. After changing my CSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.