Keep Dialog on Top while window behind has focus

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Keep Dialog on Top while window behind has focus

Post by kpassaur » Sun Mar 18, 2007 10:44 pm

I am trying to have a window on top telling the user to wait while Processing the Window behind. When the window behind is done the window on top will disappear.

Any Ideas on how to do this as I have to set focus to the window behind

Code: Select all

COF
//Block input only if version is not 98/Me
Pos>98,WIN_VER,1,IsWin98orMe
If>{(%IsWin98orMe%=0)}
BlockInput>1
Endif

Dialog>Dialogupdatetasks
   Caption=UpDating Tasks
   Width=445
   Height=250
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=0
   Resize=0
   Image=C:\Point_PDF_Filer\Images\UpdateingFields.bmp,0,0,361,193
EndDialog>Dialogupdatetasks

Show>Dialogupdatetasks

Let>Outputmessage=
WaitWindowOpen>Point -*
SetFocus>Point -*
Wait>2
Press ALT
Send>T

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 19, 2007 7:49 am

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Dialog on top

Post by kpassaur » Mon Mar 19, 2007 9:13 am

Yes, and I use the code below currently in some of my scripts. Howver,I use it with a loop that keeps the dialog on top and the user can move their mouse and control windows behind the message box.

The way I use it now is for a message box saying "Do this and when finished click on Continue" This allows stoping the script until the user has completed a task that they have to do.

Works great. However the goal here is to keep it on top, and have MS set focus to the window behind to process.

Although, I can use the blockinput feature (nice) to keep the user from messing up the runnning script. While it is running I would like to let them know processing is taking place.

Any ideas? One thought I have is to place the Window on top with one compiled script (using the code below) make the code I want to run a standalone compiled script. Call it from the first, use the Let>RP_Wait=1 command and see if that works.

I am open to suggestions


Dialog>Dialog1
Caption=Dialog1
Top=112
Width=226
Left=16
Height=103
Button=msButton1,32,32,75,25,0
EndDialog>Dialog1

Let>HWND_TOPMOST=-1
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>Flags={%SWP_NOSIZE% OR %SWP_NOMOVE%}
Show>Dialog1
LibFunc>user32,FindWindowA,hwnd,TForm,Dialog1
LibFunc>user32,SetWindowPos,r,hwnd,HWND_TOPMOST,0,0,0,0,Flags
CloseWindow>Dialog1
Show>Dialog1,r

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Here's what I have done

Post by Aaron » Wed Apr 18, 2007 9:39 pm

I use visual basics 2005 express.

After compiling the window just call it from within MS.

I have Used this method a dozen times and it works great.

You can also have the window without borders and this way it will not appear

grayed out. Just make sure you have it topmost.

And now Microsoft gives away visual basics express free.

Hope this helped.
Aaron

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts