Ejemplo n.º 1
0
// This is a WINDOWS dedicated function
// LATER: This function doesn't work as expected, it won't "blink" on and off, and I cann't find a solution yet
void EngineApp::FlashWhileMinimized( void )
   {
#if !defined( _WINDOWS ) && !defined( WINDOWS )
   return;
#endif

   if( !m_pWindow )
      {
      return;
      }
   HWND hwnd = GetHwnd();
   ENG_ASSERT( hwnd );
   // If the window is minized
   if( GetWindowState() & SDL_WINDOW_MINIMIZED )
      {
      GetGlobalTimer()->GetElapsedTime();
      float totalTime = 0.f;
      SDL_Event event;
      FlashWindow( hwnd, true );

      while( true )
         {
         SDL_PumpEvents();
         if( SDL_PeepEvents( &event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT ) > 0 )
            {
            // wait for processing if close or other window event is called
            if( event.type != SDL_WINDOWEVENT ||  event.type != SDL_QUIT )
               {
               MsgProc();
               }
            // Not minimized anymore, flash for once and break
            if( !( GetWindowState() & SDL_WINDOW_MINIMIZED ) )
               {
               FlashWindow( GetHwnd(), false );
               break;
               }
            }
         else // The window has no upcoming message, keep flashing 
            {
            totalTime += GetGlobalTimer()->GetElapsedTime();
            
            if( totalTime > 1.0f )
               {
               totalTime -= 1.0f;
               FlashWindow( GetHwnd(), true );
               }
            }
         }
      }

   }
Ejemplo n.º 2
0
BOOL MDIChild::Create()
{
    if (!Register()) return FALSE;

    MDICREATESTRUCT mcs=
    {
        GetClassName(),Title,App::hInstance,x,y,w,h,Style,NULL
    };

    if (Style & (WS_HSCROLL | WS_VSCROLL)) Flags|=W_SCROLLBARS;

    CreationWindow=this;

#ifdef WIN32
    hWnd = (HWND) SendMessage( ((MDIFrame*)Parent)->hClient, WM_MDICREATE, 0, (LPARAM)(&mcs));
#else
    hWnd = LOWORD(SendMessage( ((MDIFrame*)Parent)->hClient, WM_MDICREATE, 0, (LPARAM)(&mcs)));
#endif
    if (!hWnd)	return FALSE;

    // user may not want child to save its position??
    if (Name) GetWindowState(W_SAVESTATE | W_SAVEMIN);
    return SetupWindow();
}