Multi-screen display programming (7)

zhaozj2021-02-08  241

Programming for Multiple Monitors in Windows 98figure 3: Cache The Work Area

Continued from flight 2: The Virtual Desktop

This Code Snippet Caches The Work Area of ​​Every Monitor for Later Use.

// Global Variables to Store Work Area

Int gcount;

LPRECT GPRECTARRAY = NULL;

Void cacheworkares ()

{

// set the counter to 0

gcount = 0;

// delete Old Array, Since Number of Monitors MAY

// Have Changed

GPRECTARRAY;

// allocate a new array sized to the number of monitors

GPRECTARRAY = New Rect [getSystemMetrics];

ENUMDISPLAYMONITORS (NULL, NULL, MONITORENUMINFOPROC, 0);

}

// definition of callback function

Bool Callback Monitorenumproc

HMonitorhmonitor,

HDCHDCMonitor,

LprclprCMonitor,

DWORDDWDATA)

{

Monitorinfo Mi;

Mi.cbsize = sizeof (mi)

Getmonitorinfo (HMonitor, & Mi);

* GPRECTARRAY [GCOUNT] = mi.rcWork;

GCOUNT ;

}

Published as power programming in the 4/7/98 Issue of pc magazine.

转载请注明原文地址:https://www.9cbs.com/read-1701.html

New Post(0)