[perl-win32-gui-users] Splash Sceen Timing
Hi All, Firstly a hearty congratulations to those involved in contributing and releasing 0.0.670 I have a rather large GUI app that can take 20 seconds or more to load, once turned into an executable using ActiveStates PerlApp 5.2 During this time I wish to display a splash screen, provided by a preliminary exe, which launches the main application exe, then dies once the main exe is visible... similar to a lot of other major applications. I've got most of it working but can't quite get the timing to display the splash until the main application is visible. Despite seaching the web and many lists I can't find anyone else attempting to do this. Any assistance appreciated, and perhaps a candidate for the examples section on the 'The Win32GUI Documentation Project'. Chris Wearn = use Win32::GUI; use Win32::Process; # $screen_width = Win32::GUI::GetSystemMetrics(0); $screen_height = Win32::GUI::GetSystemMetrics(1); # $window_minwidth = 400; $window_minheight = 300; # # hwnd is a handle to a window my ($hWnd,$hInstance) = GUI::GetPerlWindow(); # # # Splash Screen Bitmap $imgSplash = new Win32::GUI::Bitmap("./gfx/splash.bmp"); # Set Cursor $curBusy= new Win32::GUI::Cursor("./gfx/wait.cur"); Win32::GUI::SetCursor($curBusy); # Construct the main window $splashWin = new Win32::GUI::Window( # -name => "splashWin", -title => "Splash", -left => ($screen_width - $window_minwidth) / 2, -top=> ($screen_height - $window_minheight) / 2, -width => $window_minwidth, -height => $window_minheight, -minwidth => $window_minwidth, -minheight => $window_minheight, -style => WS_POPUP, ); $bmpSplash = $splashWin->AddLabel( # -left => 0, -top=> 0, -width => 400, -height => 300, -style => 14, -name => "Bitmap", -visible=> 1, -text => "splash", ); $bmpSplash->SetImage($imgSplash); # Do the window thing... $splashWin->Show; $splashWin->Show; # twice to avoid being preset by a 'start minimized' shortcut LaunchMainApp(); my $retcode = Win32::GUI::Dialog(); # Launch Prog2 then die sub LaunchMainApp { $newProc = Win32::Process::Create($ProcessObj, "c:\\progra~1\\app\\MainApp.exe", "", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); Win32::GUI::DoEvents(); sleep 1; $desktop = GUI::GetDesktopWindow(); $window = GUI::GetWindow($desktop, GW_CHILD); while($window) { $title = GUI::Text($window); if (($title eq "MainApp") and GUI::IsVisible($window)) { printf("%16d: %s\n", $window, $title); mainwin_Terminate(); } $window = GUI::GetWindow($window, GW_HWNDNEXT); } } # Kill Application sub mainwin_Terminate { # $splashWin->Disable(); $splashWin->Hide(); die; } sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); }
RE: [perl-win32-gui-users] Splash Sceen Timing
From: "Chris Wearn" <[EMAIL PROTECTED]> I have a rather large GUI app that can take 20 seconds or more to load, once turned into an executable using ActiveStates PerlApp 5.2 During this time I wish to display a splash screen, provided by a preliminary exe, which launches the main application exe, then dies once the main exe is visible... similar to a lot of other major applications. Hi, The way I do this is to have a small program (see below) that displays the splash, and then performs an eval which brings the rest of the application into scope. In my case the splash is displayed within a second (even on a slow machine), and I set a timer that removes the splash 1 second after the main window is displayed. The build and initialisation process takes anywhere between 3 and 30 seconds depending on the machine and user options - the splash is displayed during this process. If you have any more questions, just email. Cheers, jez. use strict; use Win32::GUI; use Win32::GUI::AdHoc; use Win32::GUI::BorderlessWindow; use Win32::GUI::DIBitmap; use Cwd; my $splashimage = newFromFile Win32::GUI::DIBitmap(cwd.'\Resource\splash.png'); my $width = $splashimage->Width; my $height = $splashimage->Height; my $splash = new Win32::GUI::BorderlessWindow ( -name => "Splash", -text => "Splash", -height => $height, -width => $width, -left => 100, -top=> 100, -topmost=> 1, -addexstyle => 0x0080 ); Win32::GUI::AdHoc::windowCenter($splash); $splash->Show(); my $splashdc = $splash->GetDC; $splashimage->CopyToDC($splashdc,0,0,600,600,0,0); $splash->DoEvents(); undef($splashimage); my $string='use Client::MainApp; Client::MainApp::Init(); Client::MainApp::Go($splash); '; eval $string; if ($@) { #report error to user my $message = $@; Win32::GUI::MessageBox($splash, $message ,"Build Error", MB_OK | MB_ICONWARNING); print $message; } _ Find a cheaper internet access deal - choose one to suit you. http://www.msn.co.uk/internetaccess
Re: [perl-win32-gui-users] Win32-GUI Release 0.0.670
>> Also, this has been bugging me for a while, >> but due to my own lack of time, I've yet to research the >> equivalent: >> >>Win32::GUI: the -style option is deprecated! >>Win32::GUI: the -style option is deprecated! >>Win32::GUI: the -exstyle option is deprecated! Laurent - your fixes for these worked perfectly. Thank you kindly! They've been integrated into the CVS version of AmphetaDesk. -- Morbus Iff ( i put the demon back in codemonkey ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
Re: [perl-win32-gui-users] RE: contribution
> Hi, > > I am very curious for your Create GUI App. but I can't get it to run. I also cnnot find a readme or > install file. I just have to "guess" (or read through all the code to find out) what to do. Can you > give some directions? > > My PERL (5.8) ends with this message: > > Could not find C:\Documents and Settings\roelof\My Documents\Software\programeren\Perl Create > GUI\CreateGui\Gui.xml in at CreateGui.pl line 722 > > > Hi, > > > > I just joined this e-mail list and would like to > > contribute to this community. I have developed a > > configuration file parser which converts > > descriptions from a file into a Win32::GUI working > > code. > > > > It has saved me quite alot of time so far and I > > hope this could help others as well. > > > > http://www.stouk.com/CreateGui > > > > Respectfully, > > > > Sergy Stouk. - Hi there! I was curious too, and I couldn't get it to work either. But your first error is that you havn't read this: http://www.stouk.com/CreateGui/Training1.htm Your are to copy the Gui.xml from the first example folder. But as I said even after doing that it didn't work for me. No errors, no nothing... /Peter Janson