
How to force running VB app to the foreground?
How about using get WinAPI function FindWindow in concert with
GetWindowThreadProcessId to return the task ID of the other instance,
and then using AppActivate (a vb command)? You might want to also use
GetCurrentProcessID and check against it to avoid just activating the
same window you are currently running.
-Jake Jaffe
Quote:
> Using VB6 enterprise
> In Sub Main() I check that a previous instance of the app is not running. If it is I display an
> error message telling that only one instance can be run.
> i.e
> If App.PrevInstance Then
> MsgBox "Only one instance of this application can be run at any time!"
> End
> End If
> I would like to make this existing instance of the app the current application instead of displaying
> this error!!
> Any ideas?
> Thanks
> Adrian Harrison
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.