Results 1 to 2 of 2

Thread: External Application Lcoation and Multi-Displays

  1. #1
    Chris Link is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.5
    Join Date
    Oct 2016

    Question External Application Lcoation and Multi-Displays

    Hello All. I hope this is the proper forum for this problem/subject

    My apologies for a long first post. I have a (somewhat) unique situation I am having a problem with and was looking for some assistance. I am developing a live production, game show system that runs on a machine with (5 ? 6) displays (depending on configuration). There is a ?Host?, or operator, display that is selected by the operator when the program is first launched. Once the Host screen is selected, any win.form that is operator specific will open on that screen only. I am using a variable called HostDis which gets a value of 1 ? 5 based on which screen is selected as Host and then All.Screens(x) via a Select Case method (in a module that is called at (whatever) form load) to determine the correct screen location.

    All of that is working fine. The issue is, at the end of a game, the operator can choose to create a report which consists of the event and game name, all of the team and player names as well as game data such as the number of ring ins, correct answers, etc per team/player. This report is generated in an Excel worksheet, which is launched, formatted and populated by the program. All of this is working as well.

    Here is the rub; I need Excel to open and be located on the Host display only. Since the system can be configured in various ways, Host is not necessarily the same display every time (which is why I am using All.Screens(x) instead of pixel based location). With the external application, this gets complicated as Excel.Application does not have a .location property (that I can see/find). I have done a significant amount of research and have seen multiple threads on the topic of external applications and things like window sizing and some location concepts. These instances all have known values (x screen is always used, thus pixel address of x,y is always applicable, etc). In my case, depending on how the displays are laid out, that addressing gets sketchy. Again, way I am using All.Screens(x), as it doesn?t matter. I have read about getting the external application?s handle and going from there. What I am not seeing is a way to apply the HostDis variable, which knows which screen is Host and returns the All.Screen(x) value and instruct Excel to be visible on that screen. If it could be as simple as calling the module all the other forms are using, that would be great (although it might trigger a null exception on start up). But those are all using a .location property.

    Does anyone have any thoughts on how to get the external application to a specific display via All.Screens(x) as opposed to the pixel coordinate method? Or, how to determine what the top/left pixel address is of the display set as Host (ie. All.Screen(1) is 1920,0 or something). At least then we could perhaps use those values with the handle control. As it stands now, if I tell a form it is on All.Sceens(1), and location is 0,0, the form will land on the correct screen every time. In the manual location method, it is based on pixel addressing where screens 1 / 2 / 3 could be -1920, 0 / 0,0 / 1920, 0 and so on.

    Any suggestions would be greatly appreciated as I am flat out stuck. Note: I am a novice programmer and so far have been able to work through the various challenges of this application. This last tidbit is beyond me at this point.

    Thank you so much.

  2. #2
    JohnH's Avatar
    JohnH is online now VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Screen.WorkingArea is a Rectangle that has a Location property that is a Point value with X/Y coordinates.
    Screen.WorkingArea Property (System.Windows.Forms)

Tags for this Thread


Posting Permissions

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