Multiple monitors on a desktop

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?

  • Verified Answer

    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.

  • 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

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