I want to make sure that peghelp.exe is not running when I start my
application. How do I find out if it is and then destroy the process?

I'm using this to find out if it exists :

HWND Help = ::FindWindow(_T("Help"), _T(""));

However, I always get NULL even when it is definitely running.

I have also found that when help has been started in windows that it is
difficult to terminate it, while if I call
CreateProcess(TEXT("peghelp.exe"),... then I can destroy the process.

I guess I should just leave it at seeing if anyone can help out with finding
the help window handle first though.

Re: help on help by Ilya

Ilya
Thu Dec 30 01:47:17 CST 2004

You can use tool help functions for find the "peghelp.exe" process.
(Process32First, Process32Newt and other)
"newest newbie" <newestnewbie@discussions.microsoft.com> wrote in message
news:6F06345C-C29D-4702-9019-4A36F3FFA824@microsoft.com...
> I want to make sure that peghelp.exe is not running when I start my
> application. How do I find out if it is and then destroy the process?
>
> I'm using this to find out if it exists :
>
> HWND Help = ::FindWindow(_T("Help"), _T(""));
>
> However, I always get NULL even when it is definitely running.
>
> I have also found that when help has been started in windows that it is
> difficult to terminate it, while if I call
> CreateProcess(TEXT("peghelp.exe"),... then I can destroy the process.
>
> I guess I should just leave it at seeing if anyone can help out with
finding
> the help window handle first though.



Re: help on help by Peter

Peter
Thu Dec 30 04:12:08 CST 2004

The second parameter of FindWindow is the windows caption (First is the
class name) so try:-
FindWindow(NULL, _T("Help"));

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"newest newbie" <newestnewbie@discussions.microsoft.com> wrote in message
news:6F06345C-C29D-4702-9019-4A36F3FFA824@microsoft.com...
>I want to make sure that peghelp.exe is not running when I start my
> application. How do I find out if it is and then destroy the process?
>
> I'm using this to find out if it exists :
>
> HWND Help = ::FindWindow(_T("Help"), _T(""));
>
> However, I always get NULL even when it is definitely running.
>
> I have also found that when help has been started in windows that it is
> difficult to terminate it, while if I call
> CreateProcess(TEXT("peghelp.exe"),... then I can destroy the process.
>
> I guess I should just leave it at seeing if anyone can help out with
> finding
> the help window handle first though.



Re: help on help by r_z_aret

r_z_aret
Thu Dec 30 14:54:08 CST 2004

On Wed, 29 Dec 2004 16:11:02 -0800, "newest newbie"
<newestnewbie@discussions.microsoft.com> wrote:

>I want to make sure that peghelp.exe is not running when I start my
>application. How do I find out if it is and then destroy the process?
>
> I'm using this to find out if it exists :
>
>HWND Help = ::FindWindow(_T("Help"), _T(""));
>
> However, I always get NULL even when it is definitely running.

I was skeptical about "Help" in this context. But I just used Remote
Spy ++, and confirmed it is, indeed, the window class name for the
main window for the help system (PegHelp). Have you tried using NULL
(defined in windef.h), rather than _T(""), as the second argument?
That's what I use as the second argument when I specify the window
class name. Otherwise, I'm puzzled.


>
>I have also found that when help has been started in windows that it is
>difficult to terminate it, while if I call
>CreateProcess(TEXT("peghelp.exe"),... then I can destroy the process.
>
>I guess I should just leave it at seeing if anyone can help out with finding
>the help window handle first though.


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

RE: help on help by newestnewbie

newestnewbie
Thu Dec 30 18:11:01 CST 2004

Thank you everyone very much for your help with help :)

Here's what worked for me:

FindWindow(NULL, _T("Help"));

Thanks again

Re: help on help by r_z_aret

r_z_aret
Fri Dec 31 15:13:29 CST 2004

On Thu, 30 Dec 2004 16:11:01 -0800, "newest newbie"
<newestnewbie@discussions.microsoft.com> wrote:

>Thank you everyone very much for your help with help :)
>
>Here's what worked for me:
>
> FindWindow(NULL, _T("Help"));

A word of caution:

Using FindWindow and specifying a caption (second argument) can be
slow or worse. The following is includes a detailed discussion
http://www.flounder.com/nomultiples.htm
(look for a section called "Why FindWindow doesn't work" and then look
for a paragraph that starts "But things get worse".

I _think_ FindWindow is less problematic when using only the first
argument. This is based mostly on my own _anecdotal_ experience with
both uses of FindWindow, but not controlled testing or even decent
notes. It is partly based on what I don't see in the article I
referenced and similar discussions (sorry, I think any attempt to
clarify this sentence will muddy instead).


>
> Thanks again

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com