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 6950397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:05:14+00:00 2026-05-27T14:05:14+00:00

I have an Winform application that receives a command line parameter that specify if

  • 0

I have an Winform application that receives a command line parameter that specify if it would be displayed on the main Monitor of the second Monitor via a I-Omega USB Dual Monitor connector.

The application runs on a laptop and uses two monitor.
1. The first monitor just connect to the laptop VGA port. I run the “MyApplication.exe 1”
2. The second monitor is connected via USB dual monitor VGA port. I run the second instance “MyApplication.exe 2”

I was able to force the second instance of the application to go to the second montior by using Screen.AllScreens and changing the Form’s location. I specified in the Power Setting of the laptop not to go on Standby or turnoff monitor if laptop is folded. When I close the laptop monitor, both instance of the application remains on their respective monitor. But when I reopen the laptop, the second instance moves the the first screen.

My question is there a monitor open event in .NET? Or are there other settings to retain the second instance to the second monitor/Screen?

I know there is a WM_POWERBROADCAST event but, I already set the laptop not to sleep.

  • 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-05-27T14:05:14+00:00Added an answer on May 27, 2026 at 2:05 pm

    I was able to do this not by windows event but by using a timer. Basically the timer would check for the location of the Window with the desired screen. If it does not match the desired screen, I would adjust the location again to move to the desired monitor. I added tolerance of 4(WinXP)~8(Win7)pixels when checking if the top-left location is equal. The top and left location becomes (-4,-4) when in maximized state. When in minimized state, I dont check the location.

    I used the ShowOnMonitor method from a previous question:
    How do I ensure a form displays on the "additional" monitor in a dual monitor scenario?

    private void autoAdjustPositionTimer_Tick(object sender, EventArgs e) {
    
        if (WindowState == FormWindowState.Minimized)
        {
            return;
        }
    
        autoAdjustPositionTimer.Stop();
        try
        {
            Screen[] sc;
            sc = Screen.AllScreens;
    
            int showOnMonitor = ExpectedMonitorIndex; // i.e. 1
            if (showOnMonitor >= sc.Length)
            {
                showOnMonitor = 0;
            }
    
            int offsetTolerance = 8;
    
            // Check the top left position only
            int xDiff = Math.Abs(Location.X - sc[showOnMonitor].Bounds.Left);
            int yDiff = Math.Abs(Location.Y - sc[showOnMonitor].Bounds.Top);
            if (xDiff > offsetTolerance || yDiff > offsetTolerance){
                // Method to move the position
                ShowOnMonitor(showOnMonitor);
            }
        }
        finally
        {
            autoAdjustPositionTimer.Start();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a WinForm application that calls a third-party command line tool, there may be
I have a winform application that uses some referenced web services to get data.
I have an c# winform application that runs under a local account but needs
We have an in house winform application that is used by about 20 users
I have my winform application gathering data using databinding. Everything looks fine except that
I have an application (winform exe) that I run several times. Does this mean
Over and over, I find myself developing WinForm business application screens that have a
I have a C# WinForm application that has a few images on it. I
I have a winform application that i embeded a webrowser control. I load an
I have a winForm application that generates an .aspx file based on the user

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.