Results 1 to 4 of 4

Thread: Loading a form on the same screen / monitor as main form?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Loading a form on the same screen / monitor as main form?

    Hi there folks. I was getting into extended monitor set ups, and had a program written years ago with lots of forms. I was wondering, if I wanted to run a program on screen 2, and then have all forms run on screen 2, is there a code that tells the program to run on the same screen as the main form?

    Thanks!

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Loading a form on the same screen / monitor as main form?

    Where on the monitor?

    The easiest way is probably to use StartupPosition = CenterOwner and of course assign the owner when the parent Form calls Load.

    But a lot of people write pachinko machine programs where a raft of Forms have no hierarchical relationships, so that won't help.

    You can also assign Left and Top of the loaded Form to that of the current Form before calling Load.

    Or to get fancier than that you can always look at the many threads here on enumerating the list of monitors and their attributes,.

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: Loading a form on the same screen / monitor as main form?

    Here's stuff I've written to do this type of thing. It's not exactly what you asked for, but all the tools are there to get it done.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4
    Addicted Member ISAWHIM's Avatar
    Join Date
    Jan 2023
    Posts
    181

    Re: Loading a form on the same screen / monitor as main form?

    There is an API that will tell you which "device" a pointer or form is located. However, the easiest way would be to start any "virgin window" in the middle of your own programs RECT location.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width