Detect if an application is running full-screen

Hi,
I've found on the net a piece of code that detects if another application is 
running full-screen. I've tested it, but, as it is designed to compare the 
foreground window and the monitor rectangles, it returns TRUE also if the 
foreground window is the desktop.
I've tried to compare the HWND returned by GetForegroundWindow() to 
GetDesktopWindow(), but it doesn't work.
Can someone help me?
Thanks very much

This is the code:

BOOL IsUserPlayingFullscreen()

{

HWND hwnd = GetForegroundWindow();

RECT rcWindow;

GetWindowRect(hwnd,&rcWindow);

HMONITOR hm = MonitorFromRect(&rcWindow,MONITOR_DEFAULTTONULL);

if(!hm)

return FALSE;

MONITORINFO mi = {sizeof (mi)};

GetMonitorInfo(hm,&mi);

return EqualRect(&rcWindow,&mi.rcMonitor);

}


-- 
Dr. John Skandar
<yugo_amaryl@msn.com> 

0
3/18/2008 6:31:31 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
365 Views

Similar Articles

[PageSpeed] 8

Reply:

Similar Artilces:

Server Error in '/' Application. ==> Login failed URGENT ISSUE
Hi all, i am getting the follwong error when i try to run my CRM 4.0 on web client. I have done all installation correct and still struck with this problem. Your help in solving this issue will be very helpful as this is an urgent issue with us. I am attaching the error i got below ==================================== Server Error in '/' Application. ________________________________________ Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace...

Save Application State to XML: How to have each module create a "Node"?
Hi, I have an application which is built from many modules. I re-use the modules in different applications. I'd like to have each of my modules implement a "SaveState()" method. The method should return the state of the module (and any modules it contains) in some nice, easily parsable and savable format. I think this format should be XML. So should each module return an XmlElement, an XmlDocument, or an XmlDocumentFragment. I've been experimenting and I can't figure out the best way to do this. I'd like to do it "right" because I'll be doing this a l...

