Exemplo n.º 1
0
void KillSplashScreen()
{
  NS_TIMELINE_MARK_FUNCTION("KillSplashScreen");

  if (gSplashScreenDialog) 
  {
    EndDialog((HWND)gSplashScreenDialog, 0);
    gSplashScreenDialog = NULL;
  }
}
Exemplo n.º 2
0
void CreateSplashScreen()
{
  NS_TIMELINE_MARK_FUNCTION("CreateSplashScreen");

  DWORD threadID;
  HANDLE handle = CreateThread( 0, 
                                0, 
                                (LPTHREAD_START_ROUTINE)SplashScreenThreadProc, 
                                0, 
                                0, 
                                &threadID );
  CloseHandle(handle);
}
nsresult
nsStringBundle::LoadProperties()
{
  // this is different than mLoaded, because we only want to attempt
  // to load once
  // we only want to load once, but if we've tried once and failed,
  // continue to throw an error!
  if (mAttemptedLoad) {
    if (mLoaded)
      return NS_OK;
      
    return NS_ERROR_UNEXPECTED;
  }
  
  mAttemptedLoad = PR_TRUE;

  nsresult rv;

  // do it synchronously
  nsCOMPtr<nsIURI> uri;
  rv = NS_NewURI(getter_AddRefs(uri), mPropertiesURL);
  if (NS_FAILED(rv)) return rv;

  // We don't use NS_OpenURI because we want to tweak the channel
  nsCOMPtr<nsIChannel> channel;
  rv = NS_NewChannel(getter_AddRefs(channel), uri);
  if (NS_FAILED(rv)) return rv;

  // It's a string bundle.  We expect a text/plain type, so set that as hint
  channel->SetContentType(NS_LITERAL_CSTRING("text/plain"));
  
  nsCOMPtr<nsIInputStream> in;
  rv = channel->Open(getter_AddRefs(in));
  if (NS_FAILED(rv)) return rv;

  NS_TIMELINE_MARK_FUNCTION("loading properties");

  NS_ASSERTION(NS_SUCCEEDED(rv) && in, "Error in OpenBlockingStream");
  NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && in, NS_ERROR_FAILURE);
    
  mProps = do_CreateInstance(kPersistentPropertiesCID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  
  mAttemptedLoad = mLoaded = PR_TRUE;
  rv = mProps->Load(in);

  mLoaded = NS_SUCCEEDED(rv);
  
  return rv;
}
Exemplo n.º 4
0
BOOL CALLBACK
SplashScreenDialogProc( HWND dlg, UINT msg, WPARAM wp, LPARAM lp ) 
{
  if ( msg == WM_TIMER )
  {
    HWND progressControl = GetDlgItem(dlg, IDC_PROGRESS);

    SendMessage(progressControl, (UINT) PBM_STEPIT, (WPARAM) 0, (LPARAM) 0);
    UpdateWindow(progressControl); 
    return 0;
  }
     
  if ( msg == WM_INITDIALOG ) 
  {
    SetWindowText(dlg, "Minimo");
    
    gSplashScreenDialog = dlg;
    
    HWND bitmapControl = GetDlgItem( dlg, IDC_SPLASHBMP );
    if ( bitmapControl )
    {
      HBITMAP hbitmap = (HBITMAP)SendMessage( bitmapControl,
                                              STM_GETIMAGE,
                                              IMAGE_BITMAP,
                                              0 );
      if ( hbitmap ) 
      {
        BITMAP bitmap;
        if ( GetObject( hbitmap, sizeof bitmap, &bitmap ) )
        {
          SetWindowPos( dlg,
                        NULL,
                        GetSystemMetrics(SM_CXSCREEN)/2 - bitmap.bmWidth/2,
                        GetSystemMetrics(SM_CYSCREEN)/2 - bitmap.bmHeight/2,
                        bitmap.bmWidth,
                        bitmap.bmHeight + 10,
                        SWP_NOZORDER );


          HWND progressControl = GetDlgItem( dlg, IDC_PROGRESS );
          SetWindowPos( progressControl,
                        NULL,
                        0,
                        bitmap.bmHeight + 1,
                        bitmap.bmWidth,
                        9,
                        0);

          SendMessage(progressControl, (UINT) PBM_SETRANGE, (WPARAM) 0, MAKELPARAM (0, 200));
          //SendMessage(progressControl, (UINT) PBM_SETBARCOLOR, (WPARAM) 0, (LPARAM) (COLORREF) RGB(255,0,0));

          ShowWindow( dlg, SW_SHOW );
        }
      }
    }

    SetTimer(dlg, 1, 1000, NULL); 
    return 1;
  } 
  
  if (msg == WM_CLOSE)
  {
    NS_TIMELINE_MARK_FUNCTION("SplashScreenDialogProc Close");
    
    EndDialog(dlg, 0);
    gSplashScreenDialog = NULL;
    return 0;
  }
  return 0;
}