Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Taskbar and applications

Hi Peter
Thanks, that's put me on the right track. Just have to evaluate the default
positioning etc now.

Geoff

"Peter T" wrote:

The code, as is, raises the .chm but does not prevent multiple instances.


The example I posted aims to cater for just that -

If the chm is open (ie its window handle is found) then
restore the chm window to front
Else
Open the chm with Shell
End if

The restore with the API call as I posted is to the previous window
'restored' .coordinates or maximized as previously left by the user. If you
want to reset to the coordinates you set in the html workshop you could do
that with another API with hardcoded coordinates. Personally I wouldn't, if
user subsequently resized or maximized it might have been for user's
preference, and easy for user to resize if necessary.

As I mentioned previously, the html help API gives a lot more control, but
Shell works too

Regards,
Peter T


"Geoff" wrote in message
...
Hi Peter
The code, as is, raises the .chm but does not prevent multiple instances.
So perhaps to explain more fully what is happening:
there are two forms, each capable of calling the .chm from a cmdbutton
After the user has scrolled to whatever in they want in the .chm and

return
to the form the .chm is sent to the taskbar. Now if the user leaves it

there
and call the second form it is very easy to forget there is an instance of
the help file already raised.
What I can do at the moment with the posted code on the second click is
create a msgbox and also prevent another instance of the .chm. It would

be
nice to Restore the .chm though instead. Ideally it would Restore to the
window state before minimising.
I have set the .chm default size and position in HTML Workshop to not
obscure the form which calls it thus the use of shell(....,1) or
vbNormalFocus.
Hope this explains better.

Geoff

"Peter T" wrote:

Hi Geoff,

You'd be much better off using the html help API, same code to open

and/or
bring help to front in previous state (though need to be careful with
certain aspects to avoid crashes).

With Shell, you can open to correct page first time, thereafter all you

can
do is bring it to front in previous maximized or restored state.

Public Declare Function FindWindowA Lib "user32" _
(ByVal lpClasssName As String, _
ByVal lpWindowName As String) As Long

Public Declare Function ShowWindow Lib "user32" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Sub test()
Dim hwnd As Long
Dim sHelp As String
Dim Res As Long

hwnd = FindWindowA("HH Parent", "help-file's main-window-caption")
If hwnd Then
ShowWindow hwnd, 1&
' occassionally might also need SetForegroundWindow hWnd (API

not
shown)
Else

sHelp = "hh.exe " & "c:\xxx.chm"
'sHelp = sHelp & "::/" & "myHelpPage.html"

Res = Shell(sHelp, vbNormalFocus)

End If
End Sub

Regards,
Peter T

"Geoff" wrote in message
...
If the file name is xxx.chm then

AppActivate "xxx"
Windows("xxx.chm").WindowState = xlMaximized
returns 'subscript out of range'

using
Activewindow.WindowState = xlMaximized
activates the help file in the taskbar but does not restore it to its
original state.

Geoff


"JLGWhiz" wrote:

Go back to ActiveWindow without the typo

ActiveWindow.WindowState = xlMaximized

If that don't do it, then the window you want is not the active

window.
But
you should be able to specify the window and use the xlMaximized
constant.

"Geoff" wrote:

Still no I'm afraid.


Geoff

"new_to_vba" wrote:

Geoff i am only new to this but have you tried

ActiveWindow.Visible=True

dont know if it will work but thought it might be worth a try.

"Geoff" wrote:

Ok that's got over the variable issue but its still not

working.
As I say
focus is switched from Excel to the app but nothing happens

beyond
that.

Geoff

"Gary Keramidas" wrote:

there's a typo,

ActiveWindow.WindowState =xlMaximized

--


Gary


"Geoff" wrote in message
...
That returns 'variable not defined'

Geoff

"JLGWhiz" wrote:

ActiveWindow.WindowState = xlMaximize

"Geoff" wrote:

I have created a Help file which is invoked from a
cmdbutton on a userform.
If the file is minimised and the user clicks the

cmdbutton
again, the code
checks to see if it is already open and prevents

multiple
instances. At
this
stage I could also generate a message to that effect.
However i thought it would be neat to emulate a click

on
the taskbar icon
and make the .chm the top window again.
I have tried
AppActivate "xxx Analysis"
ActiveWindow.WindowState = vbNormalFocus
but while the file is activated it is not brought back

up
again.
Can someone please point the way?

T.I.A.
Geoff










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Taskbar aftamath77 Excel Discussion (Misc queries) 0 November 21st 08 06:47 PM
sql vba applications AD108 Excel Programming 1 August 17th 06 07:28 AM
taskbar herbzee Excel Discussion (Misc queries) 2 March 20th 06 02:49 PM
Using VBA to select applications... [email protected] Excel Programming 3 October 25th 05 02:36 PM
Other applications Patrick Molloy[_4_] Excel Programming 2 July 23rd 03 12:08 AM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"