Application.wait
Can anyone tell me what library reference I have to install to use application.wait in my VBA in access 97 ? Thanks Jon There is no Wait method for the Application object in Access. What are you trying to do? You might be able to use the Sleep API (see http://www.mvps.org/access/api/api0021.htm at "The Access Web" for an example), or, if you're trying to wait until a shelled process is finished, see http://www.mvps.org/access/api/api0004.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "jon" <jon@dontemailme.c...

Outlook 2003 only works once then won't run until reboot
I just upgraded from Office XP pro to 2003 Pro. So far the only problem is that Outlook will only work once then I either have to reboot or put in the office disk and ask it to repair before Outlook will work again. I have uninstalled and reinstalled Office and FrontPage 2003 to see if I could clear out the problem. So far no luck. Help! Brenda Kerr brendakerr@comcast.net ...

Creating Modeless Dialogs continually causing application to grow
I have a dialog applicatin that needs to create modeless dialogs over and over again. The main application waits for the modeless dialog to finish, then repeats the procedure. I've written a simple test application that seems to exhibit the same symptoms. Main Dialog with some code removed to simplify: ( NOTE: CModelessDemoDlg::OnBnClickedButton1() is used to begin the test of creating modeless dialogs) CModelessDemoDlg::CModelessDemoDlg(CWnd* pParent /*=NULL*/) : CDialog(CModelessDemoDlg::IDD, pParent) , m_pmodeless(NULL) , m_text(_T("")) { m_hIcon = AfxGetApp()->...

How do I run a macro when a value occurs in a cell
I want to run a macro when a value appears in a cell. How can this be accomplished? Hi! This is a trivial example but you can build on it: Private Sub Worksheet_Change(ByVal Target As Range) If Range("D3") = 36 Then Range("D3").Interior.ColorIndex = 6 Else Range("D3").Interior.ColorIndex = 2 End If End Sub Put =A3*3 in D3 Try values such as 12, 10 in A3 Al -- Alf ----------------------------------------------------------------------- AlfD's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=478 View this thread: http://www.excelforu...

What event does application call when it is ended abnormally?
I use MFC Visual C++ 4.2. I need to know what event / function will be called by the application in case of they ended unexpectedly due to errors / power supply problem, etc? I will need this to decide the end of server-client connection in case one of them experiencing error and must be ended abnormally. Thank you. >I need to know what event / function will be called by the application in >case of they ended unexpectedly due to errors / power supply problem, etc? Sounds like you're looking for WM_LOWVOLTAGEDETECTED ;) If your hardware is dead, so is your software :) >...

MultiWorkbook Change Event Detection / Spell Checker
Excel 2003 or 2007. Looking to be able to force spell checking whenever any cell content is is changed. I've been successful on a single workbooks by adding Spell Check execution on Worksheet_Change. I'm hoping to take this one step further - make it an 'Add-In' so the check will run for any workbook. It looks like the Worksheet_Change event only triggers for the host workbook so an 'Add-in' will not do the job. Any suggestions to force spell checking on a change for any workbook/worksheet I modifiy? TIA, - Pat The way I would go about this i...

How to detect changes in a column?
If I have a table with sales forecast data (columns) like Customer, Amount and Status, what would be the best way to track changes in this table so I can compare my forecast week after week? -- inomata ------------------------------------------------------------------------ inomata's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=18938 View this thread: http://www.excelforum.com/showthread.php?threadid=493571 ...

Eseutil running on it's own
I have logged into our Exchange servers a few times, only to see a command prompt DOS window open and eseutil running on it's own. i didn't schedule this. Anyone know what this is? It also seems to coincide with CPU spikes from time to time, thus I get a services error saying an outbound queue can't connect to the destination. Anyone know what this is, when it runs, and how to control it? Searching ESEutil in google is like searching for a needle in a haystack. Every entry is about how to run eseutil. On Fri, 20 Jan 2006 10:17:26 -0500, "GC Postmaster" <ema...

detect and repair
my outlook 2002 had some hyperlink problems which were corrected when i used the 'detect and repair' option in help. now i have lost my addresses and all the e-mail that was in my inbox. How do i recover these items? Check this page for all you need to know: http://www.slipstick.com/config/backup.htm -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! "Mark Conner" <mdconner@prodigy.net> wrote ...

Duplicate detection detecting inactive records?
Is there any way to configure duplicate detection to not look at inactive records? I can't find any way to set this on the rules. Thank you! ...

Excel4 Workbook Wont run in Excel XP
Hi my experience in Excel is limited but have a major problem. Have been given a excel workbook that is used for producing results for downhill skiing competitions. The sheet lets you put all the competitors details in and then their basic seeding points. By the push of a button it will let you set up each race and then print out the start positions. After each race it will let you put in the times and then calculate by the push of a button the seed positions and the start order for the next race etc. until the whole competition is finished then it will let you print all the overall result...

Catching the close application event / exception ?
How do I catch the close application event or exception? I want to close a file so that the buffer is flushed when I close a console application's window using the window close button. "PeteOlcott" <PeteOlcott@gmail.com> wrote in message news:1188591912.056802.89060@50g2000hsm.googlegroups.com... > How do I catch the close application event or exception? > I want to close a file so that the buffer is flushed when I close a > console application's window using the window close button. > I believe SetConsoleCtrlHandler() is what you need to use. -- David ...

URGENT! Exchange 5.5 Error
This error: "The Microsoft Exchange Information Store service terminated with service-specific error 4294966278." The event ID is 7024. I also get this error: "The Microsoft Exchange Event Service service depends on the MSE Info Store service which failed to start because of the following error: The service has returned a service-specific error code." The event ID for that is 7001. I found this link http://support.microsoft.com/kb/q219419 and I have followed the directions on that. I'm at step 5c right now and can't go anywere because of another error: &q...

Unicode List Control in ANSI MFC application.
Hi all Is it possible to have unicode list control (means list control to display unicode strings in wchar_t ) in dialog based application (VC6) compiled as ANSI. Any method/ Sample/ steps to achive this Thanks in advance. regards J C ...

How do I check programatically whether an application is running or not?
Hi, I know I can send a message to the application that will answer, transparently to what the programmer did, to me. But I cannot remember which the message is.... Could someone just refresh my memory please? Regards, Juan > I know I can send a message to the application that will answer, >transparently to what the programmer did, to me. But I cannot remember which >the message is.... Could someone just refresh my memory please? Juan, Is SendMessageTimeout WM_NULL what you're looking for? Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq WM_NULL is often a good choi...

Invoking an Application on right click
Hi all I am using Interface IContextMenu to add a menu in context menu, Now what I want that : when we right click on any file or folder and select my given menu ( inserted using IContextmenu) then application ( Let MyApp.exe) should be invoked for that file or folder. I know Invoke method of IContextmenu interface can be used for this purpose but not sure that how to use this for invoking exe. Please guide me. Thanks > then application ( Let MyApp.exe) should be invoked for that file or folder. I dont knwo what you mean by for that file or folder. You can use ShellExecute to launch th...

Interactive application started from task scheduler
Hello, I want to make a new task in task scheduler that: 1) is run for all uses at lodgo 2) it runs with Administrator credentials 3) The task runs an application that needs to be interactive, so the app must run in the session the user is running, not session 0. Can this be done? how? Thanks. Hello Terminus MGK II [Secundus], 1. either the applicaiton runs at user logon or with a scheduled task at a specified time/date 2. you have to use RUNAS functionality to achive this and must specify an account that is member of administrators, either local computer or on t...

