I am having a problem in Delphi with the use of multiple monitors.
My application consists of a main form, with several different kinds of child forms. If I started running my application (not from Delphi – the executable), and I then enable a second monitor, and then move from one type of child form to another, my application would immediately crash. The same thing happens if I have started my application with two monitors enabled, and then disable the secondary monitor.
I don’t get this behavior if I enable or disable the secondary monitor before starting my application – it only happens when I make the change while the application is running.
I found that if I set the DefaultMonitor property on all of my child forms to dmDesktop, this problem went away. I could then close one type of child form, open another, no problem.
BUT – even though the child forms now work, if I try to open a standard Delphi dialog box, like TColorDialog or TFontDialog, I get an “access violation at address…” error. This same thing happens if I call the routine ShowMessage. If I try to open one or two more such dialogs, eventually the program completely crashes.
Oddly enough, this same thing happens to Delphi itself if I disable or enable a secondary monitor – it immediately crashes (I get the charming dialog “Delphi-32 Development Environment has encountered a problem and needs to close. We are sorry for the inconvenience,” etc.)
Admittedly, I am running an older version of Delphi (version 5.0, build 5.62) and Windows XP, version 5.1. This same thing happens when I run the executable on a newer laptop that is running Windows Vista.
Has anyone else ever run into this problem?