Link to home
Start Free TrialLog in
Avatar of WonHop
WonHopFlag for United States of America

asked on

Setting Focus On A VB App

I have a VB app that goes thru and make certain checks.  This can sometimes take about 3-4 minutes.  When the checks are completed, a Message Box pops up giving the results of the check.

What I need is, if while the checking process is going on, someone, lets say opens Microsoft Word to do some work in it.  

When the checking process is complete, I need to the VB app to become Visible again and setfocus on it.
I need for it to take over the screen again right before the Message Box pops up.

The name of my app is Search.exe

Thanks
WonHop
Avatar of rkot2000
rkot2000

before showing msgbox :
appactivate currentform.name like :

AppActivate Me.Name
Avatar of Richie_Simonetti
optionally,
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9


'usage
showwindow me.hwnd, SW_RESTORE
ASKER CERTIFIED SOLUTION
Avatar of ameba
ameba
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WonHop

ASKER

Hello Guys.  Thanks for the reply.  Sorry I am just now getting back to you, but I did not receive and still have not received any emails saying anyone replied and I left early Friday.  I guess I should have checked anyway like I did today.

I will check these out and see how they work.

Thanks
WonHop
Avatar of WonHop

ASKER

Hello guys.  For the app I was running, ameba's comment was the one that worked.

Thanks to you all
WonHop

Thanks!