Hi, Roland -
I assume your app restores it's last known position and size when it opens, so it needs to be a little smarter.
Consider using the WinAPI MonitorFromRect function. Pass in a Windows rect structure loaded with your app's desired x,y,w,h properties (all values in pixels) as the first argument and zero as the second argument. Windows will pass back a monitor handle of the monitor that contains the largest portion of the rectangle (the app window). It returns zero if NO monitor contains any portion of the rectangle.
If you get a monitor handle return value of zero, force your app's window to position itself at 0,0 or 100,100, etc.
I've also used this technique for detecting when a sheet window will open outside of the MDI Client area.
HTH
- John
I did some research and WM_DISPLAYCHANGE is the proper event but PowerBuilder doesn't map that event so I am going to use the Activate event. If the app is running and I click the icon on the taskbar, it shifts over to monitor 1. If I start it and the saved position is on monitor 2, it shifts to monitor 1.