winapi - How do I get the dimensions (RECT) of all the screens in win32 API? -


i'm writing application testing team. application lets take screenshot of part of screen (and uploads testing team server comments).

taking screenshot involves selecting region on screen take screenshot of. i'm creating semi-transparent window , overlaying on entire screen. i'm using getdesktopwindow() , getwindowrect() dimensions of screen doesn't work in multi-screen environments.

how overlay window on possible screens?

the screen configurations can pretty exotic, such as:

     [lcd] [lcd][lcd][lcd] 

(4 lcd screens - 1 @ top, 3 @ bottom)

or

[lcd]     [lcd] [lcd][lcd][lcd] [lcd]     [lcd] 

(7 lcd screens - 3 on right, 3 on left, 1 in middle).

etc.

does know how overlay 1 window screens? wonder dimensions in 1st exotic example, when there no screen on top-row left , right?

perhaps should creating 1 overlay window per lcd screen?

any ideas?

you can use enumdisplaymonitors function this. here's little class automatically builds vector of monitors in system, union of them all.

struct monitorrects {     std::vector<rect>   rcmonitors;     rect                rccombined;      static bool callback monitorenum(hmonitor hmon,hdc hdc,lprect lprcmonitor,lparam pdata)     {         monitorrects* pthis = reinterpret_cast<monitorrects*>(pdata);         pthis->rcmonitors.push_back(*lprcmonitor);         unionrect(&pthis->rccombined, &pthis->rccombined, lprcmonitor);         return true;     }      monitorrects()     {         setrectempty(&rccombined);         enumdisplaymonitors(0, 0, monitorenum, (lparam)this);     } }; 

if create 1 big window using rccombined rectangle that, overlay screens , "missing" bits clipped out automatically system.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -