Multi-Monitor Smudge
MS-Windows lost my Window...?
Apparently, it's not MS-Windows. It's me, when saving the program's last locations in an .INI file.
If I close the program. It saves the Top/Left so when run again it comes back where I left it. But if I change primary monitors, or orientation, before I run it again, I have a problem - if it was closed on any non-primary monitor. My Left = -1700 might now be +1700 and is now WAY off screen. Or too high/low, if the monitors were stacked and now side-by-side.
My multi-monitor solution was to put the following code in my On Show event.
//-------------------------------------
//reset form if primary monitor changed
int drL, drT, drR, drB;
TRect drect;
drect = Screen->DesktopRect;
drL = drect.Left;
drT = drect.Top;
drR =drect.Right;
drB = drect.Bottom;
if(Top < drT)//too high
{Top = 0;}
if(Top > drB)//too low
{Top = 0;}
if(Left < drL)//too far left
{Left = 0;}
if(Left > drR)//too far right
{Left = 0;}
//-------------------------------------
This would also help if I disconnected the secondary monitor.
C++ Smudges - Minor errors or inconsistencies: small, almost unnoticeable mistakes, like formatting issues or slightly misaligned code, that don't necessarily break the program but make it less clean or readable. Incomplete or messy code: sections of code that are not fully developed, have placeholder values, or are generally disorganized. Code that needs refinement: functions but could be optimized for performance, readability, or maintainability.
Tuesday, August 26, 2025
Subscribe to:
Post Comments (Atom)
-
Today's smudge There's gotta be an easier way..... I still have the "Setter "to write: int TCharGenerator::GetCharLine(b...
-
Smudge for today Written using C++ Builder 6 A simple program that writes a short batch file, runs it and deletes the .bat.U...
-
Snip of the week Written using C++ Builder 6 ENT ShellExecuteEx( ) - When you want to launch another program from your pro...

No comments:
Post a Comment