Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Pass5107 Absent Member.
Absent Member.
976 views

Multiple monitors on a desktop

Jump to solution

I am wondering if there is anyone on this forum that knows how to start an AcuCobol program automatically in the 2nd or 3rd monitor, I have customers asking for this ability?

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Chuck Edgin Absent Member.
Absent Member.

RE: Multiple monitors on a desktop

Jump to solution

Well, you can move your initial window to any location you'd like, using MODIFY Screen1-Handle, SCREEN COL xxxx, SCREEN LINE yyyy, where xxxx and yyyy are the coordinates (in pixels) where you want the top-left corner of your window. Put this in your program right after the window is displayed (I'd suggest using the screen's "after create" paragraph, if you use AcuBench).

The tricky part is figuring out the pixel coordinates. The top-left corner of your primary monitor serves as the origin (1,1). Any monitor above or to the left of the primary could use negative coordinates, while a monitor below or to the right would use positive coordinates. And multiple monitors could have different resolutions, be aligned or offset differently, etc. based on each user's preferences. You can figure this out programmatically, using calls to the Windows API, but it would be a lot of work.  You can read up on this on the MSDN reference site if you want to learn more.

Another approach would be to let each user choose where they want the initial window to appear. They could move the window to the desired position, then click a menu item (that you provide) which would run code to store the current position (using INQUIRE Screen1-Handle, SCREEN COLUMN in Screen-X-Position, SCREEN LINE in Screen-Y-Position). Then save those values (make sure they're signed, like PIC S9(4)) into a data file, keyed by the user id, hostname, or something similar (or a combination of the two). Then on the next startup, that data would be retrieved and used in a MODIFY statement to restore the position.

View solution in original post

0 Likes
3 Replies
Chuck Edgin Absent Member.
Absent Member.

RE: Multiple monitors on a desktop

Jump to solution

Well, you can move your initial window to any location you'd like, using MODIFY Screen1-Handle, SCREEN COL xxxx, SCREEN LINE yyyy, where xxxx and yyyy are the coordinates (in pixels) where you want the top-left corner of your window. Put this in your program right after the window is displayed (I'd suggest using the screen's "after create" paragraph, if you use AcuBench).

The tricky part is figuring out the pixel coordinates. The top-left corner of your primary monitor serves as the origin (1,1). Any monitor above or to the left of the primary could use negative coordinates, while a monitor below or to the right would use positive coordinates. And multiple monitors could have different resolutions, be aligned or offset differently, etc. based on each user's preferences. You can figure this out programmatically, using calls to the Windows API, but it would be a lot of work.  You can read up on this on the MSDN reference site if you want to learn more.

Another approach would be to let each user choose where they want the initial window to appear. They could move the window to the desired position, then click a menu item (that you provide) which would run code to store the current position (using INQUIRE Screen1-Handle, SCREEN COLUMN in Screen-X-Position, SCREEN LINE in Screen-Y-Position). Then save those values (make sure they're signed, like PIC S9(4)) into a data file, keyed by the user id, hostname, or something similar (or a combination of the two). Then on the next startup, that data would be retrieved and used in a MODIFY statement to restore the position.

View solution in original post

0 Likes
DougP Outstanding Contributor.
Outstanding Contributor.

RE: Multiple monitors on a desktop

Jump to solution

In addition to Chuck's suggestions, after obtaining the column and line values for the user's desired screen position, you could use the Windows Registry to store and retrieve those settings with the registry handling library routines.  That documentation can be found here:

documentation.microfocus.com/.../BKPPPPLIBRS143.html

0 Likes
Pass5107 Absent Member.
Absent Member.

RE: Multiple monitors on a desktop

Jump to solution

Thank you both this is what I was looking for I will try these idea's out and let you what happens.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.