a running clock
i am just woundering if there is a way of having a running clock and also the date which is also up to date. i know there is crtl+shift+; but this is just stuck at one time. can someone please show me how to do a runnig clock. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ MVP Chip Pearson posted some code to do this. Check out: http://makeashorterlink.com/?G61551786 Note: A running clock will slow down the performance of Excel. I wouldn't recommend doing it. ...

How to Detect and prevent CD burn
HI, How can i stop to CD burn of any file from my system to CD.How to detect the event of CD burn and how can i stop CD burn.Basically i want to secure my file from CD burn. plz reply soon. regds vinay sheel vinays@aditi.com Vinay wrote: > HI, > How can i stop to CD burn of any file from my system to CD.How to detect the > event of CD burn and how can i stop CD burn.Basically i want to secure my > file from CD burn. You can restrict access to a file only to a certain users through NT/win200 access privileges. You can encrypt a file and therefore restrict access to a file on...

Running an application in background using CreateProcess API
i am trying to run an exe in background while seting the wShowWindow= 0; of the STARTUPINFO structure object . but the application is running in the foreground . my requirement is that i have to execute an application before proceeding further . but the user is un aware of this application. "sam" <sam@discussions.microsoft.com> wrote in message news:2252F623-FB9C-4B78-801F-2423082C6452@microsoft.com... >i am trying to run an exe in background while seting the wShowWindow= 0; of > the STARTUPINFO structure object . but the application is running in the > foregr...

My Computer not detecting my external harddrive
I have a IDE hard drive with USB casing and connected to my USB port. The problem is the hard drive partitions are not shown up in My computer. But My Computer->Manage->Storage->Disk management shows the hard drive with 3 partitions and all the three are healthy.I know there are a few bad sectors. I am sure I have not made any changes in registry that prevents drives from being shown. Please help me. Do the partitions have drive letters assigned? karthikaravind wrote: > I have a IDE hard drive with USB casing and connected to my USB port. > The problem is the ha...

Application does not open in front
I've got an application (dialog based) which does not start up in front of the other windows. For example, if I start the application from Windows Explorer, it will display behind Explorer instead of in front of it. I played around with ShowWindow(), and I can make the application come up minimized or maximized, but I can't seem to bring it to the front! The "Set Foreground" checkbox in the dialog properties does not seem to have any effect either. What can be the problem here? ff123 On Wed, 30 Jul 2003 04:41:47 GMT, ff123 <ff123@noneya.org> wrote: >I've g...

VBE Screen pops up of its own accord
I don't know if this is the result of an unintentional click on my part: After Excel has been idle long enough for the screen saver to activate, the VBE screen pops up, at VBA Project "PDFWriter.xla," something that I certainly did not insert myself. Any idea how I can get rid of this annoying occurrence? ...