in reply to Re: Bring Win32 command window to foreground
in thread Bring Win32 command window to foreground

Thank you!

You actually answered my question that I asked in Tk::DialogBox as the top window. When I was reading your post, I suddenly realized that to raise the DailogBox to front is not enough. What I should do is to:

  1. Bring console window to font
  2. show DialogBox

I modified your code a little bit just because I am more used to Win32::API ;-)

my $api1 = Win32::API->new('kernel32', 'GetConsoleWindow', '', 'N'); my $api2 = Win32::API->new('user32', 'ShowWindow' , 'NN', 'N'); my $i = $api1->Call();; $api2->Call($i, 1); my $dialog = $mw->DialogBox(-title => "Is $host trusted?", -buttons => + ["Yes", "No"]); $dialog->geometry("600x50+0+0"); $dialog->deiconify(); my $answer = $dialog->Show();

Replies are listed 'Best First'.
Re^3: Bring Win32 command window to foreground
by richz (Beadle) on Oct 13, 2004 at 04:51 UTC
    Thanks to both of you for your help. That is what I was looking for but for some reason my console window won't actually come to the foreground.

    I have a perl script that launches another application, i.e. Matlab, so the console window can't be seen in the background. If I do call the ShowWindow() API the console window isn't brought to the foreground in front of the matlab application. Any thoughts on this?