What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to detect fullscreen application?

How to detect fullscreen application?
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: How to detect fullscreen application?
Your conversion from C++ is faulty. There are no structure types (RECT) or pass-by-reference operators (&) in JScript. Also, you can't access structure members using "rc.left" or "rc.top". I suggest you learn more about Interop and DataBloc before attempting to do such conversions.

Anyway, to get you started, I tried to convert the snippet from that thread to JScript. I didn't test whether this actually works, but it shows the principles. Have a go with it and see if you can work out the rest.
js code:
var SM_CXSCREEN = 0;
var SM_CYSCREEN = 1;

function IsFullScreenAppRunning() {
    var hWnd = Interop.Call('user32', 'GetForegroundWindow');

    if(!hWnd)
        return false;

    if(!Interop.Call('user32', 'IsWindowVisible', hWnd) || Interop.Call('user32', 'IsIconic', hWnd) || !Interop.Call('user32', 'IsZoomed', hWnd))
        return false;

    var rc = Interop.Allocate(16);
    if(!Interop.Call('user32', 'GetWindowRect', hWnd, rc))
        return false;
       
    var width = rc.ReadDWORD(8) - rc.ReadDWORD(0);
    var height = rc.ReadDWORD(12) - rc.ReadDWORD(4);

    return (width >= Interop.Call('user32', 'GetSystemMetrics', SM_CXSCREEN) && height >= Interop.Call('user32', 'GetSystemMetrics', SM_CYSCREEN));
}
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
11-28-2010 06:13 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How to detect fullscreen application? - by V@no on 11-28-2010 at 05:25 PM
RE: How to detect fullscreen application? - by Matti on 11-28-2010 at 06:13 PM
RE: RE: How to detect fullscreen application? - by V@no on 11-28-2010 at 08:18 PM
RE: How to detect fullscreen application? - by Matti on 11-28-2010 at 08:52 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On