Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 Jul 2006
Offline Last Active Private

Topics I've Started

Compiler behaviour quiz

26 January 2013 - 06:42 AM

Here's some example code:


#include <iostream>
using namespace std;
struct number { float x; };
number test_func(void) { static number v; return v; }
int main()
    const number one = { 1.0f };

    test_func() = one;
    test_func().x += 1.0f;
    cout << test_func().x << endl;
    return 0;


Mini quiz:


1. Without using a compiler look at the code. Would you expect any warnings or errors from the compiler? Why?


2. What would you expect the output to be if it compiled?


3. Now compare your results to what actually happens when you compile it. Is it what you expected?

Alt-tab not minimizing game after initializing movie player

16 March 2009 - 09:58 AM

I've found that after calling this function my game will no longer minimize when alt-tab is pressed. This is on both ATI and Nvidia cards under XP. On Vista alt-tab still works after calling the function. Note that you'll need a reasonably recent platform SDK to get this to compile. It probably won't return true or cause problems unless you have media player 10 or newer installed too. Any suggestions on how to make alt-tab work again after calling this code would be appreciated.
#include <vmr9.h>
#include <d3d9.h>
#include <atlbase.h>
#include <comutil.h>
#include <dshow.h>

bool BreakAltTab(void)
    IBaseFilter* pBF = NULL;
    HRESULT hr = CoCreateInstance(CLSID_VideoMixingRenderer9, NULL,
                          (LPVOID *)&pBF);
        return true;
        return false;