I would cache the Valve001 HWND to save per-frame calls to FindWindow.

On Sunday, August 29, 2010, Jonathan White <[email protected]> wrote:
> Ok, so I had to do some round-about hackish method, but hey, it works. Put
> this code in your ClientModeShared implementation in the function
> ClientModeShared::Update() to see it in action.
>
> #if !defined(_X360) && defined(_WIN32)
> #include <windows.h>
> #endif
>
> ...
>
> #ifdef _WIN32
>         HWND active = GetActiveWindow();
>         HWND mygame = FindWindow("Valve001", NULL);
>         if ( active == mygame )
>             Msg( "Game in focus!\n" );
>         else
>             Msg( "Game NOT in focus!\n" );
> #endif
>
> Thanks for the tips,
> Jon
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

-- 

Thanks,
 - Saul.

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to