now I'm adding pause feature to my game, is it OK to minimize my window this way?:
HWND hWnd = FindWindow(NULL, _T("!PYROMANIA!"));
ShowWindow( hWnd, SW_MINIMIZE);
Where !PYROMANIA! is just my game title
Is it OK to minimize my window this way?1
ShowWindow( SW_MINIMIZE) is probably all you need.
1 lines; 0 keywds; 0 nums; 3 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
game.ShowWindow( SW_MINIMIZE );
1 lines; 0 keywds; 0 nums; 4 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
ShowWindow( game.GetWindow(), SW_MINIMIZE );
1 lines; 0 keywds; 0 nums; 7 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
ShowWindow( SW_MINIMIZE );
1 lines; 0 keywds; 0 nums; 3 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
ShowWindow( GetWindow(), SW_MINIMIZE );
1 lines; 0 keywds; 0 nums; 6 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPTSTR, int )
{
HWND hWnd = FindWindow(NULL, _T("!PYROMANIA!"));
if(hWnd !=NULL)
{
ShowWindow( hWnd, SW_SHOWNORMAL);
}
else
{
_Module.Init( 0, hInstance );
Pyromania game;
pPyr = &game;
game.Run();
}
return 0;
}
16 lines; 5 keywds; 2 nums; 40 ops; 1 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPTSTR, int )
{
HWND hWnd = FindWindow(NULL, _T("!PYROMANIA!.exe"));
if(hWnd !=NULL)
{
SetForegroundWindow(hWnd);
ShowWindow( hWnd, SW_SHOWNORMAL);
}
else
{
_Module.Init( 0, hInstance );
Pyromania game;
pPyr = &game;
game.Run();
}
return 0;
}
17 lines; 5 keywds; 2 nums; 43 ops; 1 strs; 0 coms Syntactic Coloring v0.4 - Dan East
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
TCHAR uniqueName[MAX_PATH];
_stprintf( uniqueName, TEXT("PHAL_FRAMEWORK_%08X"), m_uid );
HANDLE hMutexOneInstance = ::CreateMutex( 0, FALSE, uniqueName );
bool bAlreadyRunning = (GetLastError() == ERROR_ALREADY_EXISTS);
if (bAlreadyRunning)
{
// If there is already an instance of this app running, give it focus and exit
HWND hOther = ::FindWindow( uniqueName, 0 );
if (hOther)
{
::SetForegroundWindow( hOther );
#if defined(PHAL_PLATFORM_WCE)
if (::IsWindowEnabled( hOther ))
#else
if (::IsIconic( hOther ))
#endif
::ShowWindow( hOther, SW_RESTORE );
}
return false;
}
25 lines; 11 keywds; 2 nums; 67 ops; 1 strs; 1 coms Syntactic Coloring v0.4 - Dan East