AppActivate doesn't work with Win 98 SE 
Author Message
 AppActivate doesn't work with Win 98 SE

I've got AppActivate used in my code and here's what happens:

(1) OrigApp (not my VB app but a third-party app) has the focus.
(2) I open Notepad on the Desktop and it gets the focus.
(3) My app uses AppActivate on OrigApp but its Taskbar button just
    flashes momentarily, and it doesn't get the focus.  Notepad
    retains the focus at the front of all apps on the Desktop.

Why?  How can I fix this?  I've tried using AlwaysOnTop on OrigApp
both before and after using AppActivate, to no avail.  I just can't
get it to get the focus.  I tried using the SetFocus API but VB gives
an error (can't remember what exactly, but it refuses to acknowledge
the command).  Using VB5 Pro, SP3.

Regards, Otser.



Wed, 01 Oct 2003 06:14:21 GMT  
 AppActivate doesn't work with Win 98 SE
It appears that AppActivate used the SetForgroundWindow API, whose effects
were changed for Win98 SE and Win 2000. The behaviour you are experiencing
is the new normal behaviour of SetForegroundWindow.

As alternate methods, I can offer two samples. First, try this one from my
site ... http://www.mvps.org/vbnet/code/helpers/restorehwnd.htm

If that doesn't work, you need a sledgehammer -- check
http://www.mvps.org/vb/ for the previnst demo.  You want the activate code
from that.

--

Randy Birch
MVP Visual Basic

Take the vb.net poll at:
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Please respond only to the newsgroups so all can benefit.


: I've got AppActivate used in my code and here's what happens:
:
: (1) OrigApp (not my VB app but a third-party app) has the focus.
: (2) I open Notepad on the Desktop and it gets the focus.
: (3) My app uses AppActivate on OrigApp but its Taskbar button just
:     flashes momentarily, and it doesn't get the focus.  Notepad
:     retains the focus at the front of all apps on the Desktop.
:
: Why?  How can I fix this?  I've tried using AlwaysOnTop on OrigApp
: both before and after using AppActivate, to no avail.  I just can't
: get it to get the focus.  I tried using the SetFocus API but VB gives
: an error (can't remember what exactly, but it refuses to acknowledge
: the command).  Using VB5 Pro, SP3.
:
: Regards, Otser.
:
:
:
:



Wed, 01 Oct 2003 06:24:50 GMT  
 AppActivate doesn't work with Win 98 SE

Quote:
> It appears that AppActivate used the SetForgroundWindow API, whose effects
> were changed for Win98 SE and Win 2000. The behaviour you are experiencing
> is the new normal behaviour of SetForegroundWindow.

> As alternate methods, I can offer two samples. First, try this one from my
> site ... http://www.mvps.org/vbnet/code/helpers/restorehwnd.htm

> If that doesn't work, you need a sledgehammer -- check
> http://www.mvps.org/vb/ for the previnst demo.  You want the activate code
> from that.

Unfortunately both methods failed to activate the app.  :(  Thanks for
trying to help though!  I think a better alternative would be to only
make my app continue if the foreground window = process id (from Shell)
of the third-party app; however the GetForegroundWindow value doesn't
equal the shell id for some reason...

Regards, Otser.



Wed, 01 Oct 2003 07:10:34 GMT  
 AppActivate doesn't work with Win 98 SE
The shell command returns a process ID, but GetFore... returns a handle to
the window. To equate the two, you need to determine the handle from the
shell ID ... see http://www.mvps.org/vbnet/code/system/shellhwnd.htm

--

Randy Birch
MVP Visual Basic

Take the vb.net poll at:
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Please respond only to the newsgroups so all can benefit.



:
: > It appears that AppActivate used the SetForgroundWindow API, whose
effects
: > were changed for Win98 SE and Win 2000. The behaviour you are
experiencing
: > is the new normal behaviour of SetForegroundWindow.
: >
: > As alternate methods, I can offer two samples. First, try this one from
my
: > site ... http://www.mvps.org/vbnet/code/helpers/restorehwnd.htm
: >
: > If that doesn't work, you need a sledgehammer -- check
: > http://www.mvps.org/vb/ for the previnst demo.  You want the activate
code
: > from that.
:
: Unfortunately both methods failed to activate the app.  :(  Thanks for
: trying to help though!  I think a better alternative would be to only
: make my app continue if the foreground window = process id (from Shell)
: of the third-party app; however the GetForegroundWindow value doesn't
: equal the shell id for some reason...
:
: Regards, Otser.
:
:
:



Wed, 01 Oct 2003 12:07:09 GMT  
 AppActivate doesn't work with Win 98 SE

Quote:
> The shell command returns a process ID, but GetFore... returns a handle to
> the window. To equate the two, you need to determine the handle from the
> shell ID ... see http://www.mvps.org/vbnet/code/system/shellhwnd.htm

Hi Randy,

Yep, tried that too, but all three values (shell ID,
GetWindowThreadProcessID,
and GetForegroundWindow ID) are different, thus making it impossible for me
to
accomplish my task.  :(  What's strange is that I can use the value of
GetWindowThreadProcessID in other areas of my app just fine, such as when
using OpenProcess on it, so I don't know why GetForegroundWindow doesn't
match it when that app is in the front and with the focus.  :(

Regards, Otser.



Wed, 01 Oct 2003 16:46:16 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Application runs with Windows 95/NT, but doesn't work with Windows 98

2. GetKeyState doesn't work in Windows 98

3. Default printer fonts for Win '95/98 not working

4. MSWINSCK.OCX ver 6.0.98.16 won't work on Win2K

5. AppActivate doesn't seem to work with SendKeys

6. AppActivate doesn't work on hidden dial up networking

7. Why won't this work - AppActivate VB5 ?

8. AppActivate "WordPerfect" won't work

9. Function AppActivate won't work

10. Win API Call not working in vb.net app distributed to WIn 98

11. My Listbox Won't Ignore Me (WM_SETREDRAW doesn't work)

12. ?Why won't this one line work under Windows 98 SE?

 

 
Powered by phpBB® Forum Software